diff options
| author | Marin Ivanov <[email protected]> | 2020-02-04 06:09:22 +0200 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2020-02-04 06:43:19 +0200 |
| commit | d2735b7f2d000fefe5b576bc3145a734c1dacfb8 (patch) | |
| tree | d2293661abf77de0ec7e8b4634c5b93cf6a73330 | |
| parent | f992c87e2fdfdee449c8ae3f11225f12316ef385 (diff) | |
Update build process
| -rw-r--r-- | Makefile | 11 | ||||
| -rw-r--r-- | main.go | 4 | ||||
| -rw-r--r-- | setuid_unix.go | 2 | ||||
| -rw-r--r-- | setuid_windows.go | 2 |
4 files changed, 14 insertions, 5 deletions
@@ -1,11 +1,16 @@ SRC = $(wildcard *.go) +VERSION=$(shell git describe --tags) +all: linux-amd64 darwin-amd64 windows-amd64 linux-amd64: build/tarpit-linux-amd64 - +darwin-amd64: build/tarpit-darwin-amd64 windows-amd64: build/tarpit-windows-amd64.exe build/tarpit-linux-amd64: $(SRC) - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o "$@" -ldflags '-extldflags "-static"' + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o "$@" -ldflags '-extldflags "-static" -X main.version=${VERSION}' + +build/tarpit-darwin-amd64: $(SRC) + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o "$@" -ldflags '-extldflags "-static" -X main.version=${VERSION}' build/tarpit-windows-amd64.exe: $(SRC) - GOOS=windows GOARCH=amd64 go build -o "$@" + GOOS=windows GOARCH=amd64 go build -o "$@" -ldflags '-extldflags "-static" -X main.version=${VERSION}' @@ -10,7 +10,7 @@ import ( flag "github.com/spf13/pflag" ) -var version = "0.1.0" +var version string const ( configErrorCode = 1 @@ -36,7 +36,7 @@ func main() { flag.Parse() if versionFlag { - fmt.Println("Tarpit version", version) + fmt.Println("tarpit version", version) return } diff --git a/setuid_unix.go b/setuid_unix.go index be2db7b..8782a48 100644 --- a/setuid_unix.go +++ b/setuid_unix.go @@ -1,3 +1,5 @@ +// +build linux darwin + package main import ( diff --git a/setuid_windows.go b/setuid_windows.go index 63ccc73..277ed12 100644 --- a/setuid_windows.go +++ b/setuid_windows.go @@ -1,3 +1,5 @@ +// +build windows + package main import ( |
