-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
35 lines (27 loc) · 854 Bytes
/
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
VERSION := $(shell git describe --tags --dirty)
BUILD := $(shell date +%FT%T%z)
.PHONY: config clean dir all
all: clean bluelox web
dir:
mkdir -p bin
clean:
rm -rf bin
web: wasm dir
cp -r web bin/web && \
cd bin && \
cp bluelox.wasm web/js && \
cd web && \
zip -r ../web.zip . && \
cd .. && \
rm -rf web
wasm: dir
go generate ./... && \
cd cmd/wasm && \
GOOS=js GOARCH=wasm go build -trimpath -ldflags "-s -w -X github.com/nanmu42/bluelox/version.Version=$(VERSION) -X github.com/nanmu42/bluelox/version.BuildDate=$(BUILD)" -o bluelox.wasm && \
cp bluelox.wasm $(PWD)/bin/bluelox.wasm
bluelox: bluelox.bin
%.bin: dir
go generate ./... && \
cd cmd/$* && \
go build -trimpath -ldflags "-s -w -X github.com/nanmu42/bluelox/version.Version=$(VERSION) -X github.com/nanmu42/bluelox/version.BuildDate=$(BUILD)" && \
cp $* $(PWD)/bin/$*