cerrado @ a47effe083d70cae7f039ff207087447a7a82ee0

 1GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
 2LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(GIT_COMMIT)' -s -w"
 3
 4TEMPLATES_DIR := templates
 5TEMPLATES := $(wildcard $(TEMPLATES_DIR)/*.qtpl)
 6GO_TEMPLATES_FILES := $(TEMPLATES:.qtpl=.qtpl.go)
 7
 8SASS_DIR := scss
 9CSS_DIR := static
10OUTPUT_CSS := $(CSS_DIR)/main.$(GIT_COMMIT).css
11SASS_FILES := $(wildcard $(SASS_DIR)/*.scss)
12
13build: sass tmpl
14	go build \
15		-ldflags=$(LDFLAGS) \
16		-o bin/cerrado
17
18run: sass tmpl
19	go run .
20
21test:
22	go test -v --tags=unit ./...
23
24sass: $(OUTPUT_CSS)
25
26$(OUTPUT_CSS): $(SASS_FILES)
27	@mkdir -p $(CSS_DIR)
28	sassc $(SASS_DIR)/main.scss $(OUTPUT_CSS)
29
30tmpl: $(GO_TEMPLATES_FILES)
31
32$(TEMPLATES_DIR)/%.qtpl.go: $(TEMPLATES_DIR)/%.qtpl
33	qtc $(TEMPLATES_DIR)/$*.qtpl
34
35clean:
36	rm -f $(OUTPUT_CSS)
37
38.PHONY: sass tmpl