From fe4d1c606789ae16b6b972ebbd2d71bdc97e5038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 3 Aug 2018 01:22:33 +0200 Subject: [PATCH] Teach Makefile how to shadow-build Allows running make -f /path/to/Makefile to keep the build artifacts out of the source directory. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index f6ab514..4bb3708 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ TARGET = sparsebundlefs +# Note: Doesn't work for paths with spaces in them +SRC_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +vpath %.cpp $(SRC_DIR) + PKG_CONFIG = pkg-config override CFLAGS += -std=c++11 -Wall -pedantic -O2 -g