-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
53 lines (41 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.PHONY: clean build test run fmt tidy install-tools generate generate-api generate-db execute-binary
BINARY_NAME=./bin/scribe-server
# Clean any build artifacts.
clean:
go clean
rm ${BINARY_NAME}
# Build a binary for the project.
build:
go build -o ${BINARY_NAME} *.go
# Run tests for the project.
test:
go test ./... -v
# Run the project.
run:
go run .
# Format the project source code.
fmt:
go fmt
# Sync the 'go.mod' file with dependencies in source code.
tidy:
go mod tidy
# Install the tools for local development.
install-tools:
go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
go install ariga.io/atlas/cmd/atlas@latest
# Create or update the generated source code.
generate:
@$(MAKE) generate-api
@$(MAKE) generate-db
# Create or update the generated source code for the 'api' package.
generate-api:
go generate -x ./api/...
@$(MAKE) tidy
# Create or update the generated source code for the 'db' package.
generate-db:
go generate -x ./db/...
@$(MAKE) tidy
# Execute the binary for the project.
execute-binary:
${BINARY_NAME}