From 7f21eec43ee50fe784f20e38019496665b1cbd30 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 5 Sep 2023 01:39:02 +0200 Subject: Makefile: Adjust no-space rules so we don't rebuild every run Now, `make app` doesn't error and says "Nothing to be done" when there are no changes. I adjusted the recipes to make the final bundle with spaces dependent on all files in the no-space bundle. Switch to `rsync` from `cp` so only the files that did change are copied. When updating the MacOS binary file, don't move it, otherwise that triggers a recompile. Instead copy it to the with-spaces .app bundle. We also need to remove the no-spaces version of the executable from the with-spaces .app bundle. Now I need to work out how to make all this work on application names that don't have spaces in them. --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5456bd7..f2fb483 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ APP_NAME := Base\ Windowed\ Application NBSP := $(shell perl -C -e 'print chr 0xfeff') APP_NAME_NOSPACE := $(subst \ ,$(NBSP),$(APP_NAME)) +NOSPACE_BUNDLE_FILES = $(shell find build/$(APP_NAME_NOSPACE).app -type f) testnospace: echo $(APP_NAME_NOSPACE) @@ -33,12 +34,15 @@ $(PRODUCT): $(OBJECTS) | build build: mkdir -p build -build/$(APP_NAME).app: build/$(APP_NAME_NOSPACE).app - cp -R $< "${@}" +# build/$(APP_NAME).app: build/$(APP_NAME_NOSPACE).app +# cp -R $< "${@}" +build/$(APP_NAME).app: $(NOSPACE_BUNDLE_FILES) + rsync -rupE build/$(APP_NAME_NOSPACE).app/ "${@}/" build/$(APP_NAME).app/Contents/MacOS/$(APP_NAME): \ -build/$(APP_NAME).app/Contents/MacOS/$(APP_NAME_NOSPACE) - mv "${<}" "${@}" +build/$(APP_NAME_NOSPACE).app/Contents/MacOS/$(APP_NAME_NOSPACE) + cp -a "${<}" "${@}" + rm -f build/$(APP_NAME).app/Contents/MacOS/$(APP_NAME_NOSPACE) # build/$(APP_NAME_NOSPACE).app/Contents/MacOS/$(APP_NAME): \ # build/$(APP_NAME_NOSPACE).app/Contents/MacOS/$(APP_NAME_NOSPACE) -- cgit v1.2.3