mirror of
https://github.com/nxtrace/nali
synced 2024-11-22 00:58:38 +00:00
45 lines
1.2 KiB
Makefile
45 lines
1.2 KiB
Makefile
NAME=nali
|
|
BINDIR=bin
|
|
VERSION=$(hell git describe --tags || echo "unknown version")
|
|
BUILDTIME=$(hell date -u)
|
|
GOBUILD=CGO_ENABLED=0 go build -ldflags '-X "github.com/zu1k/nali/constant.Version=$(VERSION)" \
|
|
-X "github.com/zu1k/nali/constant.BuildTime=$(BUILDTIME)" \
|
|
-w -s' -trimpath
|
|
|
|
PLATFORM_LIST = \
|
|
darwin-amd64 \
|
|
linux-amd64 \
|
|
freebsd-amd64
|
|
|
|
WINDOWS_ARCH_LIST = \
|
|
windows-amd64
|
|
|
|
all: linux-amd64 darwin-amd64 windows-amd64 # Most used
|
|
|
|
darwin-amd64:
|
|
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-amd64:
|
|
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
freebsd-amd64:
|
|
GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
windows-amd64:
|
|
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
|
|
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
|
|
|
|
$(gz_releases): %.gz : %
|
|
chmod +x $(BINDIR)/$(NAME)-$(basename $@)
|
|
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
|
|
|
|
$(zip_releases): %.zip : %
|
|
zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
|
|
|
|
all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
|
|
|
|
releases: $(gz_releases) $(zip_releases)
|
|
clean:
|
|
rm $(BINDIR)/*
|