forked from cghdev/gotunl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (36 loc) · 1.26 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
TARGET=./build
ARCHS=amd64 arm64
LDFLAGS="-s -w"
current:
@go build -ldflags=${LDFLAGS} -o ./gotunl; \
echo "Done."
windows:
@for GOARCH in ${ARCHS}; do \
echo "Building for windows $${GOARCH} ..." ; \
mkdir -p ${TARGET}/gotunl-windows-$${GOARCH} ; \
GOOS=windows GOARCH=$${GOARCH} go build -trimpath -ldflags=${LDFLAGS} -o ${TARGET}/gotunl-windows-$${GOARCH}/gotunl.exe ; \
done; \
echo "Done."
linux:
@for GOARCH in ${ARCHS}; do \
echo "Building for linux $${GOARCH} ..." ; \
mkdir -p ${TARGET}/gotunl-linux-$${GOARCH} ; \
GOOS=linux GOARCH=$${GOARCH} go build -trimpath -ldflags=${LDFLAGS} -o ${TARGET}/gotunl-linux-$${GOARCH}/gotunl ; \
done; \
echo "Done."
darwin:
@for GOARCH in ${ARCHS}; do \
echo "Building for darwin $${GOARCH} ..." ; \
mkdir -p ${TARGET}/gotunl-darwin-$${GOARCH} ; \
GOOS=darwin GOARCH=$${GOARCH} go build -trimpath -ldflags=${LDFLAGS} -o ${TARGET}/gotunl-darwin-$${GOARCH}/gotunl ; \
done; \
mkdir ${TARGET}/gotunl-darwin-universal &>/dev/null; \
lipo -create -output ${TARGET}/gotunl-darwin-universal/gotunl ${TARGET}/gotunl-darwin-amd64/gotunl ${TARGET}/gotunl-darwin-arm64/gotunl ; \
echo "Done."
all: darwin linux windows
test:
@go test -v -race ./... ; \
echo "Done."
clean:
@rm -rf ${TARGET}/* ; \
echo "Done."