From 1b1fed99b7a97b4b774e6f8b39a91f82cbe5d6f3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 25 Sep 2018 15:28:30 +0200 Subject: Makefile: Fix dependency on Rust lib Turns out the order-only prerequisite from 8c363688ac173d34c865b8271ade8c845b67fa24 was a false lead. That just made Make ignore the timestamp on the file and caused it to rebuild the dependency tree correctly. Looks like we need an actual dependency on the Rust source files in order to get the tree working correctly. Can't just call into the sub-make and have it work. Change the `RUST_LIB` prerequisite to point to the actual file because otherwise it always has the latest timestamp, causing `xcodebuild` to run. Unfortunately we end up with duplication between this Makefile and the one in `dome-key-map`, but that seems unavoidable if we want to set up the dependencies correctly. Now it finally seems to work right. --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 687d70a..3d575de 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,9 @@ SOURCE_FILES := $(shell find DomeKey lib \ -or -name '*.c') RUST_DIR := lib/dome-key-map -RUST_LIB := target/debug/libdome_key_map.a +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 @@ -13,11 +15,11 @@ DEBUG_PRODUCT := ~/Library/Developer/Xcode/DerivedData/DomeKey-*/Build/Products/ .PHONY: build build: $(DEBUG_PRODUCT) -$(DEBUG_PRODUCT): $(SOURCE_FILES) | $(RUST_LIB) +$(DEBUG_PRODUCT): $(SOURCE_FILES) $(RUST_LIB) xcodebuild -scheme DomeKey -configuration Debug -$(RUST_LIB): - $(MAKE) -C $(RUST_DIR) $@ +$(RUST_LIB): $(RUST_SOURCE_FILES) + $(MAKE) -C $(RUST_DIR) $(RUST_LOCAL_LIB) .PHONY: run run: build -- cgit v1.2.3