root/schemas/Makefile @ 730
1 |
# OS
|
---|---|
2 |
os = $(shell uname) |
3 |
|
4 |
SED = sed -$(if $(filter Darwin,$(os)),E,r) |
5 |
|
6 |
#####
|
7 |
|
8 |
all = vegbien.sql vegbien_empty.sql vegbien.my.sql |
9 |
|
10 |
all: _always $(all) ; |
11 |
|
12 |
.SUFFIXES: |
13 |
|
14 |
_always: |
15 |
.PHONY: _always |
16 |
|
17 |
clean: _always |
18 |
$(RM) $(all) |
19 |
|
20 |
remake: _always clean all ; |
21 |
|
22 |
%:: %.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 |
|
36 |
#####
|
37 |
|
38 |
repl = ../bin/repl <$+ >$@ |
39 |
|
40 |
%.my.sql: %.sql ../lib/PostgreSQL-MySQL.csv |
41 |
$(repl)
|