-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (22 loc) · 792 Bytes
/
Makefile
File metadata and controls
29 lines (22 loc) · 792 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
APP_NAME=goapp
VERSION=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0")
COMMIT=$(shell git rev-parse --short HEAD || echo "HEAD")
MODULE=$(shell grep ^module go.mod | awk '{print $$2;}')
LD_FLAGS="-w -X $(MODULE)/goapp.Version=$(VERSION) -X $(MODULE)/goapp.Commit=$(COMMIT)"
MAIN="goapp/service/main/main.go"
run: binary
@DEV=1 ./temp/$(APP_NAME)
binary: wasm
@mkdir -p temp
@echo "ldflags=$(LD_FLAGS)"
@go build -o temp/$(APP_NAME) -ldflags $(LD_FLAGS) $(MAIN)
wasm:
@rm -f goapp/web/app.wasm
@GOARCH=wasm GOOS=js go build -o goapp/web/app.wasm -ldflags $(LD_FLAGS) $(MAIN)
clean:
@rm -rf temp
@rm -f goapp/web/app.wasm
# used only to build the create binary in github.com/mlctrez/goappcreate
create:
@rm -f goapp/web/app.wasm
@go build -o temp/create .