-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (30 loc) · 782 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
#
# Makefile
#
# Simple makefile to build stuff
#
VENDOR_DIR = vendor
.PHONY: get-deps
get-deps: $(VENDOR_DIR)
$(VENDOR_DIR):
GO111MODULE=on go mod vendor
$(OUTPUT_DIR):
mkdir output
.PHONY: build
build: $(VENDOR_DIR) $(OUTPUT_DIR)
GOOS=linux CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o output/go-app .
.PHONY: local-build
local-build: $(VENDOR_DIR) $(OUTPUT_DIR)
CGO_ENABLED=1 go build -a -ldflags '-extldflags "-static"' -o output/go-app .
.PHONY: local-build-wo-cgo
local-build-wo-cgo: $(VENDOR_DIR) $(OUTPUT_DIR)
CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o output/go-app .
.PHONY: clean
clean:
rm -f output/*
.PHONY: clean-all
clean-all:
rm -rf output/* vendor
.PHONY: test
test: $(VENDOR_DIR)
go test -v -timeout 10s ./...