-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (28 loc) · 800 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
PREFIX ?= /usr/local
APPNAME ?= ttracker
SUPPORTED_ARCHS := amd64 arm64
SUPPORTED_OS := linux darwin windows
test:
echo "Running tests for $(APPNAME)"
go test -race -vet=off ./tests
build:
echo "Building $(APPNAME) binary"
go build -o bin/$(APPNAME) *.go
install: build
echo "Installing to $(PREFIX)"
cp ./bin/$(APPNAME) $(PREFIX)/bin/$(APPNAME)
uninstall:
echo "Removing $(APPNAME)"
rm -vf $(PREFIX)/bin/$(APPNAME)
release:
$(foreach arch,$(SUPPORTED_ARCHS),\
$(foreach os,$(SUPPORTED_OS),\
echo "Compiling: $(os) ($(arch))";\
if [ "$(os)" = "windows" ]; then \
GOOS=$(os) GOARCH=$(arch) go build -o bin/$(APPNAME)_$(os)_$(arch).exe;\
fi; \
if [ "$(os)" != "windows" ]; then \
GOOS=$(os) GOARCH=$(arch) go build -o bin/$(APPNAME)_$(os)_$(arch);\
fi; \
)\
)