cerrado @ 78af329f2c7bc1739bcd36baf45ab95aaff43434

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