include config.mk BINARY_PATH = ./bin TARGET = $(BINARY_PATH)/$(NAME) IMPORTER_FILES = $(shell find tools/importer/ -type f -name '*.go') CSS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/css/ -type f -name '*.css')) LESS_FILES = $(patsubst assets_src/%.less, assets/%.css, $(shell find assets_src/css/ -type f -name '*.less')) JS_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/js/ -maxdepth 1 -type f -name '*.js')) IMG_FILES = $(patsubst assets_src/%, assets/%, $(shell find assets_src/img/ -maxdepth 1 -type f)) DEPFILES = $(patsubst assets/%, assets_src/%, $(JS_FILES:.js=.d)) BROWSERIFY := ./node_modules/browserify/bin/cmd.js LESSC := ./node_modules/less/bin/lessc -include $(DEPFILES) all: assets $(TARGET) $(IMPORTER) print_info: @echo $(CSS_FILES) @echo $(LESS_FILES) @echo $(JS_FILES) @echo $(DEPFILES) $(NAME): $(TARGET) $(TARGET): eventlogging/events.go go build -o $@ .npm_update: package.json touch $@ npm install package.json: package.json.tpl config.mk export NAME=$(NAME) &&\ export VERSION=$(VERSION) &&\ $(BINARY_PATH)/template.awk < $< | sh > $@ assets: $(CSS_FILES) $(LESS_FILES) $(JS_FILES) $(IMG_FILES) assets/img/%: assets_src/img/% @mkdir -p $(@D) cp $< $@ assets/css/%.css: assets_src/css/%.css @mkdir -p $(@D) cp $< $@ assets/css/%.css: assets_src/css/%.less .npm_update mkdir -p $(@D) @echo lessc $< > $@ @$(LESSC) $< > $@ assets_src/js/%.d: assets_src/js/%.js @$(BINARY_PATH)/generate-dependencies $(patsubst assets_src/%, assets/%, $<) $< $@ assets/js/%.js: assets_src/js/%.js assets_src/js/%.d .babelrc .npm_update @echo browserify $< -o $@ @$(BROWSERIFY) --debug $< -o $@ -t babelify eventlogging/events.go: eventlogging/events.txt ./bin/generate-events < $< > $@ clean: -rm -- $(BINARY_PATH)/$(NAME) -rm -- $(CSS_FILES) -rm -- $(LESS_FILES) -rm -- $(JS_FILES) -rm -- $(DEPFILES) -rm -- importer -rm -- eventlogging/events.go superclean: clean -rm -- .npm_update -rm -- package.json ultraclean: superclean -rm -r -- node_modules run: assets $(TARGET) $(TARGET) importer: $(IMPORTER_FILES) go build -o importer tools/importer/*.go .PHONY: all assets $(NAME) $(TARGET) print_info clean superclean ultraclean run