-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
30 lines (23 loc) · 766 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
BINDIR=bin
VERSION=$(shell git describe --tags || echo "unknownversion")
ifdef NAME
FULLNAME=$(NAME)-$@
else
FULLNAME=xraysub-$@-$(VERSION)
endif
LDFLAGS="-s -w -X github.com/Bpazy/xraysub/cmd.buildVer=${VERSION}"
GOBUILD=go build -ldflags=${LDFLAGS}
CMDPATH=.
all: linux-amd64 darwin-amd64 darwin-arm64 windows-amd64 # Most used
darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(FULLNAME) $(CMDPATH)
darwin-arm64:
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(FULLNAME) $(CMDPATH)
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(FULLNAME) $(CMDPATH)
windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(FULLNAME).exe $(CMDPATH)
install:
go install -ldflags=${LDFLAGS} $(CMDPATH)
clean:
rm $(BINDIR)/*