/ conversion / access / functions /
/conversion/access/functions/Makefile
1 # Copyright (C) 2012, 2013 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 access conversion 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 DBPATH := ../../../db
28
29 # Devfault variable values.
30 include $(DBPATH)/defaults.mk
31
32 # Have make look for files in the include directory
33 VPATH = $(DBPATH)/include:$(DBPATH)/functions
34
35 #m4_sources = foo.m4 bar.m4 ...
36 m4_sources = convert_access.m4 prepare_data.m4 convert_animid.m4 \
37 convert_access_gc.m4 ff_from_comments.m4
38
39 function_targets := $(patsubst %.m4,%,$(m4_sources))
40
41 all: makefunctions destroyfunctions
42
43 makefunctions: maketypes.m4 $(m4_sources) macros.m4 $(INCLUDES)
44 m4 -I $(DBPATH)/include \
45 -I $(DBPATH)/functions maketypes.m4 $(m4_sources) > makefunctions
46
47 destroyfunctions: destroytypes.m4 destroyfunctions.m4 $(INCLUDES)
48 m4 -I $(DBPATH)/include \
49 -I $(DBPATH)/functions destroyfunctions.m4 destroytypes.m4 \
50 > destroyfunctions
51
52 clean:
53 rm -rf makefunctions destroyfunctions
54
55 refunction: reinstall
56
57 reinstall: destroyfunctions makefunctions $(INCLUDES)
58 ( echo set client_min_messages TO WARNING\; ; \
59 cat destroyfunctions makefunctions; \
60 $(DBPATH)/vacuum_sys; ) \
61 | psql $(PSQL_ARGS)
62
63 install: makefunctions
64 ( echo set client_min_messages TO WARNING\; ; \
65 echo BEGIN\; ; \
66 cat makefunctions ; \
67 echo COMMIT\; ; \
68 $(DBPATH)/vacuum_sys; ) \
69 | psql $(PSQL_ARGS)
70
71 destroy: destroyfunctions
72 ( echo set client_min_messages TO WARNING\; ; \
73 cat destroyfunctions ; ) \
74 | psql $(PSQL_ARGS)
75
76 # The rule that makes individual functions and install them.
77 .PHONY: $(function_targets)
78 $(function_targets):
79 ( echo set client_min_messages TO WARNING\; ; \
80 m4 -I ../include $@.m4 ; ) \
81 | psql $(PSQL_ARGS)