aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-10-05 15:22:12 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-10-05 15:22:12 +0200
commita36e98b8ae350eed0e9cde2ffeea0626c0f570c5 (patch)
tree59131190d4ffdbf53f2d5a5e183a6036d1924231 /Makefile
parent2fb43cc1271572d26298da70f823814cae87a3a0 (diff)
downloadcerrado-a36e98b8ae350eed0e9cde2ffeea0626c0f570c5.tar.gz
cerrado-a36e98b8ae350eed0e9cde2ffeea0626c0f570c5.tar.bz2
cerrado-a36e98b8ae350eed0e9cde2ffeea0626c0f570c5.zip
feat: Add install rule
Now it is possible to run "make install".
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 18 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 17e424d..c235179 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,26 @@
-GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
-LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(GIT_COMMIT)' -s -w"
+GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
+LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(GIT_COMMIT)' -s -w"
-TEMPLATES_DIR := templates
-TEMPLATES := $(wildcard $(TEMPLATES_DIR)/*.qtpl)
-GO_TEMPLATES_FILES := $(TEMPLATES:.qtpl=.qtpl.go)
+BIN ?= cerrado
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
-SASS_DIR := scss
-CSS_DIR := static
-OUTPUT_CSS := $(CSS_DIR)/main.$(GIT_COMMIT).css
-SASS_FILES := $(wildcard $(SASS_DIR)/*.scss)
+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
+ -o bin/$(BIN)
+
+install:
+ install -Dm755 bin/$(BIN) $(BINDIR)/$(BIN)
run: sass tmpl
go run .
@@ -34,5 +41,6 @@ $(TEMPLATES_DIR)/%.qtpl.go: $(TEMPLATES_DIR)/%.qtpl
clean:
rm -f $(OUTPUT_CSS)
+ rm bin/$(BIN)
.PHONY: sass tmpl