-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (35 loc) · 1017 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (35 loc) · 1017 Bytes
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
prefix ?= /usr
.DEFAULT_GOAL := build
SWAG := $(shell command -v swag || echo 'go tool swag')
XDRASLTEXT := $(shell command -v xdrasltext || echo 'go run ./cmd/xdrasltext')
node_modules: package.json
npm install
.PHONY: messages.pot
messages.pot:
$(XDRASLTEXT) --out messages.pot view/*.tmpl $(filter-out %_test.go,$(wildcard *.go))
.PHONY: swag
swag:
$(SWAG) init --generalInfo api.go --output ./assets/ --outputTypes json
.PHONY: prebuild
prebuild: node_modules swag
node esbuild.config.js
.PHONY: build
build: prebuild
GOFLAGS='-buildmode=pie' \
CGO_CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3" \
CGO_LDFLAGS="-Wl,-z,relro,-z,now" \
go build
.PHONY: install
install: build
install -Dm 755 drasl "$(prefix)/bin/drasl"
install -Dm 644 LICENSE "$(prefix)/share/licenses/drasl/LICENSE"
mkdir -p "$(prefix)/share/drasl/"
cp -R assets view public locales "$(prefix)/share/drasl/"
.PHONY: clean
clean:
rm -f drasl
rm -f swagger.json
rm -f public/bundle.js
.PHONY: test
test: prebuild
go test