/ db / functions /
/db/functions/Makefile
1 # Copyright (C) 2012, 2015 The Meme Factory, Inc. http://www.meme.com/
2 # Copyright (C) 2004, 2005, 2008, 2009, Karl O. Pinc <kop@meme.com>
3 #
4 # This file is part of Gombe-MI.
5 #
6 # Gombe-MI is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
18 #
19 # Makefile for database functions (stored procedures)
20 #
21 # Karl O. Pinc <kop@meme.com>
22
23 # You can write:
24 # make functionname
25 # to install just that function.
26
27 # Devfault variable values.
28 include ../defaults.mk
29
30 # Have make look for files in the include directory
31 VPATH = ../include
32
33 m4_sources = followfunc.m4 followrole.m4 mom_in_gc.m4 infants_in_gc.m4 \
34 add_social_partners.m4 infer_gc.m4 delete_gc.m4 \
35 run_integrity_queries.m4
36
37 function_targets := $(patsubst %.m4,%,$(m4_sources))
38
39 all: makefunctions destroyfunctions
40
41 makefunctions: maketypes.m4 $(m4_sources) macros.m4 $(INCLUDES)
42 m4 -I ../include maketypes.m4 $(m4_sources) > makefunctions
43
44 destroyfunctions: destroytypes.m4 destroyfunctions.m4 \
45 destroywarningfunctions.m4 $(INCLUDES)
46 m4 -I ../include destroyfunctions.m4 destroytypes.m4 \
47 > destroyfunctions
48
49 clean:
50 rm -rf makefunctions destroyfunctions
51
52 refunction: reinstall
53
54 reinstall: destroyfunctions makefunctions $(INCLUDES)
55 ( echo set client_min_messages TO WARNING\; ; \
56 cat destroyfunctions makefunctions; \
57 ../vacuum_sys; ) \
58 | psql $(PSQL_ARGS)
59
60 install: makefunctions
61 ( echo set client_min_messages TO WARNING\; ; \
62 echo BEGIN\; ; \
63 cat makefunctions ; \
64 echo COMMIT\; ; \
65 ../vacuum_sys; ) \
66 | psql $(PSQL_ARGS)
67
68 destroy: destroyfunctions
69 ( echo set client_min_messages TO WARNING\; ; \
70 cat destroyfunctions ; ) \
71 | psql $(PSQL_ARGS)
72
73 # The rule that makes individual functions and install them.
74 .PHONY: $(function_targets)
75 $(function_targets):
76 ( echo set client_min_messages TO WARNING\; ; \
77 m4 -I ../include $@.m4 ; ) \
78 | psql $(PSQL_ARGS)