2024-05-06 15:10:45 +02:00
|
|
|
TARGET = ./cc-metric-store
|
2024-10-23 11:43:40 +02:00
|
|
|
VAR = ./var/checkpoints/
|
2024-10-23 06:41:19 +02:00
|
|
|
VERSION = 0.1.0
|
2024-05-06 15:10:45 +02:00
|
|
|
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
|
|
|
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
|
|
|
|
LD_FLAGS = '-s -X main.date=${CURRENT_TIME} -X main.version=${VERSION} -X main.commit=${GIT_HASH}'
|
2022-03-07 12:22:22 +01:00
|
|
|
|
2024-10-23 11:43:40 +02:00
|
|
|
.PHONY: clean distclean test swagger $(TARGET)
|
2022-03-07 12:22:22 +01:00
|
|
|
|
2024-05-06 15:10:45 +02:00
|
|
|
.NOTPARALLEL:
|
2022-03-07 12:22:22 +01:00
|
|
|
|
2024-10-23 11:43:40 +02:00
|
|
|
$(TARGET): config.json $(VAR)
|
2024-06-18 07:13:56 +02:00
|
|
|
$(info ===> BUILD cc-metric-store)
|
2024-05-06 15:10:45 +02:00
|
|
|
@go build -ldflags=${LD_FLAGS} ./cmd/cc-metric-store
|
2022-03-07 12:22:22 +01:00
|
|
|
|
2024-10-23 11:43:40 +02:00
|
|
|
config.json:
|
|
|
|
@cp ./configs/config.json config.json
|
|
|
|
|
|
|
|
$(VAR):
|
|
|
|
@mkdir -p $(VAR)
|
|
|
|
|
2024-06-25 20:08:25 +02:00
|
|
|
swagger:
|
|
|
|
$(info ===> GENERATE swagger)
|
|
|
|
@go run github.com/swaggo/swag/cmd/swag init -d ./internal/api,./internal/util -g api.go -o ./api
|
|
|
|
@mv ./api/docs.go ./internal/api/docs.go
|
|
|
|
|
2022-03-07 12:22:22 +01:00
|
|
|
clean:
|
2024-05-06 15:10:45 +02:00
|
|
|
$(info ===> CLEAN)
|
|
|
|
@go clean
|
|
|
|
@rm -f $(TARGET)
|
|
|
|
|
2024-10-23 11:43:40 +02:00
|
|
|
distclean: clean
|
|
|
|
@rm -rf ./var
|
|
|
|
@rm -f config.json
|
|
|
|
|
2024-05-06 15:10:45 +02:00
|
|
|
test:
|
|
|
|
$(info ===> TESTING)
|
|
|
|
@go clean -testcache
|
|
|
|
@go build ./...
|
|
|
|
@go vet ./...
|
|
|
|
@go test ./...
|