diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1,12 +1,13 @@ GIT_COMMIT ?= $(shell git rev-parse --short HEAD) LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(GIT_COMMIT)' -s -w" +GO_SRC := $(shell find . -name '*.go') BIN ?= cerrado PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin TEMPLATES_DIR := templates -TEMPLATES := $(wildcard $(TEMPLATES_DIR)/*.qtpl) +TEMPLATES := $(wildcard $(TEMPLATES_DIR)/*.qtpl) GO_TEMPLATES_FILES := $(TEMPLATES:.qtpl=.qtpl.go) SASS_DIR := scss @@ -14,13 +15,13 @@ 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/$(BIN) +build: $(BIN) + +$(BIN): $(GO_SRC) $(OUTPUT_CSS) $(GO_TEMPLATES_FILES) + go build -ldflags=$(LDFLAGS) -o $(BIN) install: - install -Dm755 bin/$(BIN) $(BINDIR)/$(BIN) + install -Dm755 $(BIN) $(BINDIR)/$(BIN) run: sass tmpl go run . @@ -40,7 +41,7 @@ $(TEMPLATES_DIR)/%.qtpl.go: $(TEMPLATES_DIR)/%.qtpl qtc $(TEMPLATES_DIR)/$*.qtpl clean: - rm -f $(OUTPUT_CSS) - rm bin/$(BIN) + -rm $(OUTPUT_CSS) + -rm $(BIN) .PHONY: sass tmpl |