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