40 lines
794 B
Makefile
40 lines
794 B
Makefile
APP := filedb
|
|
CMD := ./cmd/filedb
|
|
BUILD_DIR := bin
|
|
BIN := $(BUILD_DIR)/$(APP)
|
|
|
|
.PHONY: help build run install fmt tidy test clean
|
|
|
|
help:
|
|
@echo "Targets:"
|
|
@echo " make build Build binary to $(BIN)"
|
|
@echo " make run ARGS='...' Run CLI with optional ARGS"
|
|
@echo " make install Install CLI to GOPATH/bin"
|
|
@echo " make fmt Format Go code"
|
|
@echo " make tidy Tidy go modules"
|
|
@echo " make test Run tests"
|
|
@echo " make clean Remove build artifacts"
|
|
|
|
build:
|
|
@mkdir -p $(BUILD_DIR)
|
|
go build -o $(BIN) $(CMD)
|
|
|
|
run:
|
|
go run $(CMD) $(ARGS)
|
|
|
|
install:
|
|
go install $(CMD)
|
|
|
|
fmt:
|
|
gofmt -w $$(find . -type f -name '*.go' -not -path './vendor/*')
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|