-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (34 loc) · 1.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
TEMPLATE := templates
OUTPUT := output
CONTENT := content
TPL := $(wildcard $(TEMPLATE)/*.css) \
$(shell find templates -name "*.html") \
$(shell find templates -name "*.js")
TPL_OUT := $(patsubst $(TEMPLATE)%, $(OUTPUT)%, $(TPL))
STATIC := $(wildcard $(TEMPLATE)/*.png) \
$(wildcard $(TEMPLATE)/*.webp) \
$(wildcard $(TEMPLATE)/*.jpg) \
$(wildcard $(TEMPLATE)/*.txt)
STATIC_OUT := $(patsubst $(TEMPLATE)%, $(OUTPUT)%, $(STATIC))
SRCS := $(wildcard cmd/*.go *.go posts/*.go)
GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
TEMPLATIZE := GIT_COMMIT_HASH=$(GIT_COMMIT_HASH) ./beeceej.com
$(OUTPUT)/%.html: beeceej.com $(TPL)
$(TEMPLATIZE) $@
$(OUTPUT)/%.css: beeceej.com $(TPL)
$(TEMPLATIZE) $@
$(OUTPUT)/%.js: beeceej.com $(TPL)
$(TEMPLATIZE) $@
$(OUTPUT)/%.png: beeceej.com $(STATIC)
cp $(TEMPLATE)/$(notdir $@) $@
$(OUTPUT)/%.jpg: beeceej.com $(STATIC)
cp $(TEMPLATE)/$(notdir $@) $@
$(OUTPUT)/%.webp: beeceej.com $(STATIC)
cp $(TEMPLATE)/$(notdir $@) $@
$(OUTPUT)/%.txt: beeceej.com $(STATIC)
cp $(TEMPLATE)/$(notdir $@) $@
all: beeceej.com $(TPL_OUT) $(STATIC_OUT)
beeceej.com: $(SRCS)
go build -o beeceej.com cmd/main.go
clean:
rm -rf output/*