/ doc / views /
/doc/views/Makefile
1 # Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com/
2 # Copyright (C) 2010, 2011 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 xml views
20 #
21 # Karl O. Pinc <kop@meme.com>
22
23 # Have make look for files in the db include directory
24 # (For constants.m4)
25 VPATH = ../../db/include
26
27 # Where the doc dir is.
28 DOC_PATH := ..
29
30 # XMLLINT command used to validate xml.
31 include $(DOC_PATH)/xmllint.mk
32
33 # Get VIEW_NAMES and M4_VIEWS variables.
34 include views.mk
35 MAKEDEPENDS := Makefile $(DOC_PATH)/xmllint.mk \
36 $(DOC_PATH)/xmllint-wrapper views.mk
37
38 # Dependenciees of those files that m4 include m4_macros.m4
39 M4DEPENDS := m4_macros.m4 m4_m4iterators.m4
40
41 # Each VIEW_SOURCE must also have a dia document with the same prefix.
42 # (Unless doc/diagrams/image_targets.mk defines an exception)
43 VIEW_SOURCES = $(VIEW_NAMES:%=%.xml)
44
45 VIEW_VALIDATES = $(VIEW_SOURCES:%.xml=validate/%)
46
47 TARGETS = $(M4_VIEWS:%=%.xml)
48
49
50 all: $(TARGETS)
51
52 #
53 # The constants
54 #
55 ../constants: constants.m4
56 $(MAKE) -C .. constants
57
58 #
59 # XML validation
60 #
61 validate_xml: validate $(VIEW_VALIDATES)
62
63 validate:
64 if [ ! -d validate ] ; then mkdir validate ; fi
65
66
67 # Validate all the views.
68 # As the makefile always validates before constructing
69 # the target this takes care of all the validation xml file dependencies.
70 $(VIEW_VALIDATES): validate/%: %.xml validate $(MAKEDEPENDS) ../constants
71 $(XMLLINT) $< \
72 && touch $@
73
74 clean:
75 rm -rf $(TARGETS) validate
76
77 mostlyclean: clean
78