-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile
62 lines (48 loc) · 1.45 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
SOURCE = $(shell find . -name '*.go')
TAG ?= $(shell git describe --tags)
GOBUILD = go build -ldflags '-s -w'
ALL = \
$(foreach suffix,linux mac win.exe,\
build/gostatic-64-$(suffix))
all: $(ALL)
run:
go run *.go test/config --summary
render:
go run *.go test/config
config:
go run *.go test/config --show-config
### Utils
fmt:
gofmt -w=true *.go
morphdom:
curl -Lo hotreload/assets/morphdom.js https://github.com/patrick-steele-idem/morphdom/raw/master/dist/morphdom-umd.js
### Releases
# os is determined as thus: if variable of suffix exists, it's taken, if not, then
# suffix itself is taken
win.exe = GOOS=windows GOARCH=amd64
linux = GOOS=linux GOARCH=amd64
mac-amd64 = GOOS=darwin GOARCH=amd64
mac-arm64 = GOOS=darwin GOARCH=arm64
build/gostatic-64-%: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 $($*) $(GOBUILD) -o $@
build/gostatic-64-mac: %: %-amd64 %-arm64
@mkdir -p $(@D)
lipo -create -output $@ $^
# NOTE: first push a tag, then make release!
ifndef desc
release:
@echo "You forgot description! Run it as 'make release desc=tralala'"
else
release: $(ALL)
github-release release -u piranha -r gostatic -t "$(TAG)" -n "$(TAG)" --description '$(desc)'
@sleep 1
@for x in $(ALL); do \
github-release upload -u piranha \
-r gostatic \
-t "$(TAG)" \
-f "$$x" \
-n "$$(basename $$x)" \
&& echo "Uploaded $$x"; \
done
endif