-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathMakefile
47 lines (35 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
BINARY_NAME=process-compose
RM=rm
VERSION = $(shell git describe --abbrev=0)
ifeq ($(OS),Windows_NT)
EXT=.exe
RM = cmd /C del /Q /F
endif
.PHONY: test run testrace
buildrun: build run
swag:
~/go/bin/swag init --dir src --output src/docs --parseDependency --parseInternal --parseDepth 1
build:
go build -o bin/${BINARY_NAME}${EXT} -ldflags="-X main.version=${VERSION}" ./src
compile:
# Linux
GOOS=linux GOARCH=386 go build -o bin/${BINARY_NAME}-linux-386 -ldflags="-X main.version=${VERSION}" ./src
GOOS=linux GOARCH=amd64 go build -o bin/${BINARY_NAME}-linux-amd64 -ldflags="-X main.version=${VERSION}" ./src
GOOS=linux GOARCH=arm64 go build -o bin/${BINARY_NAME}-linux-arm64 -ldflags="-X main.version=${VERSION}" ./src
GOOS=linux GOARCH=arm go build -o bin/${BINARY_NAME}-linux-arm -ldflags="-X main.version=${VERSION}" ./src
# Windows
GOOS=windows GOARCH=amd64 go build -o bin/${BINARY_NAME}-windows-amd64.exe -ldflags="-X main.version=${VERSION}" ./src
# Darwin
GOOS=darwin GOARCH=amd64 go build -o bin/${BINARY_NAME}-darwin-amd64 -ldflags="-X main.version=${VERSION}" ./src
GOOS=darwin GOARCH=arm64 go build -o bin/${BINARY_NAME}-darwin-arm64 -ldflags="-X main.version=${VERSION}" ./src
test:
go test -cover ./src/...
testrace:
go test -race ./src/...
coverhtml:
go test -coverprofile=coverage.out ./src
go tool cover -html=coverage.out
run:
PC_DEBUG_MODE=1 ./bin/${BINARY_NAME}${EXT}
clean:
$(RM) bin/${BINARY_NAME}*