Skip to content
This repository was archived by the owner on Apr 3, 2021. It is now read-only.

Commit 0ced89a

Browse files
author
ghost
committed
Static build for linux only
1 parent 7ba5098 commit 0ced89a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,32 @@ GOBUILD=$(GOCMD) build
44
GOCLEAN=$(GOCMD) clean
55
VERSION=$(shell git describe --tags)
66
DEBUG_LDFLAGS=''
7-
RELEASE_LDFLAGS='-s -w -X main.version=$(VERSION) -extldflags "-static"'
7+
RELEASE_LDFLAGS='-s -w -X main.version=$(VERSION)'
8+
STATIC_RELEASE_LDFLAGS='-s -w -X main.version=$(VERSION) -extldflags "-static"'
89
BUILD_TAGS?=socks
910
BUILDDIR=$(shell pwd)/build
1011
CMDDIR=$(shell pwd)/cmd/tun2socks
1112
PROGRAM=tun2socks
1213

1314
BUILD_CMD="cd $(CMDDIR) && $(GOBUILD) -ldflags $(RELEASE_LDFLAGS) -o $(BUILDDIR)/$(PROGRAM) -v -tags '$(BUILD_TAGS)'"
14-
XBUILD_CMD="cd $(BUILDDIR) && $(XGOCMD) -ldflags $(RELEASE_LDFLAGS) -tags '$(BUILD_TAGS)' --targets=*/* $(CMDDIR)"
15+
XBUILD_LINUX_CMD="cd $(BUILDDIR) && $(XGOCMD) -ldflags $(STATIC_RELEASE_LDFLAGS) -tags '$(BUILD_TAGS)' --targets=linux/* $(CMDDIR)"
16+
XBUILD_OTHERS_CMD="cd $(BUILDDIR) && $(XGOCMD) -ldflags $(RELEASE_LDFLAGS) -tags '$(BUILD_TAGS)' --targets=darwin/*,windows/*,android/*,ios/* $(CMDDIR)"
1517

1618
all: build
1719

1820
build:
1921
mkdir -p $(BUILDDIR)
2022
eval $(BUILD_CMD)
2123

22-
xbuild:
24+
xbuild_linux:
2325
mkdir -p $(BUILDDIR)
24-
eval $(XBUILD_CMD)
26+
eval $(XBUILD_LINUX_CMD)
27+
28+
xbuild_others:
29+
mkdir -p $(BUILDDIR)
30+
eval $(XBUILD_OTHERS_CMD)
31+
32+
xbuild: xbuild_linux xbuild_others
2533

2634
travisbuild: xbuild
2735

0 commit comments

Comments
 (0)