forked from eycorsican/go-tun2socks
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
34 lines (27 loc) · 774 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
32
33
34
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
VERSION=$(shell git describe --tags)
DEBUG_LDFLAGS=''
RELEASE_LDFLAGS='-s -w -X main.version=$(VERSION)'
BUILD_TAGS?=socks
BUILDDIR=./build
CMDDIR=./cmd/tun2socks
PROGRAM=tun2socks
GOOS:=$(strip $(shell go env GOOS))
GOARCHs:=$(strip $(shell go env GOARCH))
ifeq "$(GOOS)" "windows"
SUFFIX=.exe
endif
.PHONY: build
all: fmt build
build:
$(foreach GOARCH,$(GOARCHs),$(shell GOARCH=$(GOARCH) $(GOBUILD) -ldflags $(RELEASE_LDFLAGS) -trimpath -o $(BUILDDIR)/$(PROGRAM)_$(GOOS)_$(GOARCH)$(SUFFIX) -v -tags '$(BUILD_TAGS)' $(CMDDIR)))
fmt:
gofmt -w -s cmd core common proxy
clean:
rm -rf $(BUILDDIR)
cleancache:
# go build cache may need to cleanup if changing C source code
$(GOCLEAN) -cache
rm -rf $(BUILDDIR)