-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
32 lines (23 loc) · 890 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
export GO111MODULE=on
all: release
REVISION := $(shell git rev-parse --short HEAD 2>/dev/null)
REVISIONDATE := $(shell git log -1 --pretty=format:'%ad' --date short 2>/dev/null)
PKG := mlsql.tech/allwefantasy/mlsql-lang-cli/pkg/version
LDFLAGS = -s -w
ifneq ($(strip $(REVISION)),) # Use git clone
LDFLAGS += -X $(PKG).revision=$(REVISION) \
-X $(PKG).revisionDate=$(REVISIONDATE)
endif
SHELL = /bin/sh
ifdef STATIC
LDFLAGS += -linkmode external -extldflags '-static'
CC = /usr/bin/musl-gcc
export CC
endif
release: linux mac windows
linux: Makefile cmd/*.go pkg/*/*.go
env GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o byzer-lang-linux-amd64 ./cmd
mac:
env GOOS=darwin GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o byzer-lang-darwin-amd64 ./cmd
windows:
env GOOS=windows GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o byzer-lang-win-amd64.exe ./cmd