Use separate makefile in for scripts.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 14 Apr 2018 19:57:07 +0000 (21:57 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 14 Apr 2018 19:57:07 +0000 (21:57 +0200)
src/Makefile
src/scripts/Makefile [new file with mode: 0644]
src/webextension/Makefile

index a22d7a6..9c0ed2b 100644 (file)
@@ -1,13 +1,11 @@
 include ../config.mk
 
-OBJ      = $(patsubst %.c, %.o, $(wildcard *.c))
-JSFILES  = $(wildcard scripts/*.js)
-CSSFILES = $(wildcard scripts/*.css)
+OBJ = $(patsubst %.c, %.o, $(wildcard *.c))
 
 all: vimb webextension.subdir-all
 
 clean: webextension.subdir-clean
-       $(RM) vimb *.o scripts/scripts.h
+       $(RM) vimb $(OBJ)
 
 vimb: $(OBJ)
        @echo "${CC} $@"
@@ -19,19 +17,14 @@ normal.o: scripts/scripts.h
 
 setting.o: scripts/scripts.h
 
+scripts/scripts.h: scripts.subdir-all
+
 -include $(OBJ:.o=.d)
 
 config.h:
        @echo create $@ from config.def.h
        $(Q)cp config.def.h $@
 
-scripts/scripts.h: $(JSFILES) $(CSSFILES)
-       $(Q)$(RM) $@
-       @echo "create $@ from *.{css,js}"
-       $(Q)for file in $(JSFILES) $(CSSFILES); do \
-               ./scripts/js2h.sh $$file >> $@; \
-       done
-
 %.o: %.c
        @echo "${CC} $@"
        $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
diff --git a/src/scripts/Makefile b/src/scripts/Makefile
new file mode 100644 (file)
index 0000000..e28955e
--- /dev/null
@@ -0,0 +1,18 @@
+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
index 91de2f5..2f438b5 100644 (file)
@@ -5,7 +5,7 @@ OBJ = $(patsubst %.c, %.lo, $(wildcard *.c))
 all: $(EXTTARGET)
 
 clean:
-       $(RM) $(EXTTARGET) *.lo
+       $(RM) $(EXTTARGET) $($OBJ)
 
 $(EXTTARGET): $(OBJ)
        @echo "$(CC) $@"