Project

General

Profile

1 387 aaronmk
# 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 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)