forked from crc-org/vfkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (29 loc) · 1.17 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
.PHONY: all build clean test
GIT_VERSION ?= $(shell git describe --always --dirty)
CGO_CFLAGS=-mmacosx-version-min=11.0
VERSION_LDFLAGS=-X github.com/crc-org/vfkit/pkg/cmdline.gitVersion=$(GIT_VERSION)
all: build
TOOLS_DIR := tools
include tools/tools.mk
build: out/vfkit
test: build
@go test -v ./pkg/...
@go test -v -timeout 20m ./test
clean:
rm -rf out
out/vfkit-amd64 out/vfkit-arm64: out/vfkit-%: force-build
@mkdir -p $(@D)
CGO_ENABLED=1 CGO_CFLAGS=$(CGO_CFLAGS) GOOS=darwin GOARCH=$* go build -ldflags "$(VERSION_LDFLAGS)" -o $@ ./cmd/vfkit
codesign -f --entitlements vf.entitlements -s - $@
out/vfkit: out/vfkit-amd64 out/vfkit-arm64
cd $(@D) && lipo -create $(^F) -output $(@F)
# the go compiler is doing a good job at not rebuilding unchanged files
# this phony target ensures out/vfkit-* are always considered out of date
# and rebuilt. If the code was unchanged, go won't rebuild anything so that's
# fast. Forcing the rebuild ensure we rebuild when needed, ie when the source code
# changed, without adding explicit dependencies to the go files/go.mod
.PHONY: force-build
force-build:
.PHONY: lint
lint: $(TOOLS_BINDIR)/golangci-lint
"$(TOOLS_BINDIR)"/golangci-lint run