feat: add Makefile
This commit is contained in:
parent
1cc7ce06ff
commit
db9eb9e93b
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
go.work.sum
|
||||||
|
|
||||||
# ---> Vue
|
# ---> Vue
|
||||||
# gitignore template for Vue.js projects
|
# gitignore template for Vue.js projects
|
||||||
|
35
Makefile
Normal file
35
Makefile
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
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.
|
||||||
|
@addlicense -v -f $(ROOT_DIR)/LICENSE $(ROOT_DIR) -ignore third_party/** -ignore vendor/** -ignore $(OUTPUT_DIR)
|
||||||
|
|
||||||
|
.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)
|
Loading…
Reference in New Issue
Block a user