-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
40 lines (31 loc) · 1.07 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
COUNT := $(shell git rev-list --count HEAD)
SHORT := $(shell git rev-parse --short HEAD)
VERSION := $(shell printf "r%s.%s\n" ${COUNT} ${SHORT})
DATE := $(shell date "+%a%d%b_%I.%M.%S")
REPO := aditya-K2/gomp
GC := go
VERBOSE =
GOFLAGS := -buildmode=pie -trimpath -mod=readonly -modcacherw
LDFLAGS := -ldflags="-X github.com/${REPO}/config.version=${VERSION} -X github.com/${REPO}/config.buildDate=${DATE}"
BUILD := ${GC} build ${GOFLAGS} ${LDFLAGS} ${VERBOSE}
.PHONY: gomp install linux-arm64 linux-amd64 darwin-amd64 darwin-arm64 windows-amd64
all: linux-amd64 linux-arm64 darwin-amd64 darwin-arm64 windows-amd64.exe
install: gomp
install bin/gomp -t "/usr/bin/"
gomp:
${BUILD} -o bin/gomp
linux-amd64:
GOOS=linux GOARCH=amd64 \
${BUILD} -o bin/gomp-linux-amd64
linux-arm64:
GOOS=linux GOARCH=arm64 \
${BUILD} -o bin/gomp-linux-arm64
darwin-amd64:
GOOS=darwin GOARCH=amd64 \
${BUILD} -o bin/gomp-darwin-amd64
darwin-arm64:
GOOS=darwin GOARCH=arm64 \
${BUILD} -o bin/gomp-darwin-arm64
windows-amd64.exe:
GOOS=windows GOARCH=amd64 \
${BUILD} -o bin/gomp-windows-amd64.exe