Skip to content

Commit 19c7fcd

Browse files
kevinburke1kyleconroy
authored andcommitted
internal/dinosql/testdata/ondeck: add Makefile (#156)
This is an example of how to set up sqlc targets with Make to automatically regenerate the files when an input changes.
1 parent 1078c18 commit 19c7fcd

File tree

1 file changed

+17
-0
lines changed
  • internal/dinosql/testdata/ondeck

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ifeq ($(GOBIN),)
2+
GOBIN = $(firstword $(subst :, ,$(GOPATH)))/bin
3+
endif
4+
5+
SQLC := $(GOBIN)/sqlc
6+
SQL_FILES = $(shell find ./query -type f -name '*.sql')
7+
8+
$(SQLC):
9+
go get github.com/kyleconroy/sqlc/cmd/sqlc
10+
11+
prepared/db.go:
12+
prepared/models.go:
13+
db.go:
14+
models.go: $(SQL_FILES) sqlc.json | $(SQLC)
15+
$(SQLC) generate
16+
17+
sql: db.go models.go prepared/models.go prepared/db.go

0 commit comments

Comments
 (0)