diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -1,5 +1,7 @@ | |||
1 | include config.mk | 1 | include config.mk |
2 | 2 | ||
3 | BINARY_PATH = ./bin | ||
4 | TARGET = $(BINARY_PATH)/$(NAME) | ||
3 | IMPORTER_FILES = $(shell find tools/importer/ -type f -name '*.go') | 5 | IMPORTER_FILES = $(shell find tools/importer/ -type f -name '*.go') |
4 | 6 | ||
5 | CSS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/css/ -type f -name '*.css')) | 7 | CSS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/css/ -type f -name '*.css')) |
@@ -12,7 +14,7 @@ LESSC := ./node_modules/less/bin/lessc | |||
12 | 14 | ||
13 | -include $(DEPFILES) | 15 | -include $(DEPFILES) |
14 | 16 | ||
15 | all: $(CSS_FILES) $(LESS_FILES) $(JS_FILES) eventlogging/events.go | 17 | all: assets $(TARGET) $(IMPORTER) |
16 | 18 | ||
17 | print_info: | 19 | print_info: |
18 | @echo $(CSS_FILES) | 20 | @echo $(CSS_FILES) |
@@ -20,6 +22,11 @@ print_info: | |||
20 | @echo $(JS_FILES) | 22 | @echo $(JS_FILES) |
21 | @echo $(DEPFILES) | 23 | @echo $(DEPFILES) |
22 | 24 | ||
25 | $(NAME): $(TARGET) | ||
26 | |||
27 | $(TARGET): eventlogging/events.go | ||
28 | go build -o $@ | ||
29 | |||
23 | .npm_update: package.json | 30 | .npm_update: package.json |
24 | touch $@ | 31 | touch $@ |
25 | npm install | 32 | npm install |
@@ -27,7 +34,9 @@ print_info: | |||
27 | package.json: package.json.tpl config.mk | 34 | package.json: package.json.tpl config.mk |
28 | export NAME=$(NAME) &&\ | 35 | export NAME=$(NAME) &&\ |
29 | export VERSION=$(VERSION) &&\ | 36 | export VERSION=$(VERSION) &&\ |
30 | ./bin/template.awk < $< | sh > $@ | 37 | $(BINARY_PATH)/template.awk < $< | sh > $@ |
38 | |||
39 | assets: $(CSS_FILES) $(LESS_FILES) $(JS_FILES) | ||
31 | 40 | ||
32 | assets/css/%.css: assets_src/css/%.css | 41 | assets/css/%.css: assets_src/css/%.css |
33 | @mkdir -p $(@D) | 42 | @mkdir -p $(@D) |
@@ -39,16 +48,17 @@ assets/css/%.css: assets_src/css/%.less .npm_update | |||
39 | @$(LESSC) $< > $@ | 48 | @$(LESSC) $< > $@ |
40 | 49 | ||
41 | assets_src/js/%.d: assets_src/js/%.js | 50 | assets_src/js/%.d: assets_src/js/%.js |
42 | @./bin/generate-dependencies $(patsubst assets_src/%, assets/%, $<) $< $@ | 51 | @$(BINARY_PATH)/generate-dependencies $(patsubst assets_src/%, assets/%, $<) $< $@ |
43 | 52 | ||
44 | assets/js/%.js: assets_src/js/%.js assets_src/js/%.d .babelrc .npm_update | 53 | assets/js/%.js: assets_src/js/%.js assets_src/js/%.d .babelrc .npm_update |
45 | @echo browserify $< -o $@ | 54 | @echo browserify $< -o $@ |
46 | @$(BROWSERIFY) --debug $< -o $@ -t babelify | 55 | @$(BROWSERIFY) --debug $< -o $@ -t babelify |
47 | 56 | ||
48 | eventlogging/events.go: eventlogging/events.txt | 57 | eventlogging/events.go: eventlogging/events.txt |
49 | @./bin/generate-events < $< > $@ | 58 | ./bin/generate-events < $< > $@ |
50 | 59 | ||
51 | clean: | 60 | clean: |
61 | -rm -- $(BINARY_PATH)/$(NAME) | ||
52 | -rm -- $(CSS_FILES) | 62 | -rm -- $(CSS_FILES) |
53 | -rm -- $(LESS_FILES) | 63 | -rm -- $(LESS_FILES) |
54 | -rm -- $(JS_FILES) | 64 | -rm -- $(JS_FILES) |
@@ -63,11 +73,11 @@ superclean: clean | |||
63 | ultraclean: superclean | 73 | ultraclean: superclean |
64 | -rm -r -- node_modules | 74 | -rm -r -- node_modules |
65 | 75 | ||
66 | run: all | 76 | run: assets $(TARGET) |
67 | go run *.go | 77 | $(TARGET) |
68 | 78 | ||
69 | importer: $(IMPORTER_FILES) | 79 | importer: $(IMPORTER_FILES) |
70 | go build -o importer tools/importer/*.go | 80 | go build -o importer tools/importer/*.go |
71 | 81 | ||
72 | .PHONY: all print_info clean superclean ultraclean run | 82 | .PHONY: all assets $(NAME) $(TARGET) print_info clean superclean ultraclean run |
73 | 83 | ||