From e1faf06e1dfde64407ac66dc78e51c3bd83d63dd Mon Sep 17 00:00:00 2001 From: Robert Timm Date: Sat, 8 Apr 2017 00:38:58 +0200 Subject: [PATCH] moves scripts.h make target to src/Makefile this allows better dependency tracking like regenerate scripts.h only if a js file changed and only rebuild objects if scripts.h changed --- src/Makefile | 13 ++++++++++--- src/scripts/Makefile | 18 ------------------ 2 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 src/scripts/Makefile diff --git a/src/Makefile b/src/Makefile index d85bd26..5ec16d8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,18 +1,19 @@ BASEDIR=.. include $(BASEDIR)/config.mk -SUBDIRS = scripts webextension +SUBDIRS = webextension OBJ = $(patsubst %.c, %.o, $(wildcard *.c)) +JSFILES = $(wildcard scripts/*.js) all: vimb clean: $(SUBDIRS:%=%.subdir-clean) - $(RM) vimb *.o + $(RM) vimb *.o scripts/scripts.h vimb: $(OBJ) webextension.subdir-all $(CC) $(LDFLAGS) $(OBJ) -o $@ -$(OBJ): scripts.subdir-all config.h $(BASEDIR)/config.mk +$(OBJ): config.h $(BASEDIR)/config.mk scripts/scripts.h -include $(OBJ:.o=.d) @@ -20,6 +21,12 @@ config.h: @echo create $@ from config.def.h @cp config.def.h $@ +scripts/scripts.h: $(JSFILES) + @echo "create $@ from *.js" + @for file in $(JSFILES); do \ + ./scripts/js2h.sh $$file >> $@; \ + done + %.o: %.c @echo "${CC} $@" @$(CC) $(CFLAGS) -c -o $@ $< diff --git a/src/scripts/Makefile b/src/scripts/Makefile deleted file mode 100644 index 93f242d..0000000 --- a/src/scripts/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -BASEDIR=../.. -include $(BASEDIR)/config.mk - -JSFILES = $(wildcard *.js) - -all: scripts.h - -clean: - $(RM) scripts.h - -scripts.h: $(JSFILES) - @echo "create $@ from *.js" - @for file in $(JSFILES); do \ - ./js2h.sh $$file >> $@; \ - done - -.PHONY: all clean - -- 2.20.1