forked from sqlc-dev/sqlc
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
58 lines (40 loc) · 1.69 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
54
55
56
57
58
CGO_ENABLED = 1
COMMIT_HASH := $(shell git --no-pager describe --tags --always --dirty)
LDFLAGS = "-X github.com/sqlc-dev/sqlc/internal/info.Version=$(COMMIT_HASH)-wicked-fork"
.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh proto
build:
CGO_ENABLED=$(CGO_ENABLED) go build -ldflags=$(LDFLAGS) -o bin/ ./cmd/...
install:
CGO_ENABLED=$(CGO_ENABLED) go install -ldflags=$(LDFLAGS) ./cmd/...
test:
CGO_ENABLED=$(CGO_ENABLED) go test ./...
vet:
CGO_ENABLED=$(CGO_ENABLED) go vet ./...
test-examples:
CGO_ENABLED=$(CGO_ENABLED) go test --tags=examples ./...
build-endtoend:
cd ./internal/endtoend/testdata && CGO_ENABLED=$(CGO_ENABLED) go build ./...
test-ci: test-examples build-endtoend vet
regen: sqlc-dev sqlc-gen-json
CGO_ENABLED=$(CGO_ENABLED) go run ./scripts/regenerate/
sqlc-dev:
CGO_ENABLED=$(CGO_ENABLED) go build -o ~/bin/sqlc-dev ./cmd/sqlc/
sqlc-pg-gen:
CGO_ENABLED=$(CGO_ENABLED) go build -o ~/bin/sqlc-pg-gen ./internal/tools/sqlc-pg-gen
sqlc-gen-json:
CGO_ENABLED=$(CGO_ENABLED) go build -o ~/bin/sqlc-gen-json ./cmd/sqlc-gen-json
start:
docker-compose up -d
fmt:
go fmt ./...
psql:
PGPASSWORD=mysecretpassword psql --host=127.0.0.1 --port=5432 --username=postgres dinotest
mysqlsh:
mysqlsh --sql --user root --password mysecretpassword --database dinotest 127.0.0.1:3306
proto:
buf generate
remote-proto:
protoc \
--go_out=. --go_opt="Minternal/remote/gen.proto=github.com/sqlc-dev/sqlc/internal/remote" --go_opt=module=github.com/sqlc-dev/sqlc \
--go-grpc_out=. --go-grpc_opt="Minternal/remote/gen.proto=github.com/sqlc-dev/sqlc/internal/remote" --go-grpc_opt=module=github.com/sqlc-dev/sqlc \
internal/remote/gen.proto