From: Robert Timm <mail@rtti.de>
Date: Fri, 7 Apr 2017 22:38:58 +0000 (+0200)
Subject: moves scripts.h make target to src/Makefile
X-Git-Url: https://git.owens.tech/assets/wrapped.html/assets/wrapped.html/git?a=commitdiff_plain;h=e1faf06e1dfde64407ac66dc78e51c3bd83d63dd;p=vimb.git

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
---

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
-