added repo bootstrap tool
This commit is contained in:
@@ -8,6 +8,7 @@ GOFLAGS := -trimpath -ldflags="-s -w"
|
||||
TARGETS := \
|
||||
linux/amd64 \
|
||||
linux/arm64 \
|
||||
linux/arm/6 \
|
||||
darwin/amd64 \
|
||||
darwin/arm64
|
||||
|
||||
@@ -18,13 +19,22 @@ all: build
|
||||
build:
|
||||
go build $(GOFLAGS) -o $(BINARY) $(PKG)
|
||||
|
||||
# Cross-compile native binaries for each supported (OS, arch) pair into dist/.
|
||||
# Cross-compile native binaries for each supported (OS, arch[, GOARM]) triple
|
||||
# into dist/. Targets formatted as "os/arch" produce "$(BINARY)-os-arch";
|
||||
# "os/arm/N" produces "$(BINARY)-os-armvN" with GOARM=N.
|
||||
build-all: $(DIST)
|
||||
@for t in $(TARGETS); do \
|
||||
os=$${t%/*}; arch=$${t#*/}; \
|
||||
out=$(DIST)/$(BINARY)-$$os-$$arch; \
|
||||
echo "==> $$os/$$arch -> $$out"; \
|
||||
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch \
|
||||
os=$$(echo $$t | cut -d/ -f1); \
|
||||
arch=$$(echo $$t | cut -d/ -f2); \
|
||||
goarm=$$(echo $$t | cut -s -d/ -f3); \
|
||||
if [ -n "$$goarm" ]; then \
|
||||
suffix=$$arch"v"$$goarm; \
|
||||
else \
|
||||
suffix=$$arch; \
|
||||
fi; \
|
||||
out=$(DIST)/$(BINARY)-$$os-$$suffix; \
|
||||
echo "==> $$os/$$arch$${goarm:+ GOARM=$$goarm} -> $$out"; \
|
||||
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch GOARM=$$goarm \
|
||||
go build $(GOFLAGS) -o $$out $(PKG) || exit 1; \
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user