From bc2ec9042fc598fdc8966da27bdf8897b5ca3ea4 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Sun, 9 Oct 2022 21:36:07 +0200 Subject: [PATCH] Experimental: cciu-small target --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 29f8560..b28da5c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ GIT_HASH=$(shell git rev-parse HEAD) TARGETS=linux.amd64 linux.arm64 linux.mips64 windows.amd64.exe darwin.amd64 darwin.arm64 CONTAINER_IMAGE=quay.io/mgumz/cciu:$(VERSION) -LDFLAGS=-ldflags "-X main.versionString=$(VERSION) -X main.buildDate=$(BUILD_DATE) -X main.gitHash=$(GIT_HASH)" +LDFLAGS=$(EXTRA_LDFLAGS) -X main.versionString=$(VERSION) -X main.buildDate=$(BUILD_DATE) -X main.gitHash=$(GIT_HASH) BINARIES=$(foreach r,$(TARGETS),bin/cciu-$(VERSION).$(r)) RELEASES=$(subst windows.amd64.tar.gz,windows.amd64.zip,$(foreach r,$(subst .exe,,$(TARGETS)),releases/cciu-$(VERSION).$(r).tar.gz)) @@ -24,13 +24,14 @@ clean: rm -f $(BINARIES) $(RELEASES) cciu: bin/cciu +cciu-small: + make EXTRA_LDFLAGS="-s -w" bin/cciu bin/cciu: - go build $(LDFLAGS) -o $@ ./cmd/cciu - + go build -ldflags "$(LDFLAGS)" -o $@ ./cmd/cciu bin/cciu-$(VERSION).%: env GOARCH=$(subst .,,$(suffix $(subst .exe,,$@))) GOOS=$(subst .,,$(suffix $(basename $(subst .exe,,$@)))) CGO_ENABLED=0 \ - go build $(LDFLAGS) -o $@ ./cmd/cciu + go build -ldflags "$(LDFLAGS)" -o $@ ./cmd/cciu releases/cciu-$(VERSION).%.zip: bin/cciu-$(VERSION).%.exe mkdir -p releases