-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
40 lines (27 loc) · 700 Bytes
/
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
PKG_NAME := env-aws-params
PLATFORMS := linux-amd64 linux-arm64 darwin-amd64
VERSION ?= 0.0.0
TARGETS = $(addprefix target/$(PKG_NAME)_,$(PLATFORMS))
GO := go
RM ?= rm
# some macros to parse that platforms
os = $(word 1,$(subst -, , $@))
arch = $(word 2,$(subst -, , $@))
platform = $(word 2,$(subst _, , $@))
all: build
clean:
@ $(GO) clean
@ $(RM) -fr target/
deps:
$(GO) mod download
$(GO) mod verify
$(PLATFORMS): deps
GOOS=$(os) GOARCH=$(arch) $(GO) build -ldflags "-w -s -X main.VersionString=$(VERSION)" -o target/$(PKG_NAME)_$@
$(TARGETS): go.mod
make $(platform)
test: deps
$(GO) test
fmt:
$(GO) fmt
build: fmt deps test $(TARGETS)
.PHONY: all clean deps test fmt build