-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
57 lines (43 loc) · 1.31 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
56
57
# kernel-style V=1 build verbosity
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
endif
ifeq ($(BUILD_VERBOSE),1)
Q =
else
Q = @
endif
VERSION=$(shell git describe --dirty)
REPO=github.com/flatcar/container-linux-config-transpiler
LD_FLAGS="-w -X $(REPO)/internal/version.Raw=$(VERSION)"
GO_SOURCES=$(shell find . -name "*.go")
export CGO_ENABLED:=0
.PHONY: all
all: bin/ct
.PHONY: test
test:
$(Q)./test
.PHONY: vendor
vendor:
$(Q)go mod vendor
.PHONY: clean
clean:
$(Q)rm -rf bin
.PHONY: release_aarch64
release_aarch64 := \
bin/ct-$(VERSION)-aarch64-unknown-linux-gnu \
bin/ct-$(VERSION)-aarch64-apple-darwin
.PHONY: release_x86_64
release_x86_64 := \
bin/ct-$(VERSION)-x86_64-unknown-linux-gnu \
bin/ct-$(VERSION)-x86_64-apple-darwin \
bin/ct-$(VERSION)-x86_64-pc-windows-gnu.exe
.PHONY: release
release: $(release_aarch64) $(release_x86_64)
bin/ct-%-aarch64-unknown-linux-gnu: GOARGS = GOOS=linux GOARCH=arm64
bin/ct-%-aarch64-apple-darwin: GOARGS = GOOS=darwin GOARCH=arm64
bin/ct-%-x86_64-unknown-linux-gnu: GOARGS = GOOS=linux GOARCH=amd64
bin/ct-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64
bin/ct-%-x86_64-pc-windows-gnu.exe: GOARGS = GOOS=windows GOARCH=amd64
bin/%: $(GO_SOURCES)
$(Q)$(GOARGS) go build -mod vendor -o $@ -ldflags $(LD_FLAGS) $(REPO)/internal