summaryrefslogtreecommitdiff
path: root/src/Makefile
blob: 7f037c63d7c9fb35b4b11f2be4e5c7b2b0956683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
BASEDIR=..
include $(BASEDIR)/config.mk

SUBDIRS  = webextension
OBJ      = $(patsubst %.c, %.o, $(wildcard *.c))
JSFILES  = $(wildcard scripts/*.js)
CSSFILES = $(wildcard scripts/*.css)

all: vimb $(SUBDIRS:%=%.subdir-all)

clean: $(SUBDIRS:%=%.subdir-clean)
	$(RM) vimb *.o scripts/scripts.h

vimb: $(OBJ)
	@echo "${CC} $@"
	$(Q)$(CC) $(OBJ) $(LDFLAGS) -o $@

$(OBJ): config.h $(BASEDIR)/config.mk scripts/scripts.h

-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) $(CFLAGS) -c -o $@ $<

%.subdir-all: config.h
	$(Q)$(MAKE) -C $*

%.subdir-clean:
	$(Q)$(MAKE) -C $* clean

.PHONY: all clean