-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
55 lines (40 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.PHONY: all build build-amd64 build-arm64 force-build clean help
CGO_CFLAGS=-mmacosx-version-min=12.3
CODESIGN_IDENTITY ?= -
all: help
##@
##@ Build commands
##@
build: ##@ Build binaries for all architectures
@$(MAKE) out/ovm-amd64
@$(MAKE) out/ovm-arm64
build-amd64: ##@ Build amd64 binary
@$(MAKE) out/ovm-amd64
build-arm64: ##@ Build arm64 binary
@$(MAKE) out/ovm-arm64
out/ovm-arm64 out/ovm-amd64: out/ovm-%: force-build
@mkdir -p $(@D)
CGO_ENABLED=1 CGO_CFLAGS=$(CGO_CFLAGS) GOOS=darwin GOARCH=$* go build -o $@ ./cmd/ovm
codesign --force --options runtime --entitlements ovm.entitlements --sign $(CODESIGN_IDENTITY) $@
force-build:
##@
##@ Clean commands
##@
clean: ##@ Clean up build artifacts
$(RM) -rf out
##@
##@ Misc commands
##@
help: ##@ (Default) Print listing of key targets with their descriptions
@printf "\nUsage: make <command>\n"
@grep -F -h "##@" $(MAKEFILE_LIST) | grep -F -v grep -F | sed -e 's/\\$$//' | awk 'BEGIN {FS = ":*[[:space:]]*##@[[:space:]]*"}; \
{ \
if($$2 == "") \
printf ""; \
else if($$0 ~ /^#/) \
printf "\n%s\n", $$2; \
else if($$1 == "") \
printf " %-20s%s\n", "", $$2; \
else \
printf "\n \033[34m%-20s\033[0m %s\n", $$1, $$2; \
}'