aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTeddy Wing2018-11-05 01:19:55 +0100
committerTeddy Wing2018-11-05 01:19:55 +0100
commitc64bbfd6eb6c4485076265c8be3c28ff3c18fdab (patch)
treedaf6e4494a933d0cea876e8160abf8aad0485088 /Makefile
parent2e9cb5076e683f3a05ae10638f8d2ec8b4170276 (diff)
downloadDomeKey-c64bbfd6eb6c4485076265c8be3c28ff3c18fdab.tar.bz2
Makefile: Use project-local build directory
Set 'DerivedData' path in `xcodebuild` to give us a local build directory. Doing this because when the 'Debug', or 'Release' directories in 'Build/Products/' don't exist, Make doesn't build our recipes. Make seems to prefer local files, and I don't imagine the wildcard in the path does us any favours. When I changed the DerivedData path, I ended up with this error: In file included from DomeKey/DomeKey/HeadphoneKey.m:9: DomeKey/DomeKey/HeadphoneKey.h:10:9: fatal error: 'DDHidLib/DDHidAppleMikey.h' file not found #import <DDHidLib/DDHidAppleMikey.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Couldn't figure out what the problem was, and what changed there when I changed the DerivedData directory. So I just fixed it in the only way I could think of: adding the DDHidLib 'lib' directory to `HEADER_SEARCH_PATHS` and updating the `#import` to point to the new location. We also create a release target in this commit, which gives us a release build of the program.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 20 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index b7d74f0..28583ea 100644
--- a/Makefile
+++ b/Makefile
@@ -9,26 +9,43 @@ RUST_LOCAL_LIB := target/debug/libdome_key_map.a
RUST_LIB := $(RUST_DIR)/$(RUST_LOCAL_LIB)
RUST_SOURCE_FILES := $(shell find $(RUST_DIR)/src -type f -name '*.rs')
-DEBUG_PRODUCT := ~/Library/Developer/Xcode/DerivedData/DomeKey-*/Build/Products/Debug/DomeKey
+RUST_LOCAL_LIB_RELEASE := target/release/libdome_key_map.a
+RUST_LIB_RELEASE := $(RUST_DIR)/$(RUST_LOCAL_LIB_RELEASE)
+
+DEBUG_PRODUCT := build/Build/Products/Debug/DomeKey
+RELEASE_PRODUCT := build/Build/Products/Release/DomeKey
.PHONY: build
build: $(DEBUG_PRODUCT)
$(DEBUG_PRODUCT): $(SOURCE_FILES) $(RUST_LIB)
- xcodebuild -scheme DomeKey -configuration Debug
+ xcodebuild -scheme DomeKey -configuration Debug -derivedDataPath build
$(RUST_LIB): $(RUST_SOURCE_FILES)
$(MAKE) -C $(RUST_DIR) $(RUST_LOCAL_LIB)
.PHONY: clean
clean:
- xcodebuild -scheme DomeKey -configuration Debug clean
+ xcodebuild -scheme DomeKey -configuration Debug -derivedDataPath build clean
.PHONY: run
run: build
$(DEBUG_PRODUCT) --daemon
+.PHONY: build-release
+build-release: $(RELEASE_PRODUCT)
+
+$(RELEASE_PRODUCT): $(SOURCE_FILES) $(RUST_LIB_RELEASE)
+ xcodebuild -scheme DomeKey -configuration Release -derivedDataPath build
+
+$(RUST_LIB_RELEASE): $(RUST_SOURCE_FILES)
+ $(MAKE) -C $(RUST_DIR) $(RUST_LOCAL_LIB_RELEASE)
+
+.PHONY: clean-release
+clean-release:
+ xcodebuild -scheme DomeKey -configuration Release -derivedDataPath build clean
+
DomeKey/sound_data.h: sounds/*.mp3
: > $@
echo '#ifndef SOUND_DATA_H' >> $@