-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (46 loc) · 1.43 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
.ONESHELL:
SHA := $(shell git rev-parse --short=8 HEAD)
GITVERSION := $(shell git describe --long --all)
BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},$(shell git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD))
BINARY := install
LINKMODE := -extldflags=-static \
-X 'github.com/metal-stack/v.Version=$(VERSION)' \
-X 'github.com/metal-stack/v.Revision=$(GITVERSION)' \
-X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \
-X 'github.com/metal-stack/v.BuildDate=$(BUILDDATE)'
all: clean binary
.PHONY: clean
clean:
rm -f debian/context/install-go
rm -f almalinux/context/install-go
.PHONY: binary
binary: test
GGO_ENABLED=0 \
go build \
-trimpath \
-tags osusergo,netgo \
-o bin/$(BINARY) \
-ldflags "$(LINKMODE)" \
github.com/metal-stack/metal-images/cmd
strip bin/$(BINARY)
cp bin/$(BINARY) debian/context/install-go
cp bin/$(BINARY) almalinux/context/install-go
.PHONY: test
test:
GO_ENV=testing go test -race -cover ./...
.PHONY: debian
debian: binary
docker-make -nNL -w debian -f docker-make.debian.yaml
.PHONY: nvidia
nvidia:
docker-make -nNL -w debian-nvidia -f docker-make.yaml
.PHONY: ubuntu
ubuntu: binary
docker-make -nNL -w debian -f docker-make.ubuntu.yaml
.PHONY: firewall
firewall: ubuntu
docker-make -nNL -w firewall -f docker-make.yaml
.PHONY: almalinux
almalinux: binary
docker-make -nNL -w almalinux -f docker-make.yaml