2022-04-06 00:26:50 +03:00
|
|
|
BINARY_NAME=process-compose
|
2022-04-16 01:44:27 +03:00
|
|
|
RM=rm
|
2022-05-03 00:51:27 +03:00
|
|
|
VERSION = $(shell git describe --abbrev=0)
|
2022-09-27 16:07:43 +03:00
|
|
|
|
|
|
|
LD_FLAGS = "-X main.version=${VERSION} -s -w"
|
|
|
|
|
2022-04-16 01:44:27 +03:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
EXT=.exe
|
|
|
|
RM = cmd /C del /Q /F
|
|
|
|
endif
|
2022-04-06 00:26:50 +03:00
|
|
|
|
2022-05-02 01:49:19 +03:00
|
|
|
.PHONY: test run testrace
|
2022-04-06 00:26:50 +03:00
|
|
|
|
|
|
|
buildrun: build run
|
|
|
|
|
2022-04-21 00:16:10 +03:00
|
|
|
swag:
|
|
|
|
~/go/bin/swag init --dir src --output src/docs --parseDependency --parseInternal --parseDepth 1
|
|
|
|
|
2022-04-06 00:26:50 +03:00
|
|
|
build:
|
2022-05-03 00:51:27 +03:00
|
|
|
go build -o bin/${BINARY_NAME}${EXT} -ldflags="-X main.version=${VERSION}" ./src
|
2022-04-21 00:16:10 +03:00
|
|
|
|
2022-04-06 00:26:50 +03:00
|
|
|
compile:
|
2022-04-16 12:55:05 +03:00
|
|
|
# Linux
|
2022-09-27 16:07:43 +03:00
|
|
|
GOOS=linux GOARCH=386 go build -o bin/${BINARY_NAME}-linux-386 -ldflags=${LD_FLAGS} ./src
|
|
|
|
GOOS=linux GOARCH=amd64 go build -o bin/${BINARY_NAME}-linux-amd64 -ldflags=${LD_FLAGS} ./src
|
|
|
|
GOOS=linux GOARCH=arm64 go build -o bin/${BINARY_NAME}-linux-arm64 -ldflags=${LD_FLAGS} ./src
|
|
|
|
GOOS=linux GOARCH=arm go build -o bin/${BINARY_NAME}-linux-arm -ldflags=${LD_FLAGS} ./src
|
2022-04-16 01:44:27 +03:00
|
|
|
|
2022-04-16 12:55:05 +03:00
|
|
|
# Windows
|
2022-09-27 16:07:43 +03:00
|
|
|
GOOS=windows GOARCH=amd64 go build -o bin/${BINARY_NAME}-windows-amd64.exe -ldflags=${LD_FLAGS} ./src
|
2022-04-16 12:55:05 +03:00
|
|
|
|
2022-06-08 21:47:01 +03:00
|
|
|
# Darwin
|
2022-09-27 16:07:43 +03:00
|
|
|
GOOS=darwin GOARCH=amd64 go build -o bin/${BINARY_NAME}-darwin-amd64 -ldflags=${LD_FLAGS} ./src
|
|
|
|
GOOS=darwin GOARCH=arm64 go build -o bin/${BINARY_NAME}-darwin-arm64 -ldflags=${LD_FLAGS} ./src
|
2022-06-08 21:47:01 +03:00
|
|
|
|
2022-04-06 00:26:50 +03:00
|
|
|
test:
|
2022-04-21 00:16:10 +03:00
|
|
|
go test -cover ./src/...
|
2022-05-02 01:49:19 +03:00
|
|
|
|
|
|
|
testrace:
|
|
|
|
go test -race ./src/...
|
|
|
|
|
2022-04-06 00:26:50 +03:00
|
|
|
coverhtml:
|
|
|
|
go test -coverprofile=coverage.out ./src
|
|
|
|
go tool cover -html=coverage.out
|
|
|
|
|
|
|
|
run:
|
2022-05-02 01:49:19 +03:00
|
|
|
PC_DEBUG_MODE=1 ./bin/${BINARY_NAME}${EXT}
|
2022-04-06 00:26:50 +03:00
|
|
|
|
|
|
|
clean:
|
2022-04-16 12:55:05 +03:00
|
|
|
$(RM) bin/${BINARY_NAME}*
|