aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-03-07 15:52:11 +0100
committerTeddy Wing2021-03-07 15:59:57 +0100
commit9039f04a51180e21791fd061acee89d5f1e507d6 (patch)
tree5e7e0c0209352ad28f0722b6a3a310f9389c18e1
parentde82f396474452f4ad33cd8cfc3d475f6547d483 (diff)
downloadRe-Good-Catalina-Invert-Colours-9039f04a51180e21791fd061acee89d5f1e507d6.tar.bz2
Makefile: Create build directories
Ensure the build directories are available when building. Read up on techniques for creating directories in prerequisites here: https://www.cmcrossroads.com/article/making-directories-gnu-make
-rw-r--r--Makefile13
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 65a24f3..3748d95 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,9 @@ SOURCES := $(shell ls *.{h,m})
DDHOTKEY_OBJ := $(patsubst %.m,%.o,$(wildcard lib/DDHotKey/*.m))
+BUILD_DIR := $(abspath build)
+LOCAL_INCLUDE_DIR := $(BUILD_DIR)/include
+
all: $(SOURCES) build/libddhotkey.a build/include/*.h
clang -x objective-c \
@@ -18,7 +21,7 @@ all: $(SOURCES) build/libddhotkey.a build/include/*.h
-o invert-catalina-invert \
$(SOURCES)
-build/include/%.h: lib/DDHotKey/%.h
+build/include/%.h: lib/DDHotKey/%.h | $(LOCAL_INCLUDE_DIR)
cp $^ build/include/
lib/DDHotKey/%.o: lib/DDHotKey/%.m
@@ -30,7 +33,13 @@ lib/DDHotKey/%.o: lib/DDHotKey/%.m
mv *.o lib/DDHotKey/
-build/libddhotkey.a: $(DDHOTKEY_OBJ)
+build/libddhotkey.a: $(DDHOTKEY_OBJ) | $(BUILD_DIR)
libtool -static \
-o $@ \
$^
+
+$(BUILD_DIR):
+ mkdir -p $@
+
+$(LOCAL_INCLUDE_DIR): | $(BUILD_DIR)
+ mkdir -p $@