-
-
Notifications
You must be signed in to change notification settings - Fork 217
/
Makefile
34 lines (31 loc) · 1.48 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
CURRET_DIR=$(shell pwd)
BINARY=./build/sgn
BUILD=CGO_ENABLED=1 go build
OUT_DIR=${CURRET_DIR}/build
BUILD_FLAGS=-trimpath -buildvcs=false -ldflags="-s -w -X github.com/EgeBalci/sgn/config.Version=$$(git log --pretty=format:'v2.0.1.%at-%h' -n 1)"
STATIC_BUILD_FLAGS=-trimpath -buildvcs=false -ldflags="-extldflags=-static -s -w -X github.com/EgeBalci/sgn/config.Version=$$(git log --pretty=format:'v2.0.1.%at-%h' -n 1)"
# Builds the project
default:
${BUILD} ${BUILD_FLAGS} -o ${OUT_DIR}/
# Builds the project with full static linking
static:
${BUILD} ${STATIC_BUILD_FLAGS} -o ${OUT_DIR}/
# Installs our project: copies binaries
install:
go install ${BUILD_FLAGS} github.com/EgeBalci/sgn@latest
386:
GOARCH=386 ${BUILD} ${BUILD_FLAGS} -o ${OUT_DIR}/
linux_amd64:
GOOS=linux GOARCH=amd64 ${BUILD} ${BUILD_FLAGS} -o ${OUT_DIR}/
linux_386:
GOOS=linux GOARCH=386 ${BUILD} ${BUILD_FLAGS} -o ${OUT_DIR}/
windows_amd64:
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CGO_LDFLAGS="-lkeystone -L${CURRET_DIR}/build/lib/dll/" CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc go build -ldflags="-s -w" -trimpath -o ${OUT_DIR}/sgn.exe
windows_386:
GOOS=windows GOARCH=386 CGO_ENABLED=1 CGO_LDFLAGS="-lkeystone -L${CURRET_DIR}/build/lib32/dll/" CXX=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc go build -ldflags="-s -w" -trimpath -o ${OUT_DIR}/sgn32.exe
darwin_amd64:
GOOS=darwin GOARCH=amd64 ${BUILD} ${BUILD_FLAGS} -o ${OUT_DIR}/
# Cleans our project: deletes binaries
clean:
rm -rf ./build
.PHONY: clean install