-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (24 loc) · 684 Bytes
/
Makefile
File metadata and controls
30 lines (24 loc) · 684 Bytes
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
BINARY := phpfpmtop
TARGETS := \
$(BINARY)_linux_amd64 \
$(BINARY)_darwin_amd64 \
os = $(word 2, $(subst _, ,$@))
arch = $(word 3, $(subst _, ,$@))
# A bare 'make' should simply build the binary as expected.
$(BINARY): *.go
go build -o '$@' .
# Build for all architectures.
$(TARGETS): *.go go.mod
CGO_ENABLED=0 GOOS=$(os) GOARCH=$(arch) go build -o '$(BINARY)_$(os)_$(arch)' .
release: deps
# We call make again to make sure to always execute the rule. We
# need this because dependencies may have changed after 'deps'.
$(MAKE) --always-make \
--no-print-directory \
clean \
$(TARGETS)
deps: go.*
go mod download
go mod verify
clean:
rm -f $(BINARY) $(TARGETS)