2024-09-30 21:53:53 +00:00
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
COMMON_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
|
|
ROOT_DIR := $(abspath $(shell cd $(COMMON_SELF_DIR)/ && pwd -P))
|
|
|
|
OUTPUT_DIR := $(ROOT_DIR)/_output
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
.PHONY: all
|
|
|
|
all: add-copyright format build
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: tidy # build.
|
|
|
|
@go build -v -o $(OUTPUT_DIR)/howmuch $(ROOT_DIR)/cmd/howmuch/main.go
|
|
|
|
|
|
|
|
.PHONY: format
|
|
|
|
format: # format code.
|
|
|
|
@gofmt -s -w ./
|
|
|
|
|
|
|
|
.PHONY: add-copyright
|
|
|
|
add-copyright: # add license to file headers.
|
2024-10-01 11:35:49 +00:00
|
|
|
@addlicense -v -f $(ROOT_DIR)/LICENSE -ignore third_party/** -ignore vendor/** -ignore $(OUTPUT_DIR) $(ROOT_DIR)
|
2024-09-30 21:53:53 +00:00
|
|
|
.PHONY: swagger
|
|
|
|
swagger: # Run swagger.
|
|
|
|
@swagger serve -F=swagger --no-open --port 65534 $(ROOT_DIR)/api/openapi/openapi.yaml
|
|
|
|
|
|
|
|
.PHONY: tidy
|
|
|
|
tidy: # Handle packkages.
|
|
|
|
@go mod tidy
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean: # Clean up.
|
|
|
|
@-rm -vrf $(OUTPUT_DIR)
|