mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Add build for macOS
This commit is contained in:
parent
666913e61e
commit
d69101924b
2 changed files with 15 additions and 9 deletions
16
Makefile
16
Makefile
|
|
@ -12,15 +12,15 @@ SHELL = /bin/bash
|
||||||
BUILD = go build
|
BUILD = go build
|
||||||
MKDIR = mkdir -p
|
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:
|
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 prepend \`make BUILDTAG=1\` to checkout the highest git tag before building
|
||||||
@echo or set BUILDTAG to a specific tag
|
@echo or set BUILDTAG to a specific tag
|
||||||
|
|
||||||
# Build all binaries
|
# 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
|
# if BUILDTAG == 1 set it to the highest git tag
|
||||||
ifeq ($(strip $(BUILDTAG)),1)
|
ifeq ($(strip $(BUILDTAG)),1)
|
||||||
|
|
@ -29,7 +29,7 @@ endif
|
||||||
|
|
||||||
ifdef BUILDTAG
|
ifdef BUILDTAG
|
||||||
# add the git tag checkout to the requirements of our build targets
|
# 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
|
endif
|
||||||
|
|
||||||
tag_checked_out:
|
tag_checked_out:
|
||||||
|
|
@ -67,15 +67,19 @@ LDFLAGS = -ldflags "-X github.com/csaf-poc/csaf_distribution/v3/util.SemVersion=
|
||||||
GOARCH = amd64
|
GOARCH = amd64
|
||||||
build_linux: GOOS = linux
|
build_linux: GOOS = linux
|
||||||
build_win: GOOS = windows
|
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)/ )
|
$(eval BINDIR = bin-$(GOOS)-$(GOARCH)/ )
|
||||||
$(MKDIR) $(BINDIR)
|
$(MKDIR) $(BINDIR)
|
||||||
env GOARCH=$(GOARCH) GOOS=$(GOOS) $(BUILD) -o $(BINDIR) $(LDFLAGS) -v ./cmd/...
|
env GOARCH=$(GOARCH) GOOS=$(GOOS) $(BUILD) -o $(BINDIR) $(LDFLAGS) -v ./cmd/...
|
||||||
|
|
||||||
|
|
||||||
DISTDIR := csaf_distribution-$(SEMVER)
|
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
|
||||||
mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64
|
mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64
|
||||||
cp README.md dist/$(DISTDIR)-windows-amd64
|
cp README.md dist/$(DISTDIR)-windows-amd64
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,11 @@ Download the binaries from the most recent release assets on Github.
|
||||||
|
|
||||||
- Build Go components Makefile supplies the following targets:
|
- Build Go components Makefile supplies the following targets:
|
||||||
- Build For GNU/Linux System: `make build_linux`
|
- Build For GNU/Linux System: `make build_linux`
|
||||||
- Build For Windows System (cross build): `make build_win`
|
- Build For Windows System (cross build): `make build_win`
|
||||||
- Build For both linux and windows: `make build`
|
- Build For macOS on Intel Processor (AMD64) (cross build): `make build_mac_amd64`
|
||||||
- Build from a specific github tag by passing the intended tag to the `BUILDTAG` variable.
|
- Build For macOS on Apple Silicon (ARM64) (cross build): `make build_mac_arm64`
|
||||||
|
- Build For Linux, Mac and Windows: `make build`
|
||||||
|
- Build from a specific GitHub tag by passing the intended tag to the `BUILDTAG` variable.
|
||||||
E.g. `make BUILDTAG=v1.0.0 build` or `make BUILDTAG=1 build_linux`.
|
E.g. `make BUILDTAG=v1.0.0 build` or `make BUILDTAG=1 build_linux`.
|
||||||
The special value `1` means checking out the highest github tag for the build.
|
The special value `1` means checking out the highest github tag for the build.
|
||||||
- Remove the generated binaries und their directories: `make mostlyclean`
|
- Remove the generated binaries und their directories: `make mostlyclean`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue