2021-02-26 15:36:46 +01:00
|
|
|
CLI_BIN := ./bin/doggo-cli.bin
|
|
|
|
API_BIN := ./bin/doggo-api.bin
|
2020-12-09 18:11:09 +01:00
|
|
|
|
|
|
|
HASH := $(shell git rev-parse --short HEAD)
|
|
|
|
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
|
2020-12-13 16:33:44 +01:00
|
|
|
VERSION := ${HASH}
|
2020-12-09 18:11:09 +01:00
|
|
|
|
2021-02-26 15:36:46 +01:00
|
|
|
.PHONY: build-cli
|
|
|
|
build-cli:
|
|
|
|
go build -o ${CLI_BIN} -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" ./cmd/doggo/cli/
|
|
|
|
|
2021-03-04 16:04:54 +01:00
|
|
|
.PHONY: build-frontend
|
|
|
|
build-frontend:
|
|
|
|
cd cmd/doggo/api && NODE_ENV=production npx tailwindcss build -o ./assets/tailwind.css
|
|
|
|
|
2021-02-26 15:36:46 +01:00
|
|
|
.PHONY: build-api
|
|
|
|
build-api:
|
|
|
|
go build -o ${API_BIN} -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" ./cmd/doggo/api/
|
|
|
|
|
2021-03-04 16:04:54 +01:00
|
|
|
.PHONY: deps
|
|
|
|
deps:
|
2021-03-04 16:11:37 +01:00
|
|
|
cd cmd/doggo/api && npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
|
2021-02-26 15:36:46 +01:00
|
|
|
|
2020-12-09 18:11:09 +01:00
|
|
|
.PHONY: build
|
2021-02-26 15:36:46 +01:00
|
|
|
build: build-api build-cli
|
2020-12-09 18:11:09 +01:00
|
|
|
|
2021-02-26 15:36:46 +01:00
|
|
|
.PHONY: run-cli
|
|
|
|
run-cli: build-cli ## Build and Execute the CLI binary after the build step.
|
|
|
|
${CLI_BIN}
|
|
|
|
|
|
|
|
.PHONY: run-api
|
2021-03-04 16:04:54 +01:00
|
|
|
run-api: build-frontend build-api ## Build and Execute the API binary after the build step.
|
2021-02-27 09:31:59 +01:00
|
|
|
${API_BIN} --config config-api-sample.toml
|
2020-12-09 18:11:09 +01:00
|
|
|
|
2020-12-17 12:27:44 +01:00
|
|
|
.PHONY: clean
|
2020-12-09 18:11:09 +01:00
|
|
|
clean:
|
|
|
|
go clean
|
2021-02-26 15:36:46 +01:00
|
|
|
- rm -rf ./bin/
|
2020-12-09 18:11:09 +01:00
|
|
|
|
2020-12-17 12:27:44 +01:00
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
golangci-lint run
|