diff options
| author | Teddy Wing | 2021-03-07 15:52:11 +0100 |
|---|---|---|
| committer | Teddy Wing | 2021-03-07 15:59:57 +0100 |
| commit | 9039f04a51180e21791fd061acee89d5f1e507d6 (patch) | |
| tree | 5e7e0c0209352ad28f0722b6a3a310f9389c18e1 | |
| parent | de82f396474452f4ad33cd8cfc3d475f6547d483 (diff) | |
| download | Re-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-- | Makefile | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 $@ |
