root/schemas/Makefile @ 391
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 |
9 |
|
10 |
all: _always $(all) |
11 |
|
12 |
.SUFFIXES: |
13 |
|
14 |
_always: |
15 |
.PHONY: _always |
16 |
|
17 |
clean: _always |
18 |
$(RM) $(all) |
19 |
|
20 |
%:: %.make |
21 |
./$< >$@ |
22 |
.PRECIOUS: % |
23 |
|
24 |
#####
|
25 |
|
26 |
.PRECIOUS: vegbien.sql |
27 |
|
28 |
empty = $(SED) -n \ |
29 |
's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@ |
30 |
|
31 |
%_empty.sql: %.sql |
32 |
$(empty)
|