Skip to content

Commit

Permalink
fix: makfile
Browse files Browse the repository at this point in the history
  • Loading branch information
若尘(樱の泪) committed Jan 14, 2019
1 parent a80ecce commit e32f100
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: false
go:
- 1.10.x
install: go get -u -t -v ./...
before_deploy: make -j releases
before_deploy: make
deploy:
provider: releases
prerelease: true
Expand Down
35 changes: 16 additions & 19 deletions Makefile
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)/*

0 comments on commit e32f100

Please sign in to comment.