1 |
6912
|
aaronmk
|
selfDir_AkFFYJ := $(dir $(lastword $(MAKEFILE_LIST)))
|
2 |
|
|
root := $(selfDir_AkFFYJ)..
|
3 |
|
|
include $(root)/lib/common.Makefile
|
4 |
|
|
|
5 |
|
|
|
6 |
785
|
aaronmk
|
##### Vars/functions
|
7 |
|
|
|
8 |
387
|
aaronmk
|
# OS
|
9 |
|
|
os = $(shell uname)
|
10 |
|
|
|
11 |
|
|
SED = sed -$(if $(filter Darwin,$(os)),E,r)
|
12 |
|
|
|
13 |
785
|
aaronmk
|
##### General targets
|
14 |
387
|
aaronmk
|
|
15 |
2978
|
aaronmk
|
all = vegbien.sql vegbien.my.sql functions.sql py_functions.sql
|
16 |
387
|
aaronmk
|
|
17 |
418
|
aaronmk
|
all: _always $(all) ;
|
18 |
387
|
aaronmk
|
|
19 |
|
|
clean: _always
|
20 |
|
|
$(RM) $(all)
|
21 |
|
|
|
22 |
785
|
aaronmk
|
##### MySQL schema for ERD
|
23 |
533
|
aaronmk
|
|
24 |
809
|
aaronmk
|
repl = ../bin/repl
|
25 |
541
|
aaronmk
|
|
26 |
809
|
aaronmk
|
%.my.sql: %.sql ../lib/PostgreSQL-MySQL.csv filter_ERD.csv
|
27 |
|
|
$(repl) <$(wordlist 1,2,$+)|$(repl) $(word 3,$+) >$@
|
28 |
2979
|
aaronmk
|
|
29 |
|
|
##### DDLs
|
30 |
|
|
|
31 |
6029
|
aaronmk
|
pg_dump = env schema= ../bin/pg_dump_vegbien $(1) >$@
|
32 |
2979
|
aaronmk
|
|
33 |
|
|
vegbien.sql:
|
34 |
|
|
$(call pg_dump,public)
|
35 |
|
|
|
36 |
|
|
py_functions.sql:
|
37 |
|
|
env owners=1 $(call pg_dump,py_functions)
|
38 |
|
|
|
39 |
|
|
# Must come after %.my.sql so that gets matched first
|
40 |
|
|
%.sql:
|
41 |
|
|
$(call pg_dump,$*)
|