diff options
author | rtz12 <koenig@fagott.pw> | 2016-01-20 18:34:19 (UTC) |
---|---|---|
committer | rtz12 <koenig@fagott.pw> | 2016-01-20 18:34:19 (UTC) |
commit | 5325336ea46e4347f4ca12d4daaeec6269ce6c7b (patch) | |
tree | e608e0eecc6da33aa23fd7811c2e488cfe22ce5d /Makefile | |
parent | 94da9601d1d17ddeaf1d7d5ea8df68008e90f3ab (diff) |
Buildsystem verfeinert
Dafuer JS temporaer kaputtgemacht
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 53 |
1 files changed, 41 insertions, 12 deletions
@@ -1,29 +1,58 @@ | |||
1 | CSS_FILES := $(shell find assets_src/css/ -maxdepth 1 -type f -name '*.css') | 1 | include config.mk |
2 | CSS_FILES := $(addprefix assets/, $(CSS_FILES:assets_src/%=%)) | ||
3 | LESS_FILES := $(shell find assets_src/css/ -maxdepth 1 -type f -name '*.less') | ||
4 | LESS_FILES := $(addprefix assets/, $(LESS_FILES:assets_src/%=%)) | ||
5 | LESS_FILES := $(LESS_FILES:.less=.css) | ||
6 | JS_FILES := $(shell find assets_src/js/ -maxdepth 1 -type f -name '*.js') | ||
7 | JS_FILES := $(addprefix assets/, $(JS_FILES:assets_src/%=%)) | ||
8 | 2 | ||
9 | all: $(CSS_FILES) $(LESS_FILES) $(JS_FILES) | 3 | CSS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/css/ -type f -name '*.css')) |
4 | LESS_FILES = $(patsubst assets_src/%.less, assets/%.css, $(shell find assets_src/css/ -type f -name '*.less')) | ||
5 | JS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/js/ -maxdepth 1 -type f -name '*.js')) | ||
6 | |||
7 | BROWSERIFY := ./node_modules/browserify/bin/cmd.js | ||
8 | LESSC := ./node_modules/less/bin/lessc | ||
9 | |||
10 | rewrite_imports = "s/(require\([\"'])lib/\1.\/lib/g" | ||
11 | |||
12 | all: .npm_update $(CSS_FILES) $(LESS_FILES) $(JS_FILES) | ||
13 | |||
14 | print_info: | ||
15 | @echo $(CSS_FILES) | ||
16 | @echo $(LESS_FILES) | ||
17 | @echo $(JS_FILES) | ||
18 | |||
19 | .npm_update: package.json | ||
20 | touch $@ | ||
21 | npm install | ||
22 | |||
23 | package.json: package.json.tpl config.mk | ||
24 | export NAME=$(NAME) &&\ | ||
25 | export VERSION=$(VERSION) &&\ | ||
26 | ./bin/template.awk < $< | sh > $@ | ||
10 | 27 | ||
11 | assets/css/%.css: assets_src/css/%.css | 28 | assets/css/%.css: assets_src/css/%.css |
29 | @mkdir -p $(@D) | ||
12 | cp $< $@ | 30 | cp $< $@ |
13 | 31 | ||
14 | assets/css/%.css: assets_src/css/%.less | 32 | assets/css/%.css: assets_src/css/%.less |
15 | lessc $< > $@ | 33 | mkdir -p $(@D) |
34 | @echo lessc $< > $@ | ||
35 | @$(LESSC) $< > $@ | ||
16 | 36 | ||
17 | assets/js/%.js: assets_src/js/%.js | 37 | assets/js/%.js: assets_src/js/%.js .babelrc |
18 | babel $< -o $@ | 38 | @echo browserify $< -o $@ |
39 | @$(BROWSERIFY) --debug $< -o $@ -t babelify | ||
19 | 40 | ||
20 | clean: | 41 | clean: |
21 | -rm -- $(CSS_FILES) | 42 | -rm -- $(CSS_FILES) |
22 | -rm -- $(LESS_FILES) | 43 | -rm -- $(LESS_FILES) |
23 | -rm -- $(JS_FILES) | 44 | -rm -- $(JS_FILES) |
45 | -rm -r -- .jsobj | ||
46 | |||
47 | superclean: clean | ||
48 | -rm -- .npm_last_update | ||
49 | -rm -- package.json | ||
50 | |||
51 | ultraclean: superclean | ||
52 | -rm -r -- node_modules | ||
24 | 53 | ||
25 | run: all | 54 | run: all |
26 | go run *.go | 55 | go run *.go |
27 | 56 | ||
28 | .PHONY: all clear run | 57 | .PHONY: all print_info clean superclean ultraclean run |
29 | 58 | ||