Project

General

Profile

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 vegbien.for_ERD.my.sql\
9
vegbien.for_wiki.sql
10

    
11
all: _always $(all) ;
12

    
13
.SUFFIXES:
14

    
15
_always:
16
.PHONY: _always
17

    
18
clean: _always
19
	$(RM) $(all)
20

    
21
remake: _always clean all ;
22

    
23
%:: %.make
24
	./$< >$@
25
.PRECIOUS: %
26

    
27
#####
28

    
29
.PRECIOUS: vegbien.sql
30

    
31
empty = $(SED) -n \
32
's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@
33

    
34
%_empty.sql: %.sql
35
	$(empty)
36

    
37
#####
38

    
39
repl = ../bin/repl <$+ >$@
40

    
41
%.my.sql: %.sql ../lib/PostgreSQL-MySQL.csv
42
	$(repl)
43

    
44
%.for_wiki.sql: %.for_ERD.sql ../lib/ERD-wiki.csv
45
	$(repl)
(1-1/13)