diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 41 |
1 files changed, 24 insertions, 17 deletions
@@ -1,7 +1,16 @@ -SLUG ?= $(shell git rev-parse --short HEAD) -LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(SLUG)' -s -w" +GIT_COMMIT ?= $(shell git rev-parse --short HEAD) +LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(GIT_COMMIT)' -s -w" -build: sass-slug tmpl +TEMPLATES_DIR := templates +TEMPLATES := $(wildcard $(TEMPLATES_DIR)/*.qtpl) +GO_TEMPLATES_FILES := $(TEMPLATES:.qtpl=.qtpl.go) + +SASS_DIR := scss +CSS_DIR := static +OUTPUT_CSS := $(CSS_DIR)/main.$(GIT_COMMIT).css +SASS_FILES := $(wildcard $(SASS_DIR)/*.scss) + +build: sass tmpl go build \ -ldflags=$(LDFLAGS) \ -o bin/cerrado @@ -12,20 +21,18 @@ run: sass tmpl test: go test -v --tags=unit ./... -# this is meant for "prod" build -sass-slug: - mkdir -p static - sassc \ - --style compressed \ - -I scss scss/main.scss static/main.$(SLUG).css +sass: $(OUTPUT_CSS) + +$(OUTPUT_CSS): $(SASS_FILES) + @mkdir -p $(CSS_DIR) + sassc $(SASS_DIR)/main.scss $(OUTPUT_CSS) + +tmpl: $(GO_TEMPLATES_FILES) -sass: - mkdir -p static - sassc \ - -I scss scss/main.scss static/main.css +$(TEMPLATES_DIR)/%.qtpl.go: $(TEMPLATES_DIR)/%.qtpl + qtc $(TEMPLATES_DIR)/$*.qtpl -tmpl: - cd ./templates && \ - qtc * +clean: + rm -f $(OUTPUT_CSS) -.PHONY: sass +.PHONY: sass tmpl |