cerrado @ 39f2578e79b6db426ad3dd5db4898bcc7820e44a

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