@@ -10,8 +10,6 @@ GO_DEPS := $(GO_SOURCES) go.mod go.sum
1010MIGRATE_DIR := sql/migrations
1111DB_URL := sqlite3://dev.db
1212
13- DOCS_DEPS := $(wildcard internal/api/handlers/* .go)
14- DOCS_TARGET := internal/api/docs/docs.go
1513SQLC_DEPS := $(wildcard sql/migrations/* .sql) $(wildcard sql/queries/* .sql)
1614SQLC_TARGET := internal/api/dbmodels/models.go
1715
@@ -25,7 +23,7 @@ build: api cli ## Build the api and cli binaries
2523
2624api : $(BIN_DIR ) /$(API_NAME ) # # Build the api binary
2725
28- $(BIN_DIR ) /$(API_NAME ) : $(GO_DEPS ) $( SQLC_TARGET )
26+ $(BIN_DIR ) /$(API_NAME ) : $(GO_DEPS ) sqlc
2927 @mkdir -p $(BIN_DIR )
3028 go build -ldflags " -X main.Version=$( VERSION) " -o $(BIN_DIR ) /$(API_NAME ) ./cmd/$(API_NAME )
3129
@@ -35,19 +33,21 @@ $(BIN_DIR)/$(CLI_NAME): $(GO_DEPS)
3533 @mkdir -p $(BIN_DIR )
3634 go build -ldflags " -X cli.Version=$( VERSION) " -o $(BIN_DIR ) /$(CLI_NAME ) ./cmd/$(CLI_NAME )
3735
38- generate : $( DOCS_TARGET ) $( SQLC_TARGET ) # # Generate all necessary files with
36+ generate : swag sqlc # # Generate all necessary files
3937
40- $( DOCS_TARGET ) : $( DOCS_DEPS )
38+ swag : # # Generate OpenAPI docs
4139 swag init -d cmd/acmcsuf-api,internal/api/handlers,internal/api/dbmodels -o internal/api/docs --parseDependency
4240
41+ sqlc : $(SQLC_TARGET ) # # Generate dbmodels package with sqlc
42+
4343$(SQLC_TARGET ) : $(SQLC_DEPS )
4444 sqlc generate
4545
4646fmt : # # Format all go files
4747 @go fmt ./...
4848
4949check : # # Run static analysis on all go files
50- staticcheck -f stylish ./...
50+ staticcheck -f stylish ./...
5151
5252test : check # # Run all tests
5353 go test ./...
0 commit comments