root/schemas/Makefile @ 761
1 | 387 | aaronmk | # OS
|
---|---|---|---|
2 | os = $(shell uname) |
||
3 | |||
4 | SED = sed -$(if $(filter Darwin,$(os)),E,r) |
||
5 | |||
6 | #####
|
||
7 | |||
8 | 692 | aaronmk | all = vegbien.sql vegbien_empty.sql vegbien.my.sql |
9 | 387 | aaronmk | |
10 | 418 | aaronmk | all: _always $(all) ; |
11 | 387 | aaronmk | |
12 | .SUFFIXES: |
||
13 | |||
14 | _always: |
||
15 | .PHONY: _always |
||
16 | |||
17 | clean: _always |
||
18 | $(RM) $(all) |
||
19 | |||
20 | 423 | aaronmk | remake: _always clean all ; |
21 | |||
22 | 387 | aaronmk | %:: %.make |
23 | ./$< >$@ |
||
24 | .PRECIOUS: % |
||
25 | |||
26 | #####
|
||
27 | |||
28 | .PRECIOUS: vegbien.sql |
||
29 | |||
30 | empty = $(SED) -n \ |
||
31 | 's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@ |
||
32 | |||
33 | %_empty.sql: %.sql |
||
34 | $(empty)
|
||
35 | 533 | aaronmk | |
36 | #####
|
||
37 | |||
38 | 541 | aaronmk | repl = ../bin/repl <$+ >$@ |
39 | |||
40 | 533 | aaronmk | %.my.sql: %.sql ../lib/PostgreSQL-MySQL.csv |
41 | 541 | aaronmk | $(repl)
|