From 0eefdb9250f5a24df5ef86c380ec03f8918af68a Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 18 Jul 2018 08:14:41 -0400 Subject: [PATCH] Improve scripts change detection in Makefile When changing a script in `src/scripts`, `make` would need to be invoked twice for a proper build: once for `scripts.h` and once for the `.o` files depending on it. This commit fixes this by integrating `src/scripts/Makefile` into `src/Makefile` to allow for proper dependency update detection. --- src/Makefile | 10 +++++++++- src/scripts/Makefile | 18 ------------------ 2 files changed, 9 insertions(+), 19 deletions(-) delete mode 100644 src/scripts/Makefile diff --git a/src/Makefile b/src/Makefile index 6ca4e5e..f368d23 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,11 +1,14 @@ include ../config.mk OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) +JSFILES = $(wildcard scripts/*.js) +CSSFILES = $(wildcard scripts/*.css) all: vimb webextension.subdir-all clean: webextension.subdir-clean $(RM) vimb $(OBJ) + $(RM) scripts/scripts.h vimb: $(OBJ) @echo "${CC} $@" @@ -22,7 +25,12 @@ normal.o: scripts/scripts.h setting.o: scripts/scripts.h -scripts/scripts.h: scripts.subdir-all +scripts/scripts.h: $(JSFILES) $(CSSFILES) + $(Q)$(RM) $@ + @echo "create $@ from *.{css,js}" + $(Q)for file in $(JSFILES) $(CSSFILES); do \ + ./scripts/js2h.sh $$file >> $@; \ + done config.h: @echo create $@ from config.def.h diff --git a/src/scripts/Makefile b/src/scripts/Makefile deleted file mode 100644 index e28955e..0000000 --- a/src/scripts/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../../config.mk - -JSFILES = $(wildcard *.js) -CSSFILES = $(wildcard *.css) - -all: scripts.h - -clean: - $(RM) scripts.h - -scripts.h: $(JSFILES) $(CSSFILES) - $(Q)$(RM) $@ - @echo "create $@ from *.{css,js}" - $(Q)for file in $(JSFILES) $(CSSFILES); do \ - ./js2h.sh $$file >> $@; \ - done - -.PHONY: all clean -- 2.20.1