-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
若尘(樱の泪)
committed
Jan 14, 2019
1 parent
a80ecce
commit e32f100
Showing
2 changed files
with
17 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
NAME=vnet | ||
BINDIR=bin | ||
GOBUILD=CGO_ENABLED=0 go build -ldflags '-w -s' ./cmd/server | ||
export PATH := $(GOPATH)/bin:$(PATH) | ||
LDFLAGS := -s -w | ||
# The -w and -s flags reduce binary sizes by excluding unnecessary symbols and debug info | ||
|
||
all: linux macos win64 | ||
|
||
linux: | ||
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ | ||
|
||
macos: | ||
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ | ||
|
||
win64: | ||
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe | ||
|
||
releases: linux macos win64 | ||
chmod +x $(BINDIR)/$(NAME)-* | ||
gzip $(BINDIR)/$(NAME)-linux | ||
gzip $(BINDIR)/$(NAME)-macos | ||
zip -m -j $(BINDIR)/$(NAME)-win64.zip $(BINDIR)/$(NAME)-win64.exe | ||
all: | ||
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/vnet_darwin_amd64 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "$(LDFLAGS)" -o bin/vnet_freebsd_386 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/vnet_freebsd_amd64 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_386 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_amd64 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_arm ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_arm64 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "$(LDFLAGS)" -o bin/vnet_windows_386.exe ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/vnet_windows_amd64.exe ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_mips64 ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_mips64le ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_mips ./cmd/server/server.go | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "$(LDFLAGS)" -o bin/vnet_linux_mipsle ./cmd/server/server.go | ||
|
||
clean: | ||
rm $(BINDIR)/* |