1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Add build for macOS

This commit is contained in:
Andreas Huber 2023-10-06 12:53:25 +02:00
parent 666913e61e
commit d69101924b
2 changed files with 15 additions and 9 deletions

View file

@ -12,15 +12,15 @@ SHELL = /bin/bash
BUILD = go build
MKDIR = mkdir -p
.PHONY: build build_linux build_win tag_checked_out mostlyclean
.PHONY: build build_linux build_win build_mac_amd64 build_mac_arm64 tag_checked_out mostlyclean
all:
@echo choose a target from: build build_linux build_win mostlyclean
@echo choose a target from: build build_linux build_win build_mac_amd64 build_mac_arm64 mostlyclean
@echo prepend \`make BUILDTAG=1\` to checkout the highest git tag before building
@echo or set BUILDTAG to a specific tag
# Build all binaries
build: build_linux build_win
build: build_linux build_win build_mac_amd64 build_mac_arm64
# if BUILDTAG == 1 set it to the highest git tag
ifeq ($(strip $(BUILDTAG)),1)
@ -29,7 +29,7 @@ endif
ifdef BUILDTAG
# add the git tag checkout to the requirements of our build targets
build_linux build_win: tag_checked_out
build_linux build_win build_mac_amd64 build_mac_arm64: tag_checked_out
endif
tag_checked_out:
@ -67,15 +67,19 @@ LDFLAGS = -ldflags "-X github.com/csaf-poc/csaf_distribution/v3/util.SemVersion=
GOARCH = amd64
build_linux: GOOS = linux
build_win: GOOS = windows
build_mac_amd64: GOOS = darwin
build_linux build_win:
build_mac_arm64: GOARCH = arm64
build_mac_arm64: GOOS = darwin
build_linux build_win build_mac_amd64 build_mac_arm64:
$(eval BINDIR = bin-$(GOOS)-$(GOARCH)/ )
$(MKDIR) $(BINDIR)
env GOARCH=$(GOARCH) GOOS=$(GOOS) $(BUILD) -o $(BINDIR) $(LDFLAGS) -v ./cmd/...
DISTDIR := csaf_distribution-$(SEMVER)
dist: build_linux build_win
dist: build_linux build_win build_mac_amd64 build_mac_arm64
mkdir -p dist
mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64
cp README.md dist/$(DISTDIR)-windows-amd64