7919cac6bad3bc3e77b08870d4381dd37a408522
[shibboleth/cpp-sp.git] / configs / Makefile.am
1 ## $Id$ 
2
3 AUTOMAKE_OPTIONS = foreign
4
5 pkglogdir = ${localstatedir}/log/@PACKAGE@
6 shirelogdir = ${localstatedir}/log/httpd
7 xmldir = $(datadir)/xml
8 pkgxmldir = $(datadir)/xml/@PACKAGE@
9 varrundir = $(localstatedir)/run
10 pkgsysconfdir = $(sysconfdir)/@PACKAGE@
11 pkgsysconf_DATA = \
12         shibd-redhat \
13         shibd-debian \
14         apache.config \
15         apache2.config \
16         apache22.config
17
18 # The config files are installed "special".  Unlike the entries in
19 # pkgsysconf_DATA, these files are installed as "foo.dist" and only
20 # installed as "foo" if "foo" does not already exist.  In other words,
21 # the config files will not overwrite existing versions.
22 BUILTCONFIGFILES = \
23         shibboleth2.xml \
24         native.logger \
25         shibd.logger \
26         attribute-map.xml \
27         attribute-policy.xml \
28         example-metadata.xml
29
30 # While BUILTCONFIGFILES are processed, these are not; so we should pull
31 # them from SRCDIR.
32 CONFIGFILES = \
33         console.logger \
34         syslog.logger \
35         accessError.html \
36         sessionError.html \
37         metadataError.html \
38         bindingTemplate.html \
39         localLogout.html \
40         globalLogout.html \
41         sslError.html \
42         sp-example.key \
43         sp-example.crt
44
45 #
46 # Some of these need building
47 #
48 do-build-file:
49         rm -f ${FILE}.tmp
50         sed < ${srcdir}/${FILE}.in > ${FILE}.tmp \
51             -e 's:@-PREFIX-@:${prefix}:g' \
52             -e 's:@-LIBEXECDIR-@:${libexecdir}:g' \
53             -e 's:@-PKGSYSCONFDIR-@:${pkgsysconfdir}:g' \
54             -e 's:@-PKGXMLDIR-@:${pkgxmldir}:g' \
55             -e 's:@-XMLDIR-@:${xmldir}:g' \
56             -e 's:@-PKGLOGDIR-@:${pkglogdir}:g' \
57             -e 's:@-SHIRELOGDIR-@:${shirelogdir}:g' \
58             -e 's:@-VARRUNDIR-@:${varrundir}:g'
59         cmp -s ${FILE} ${FILE}.tmp || mv ${FILE}.tmp ${FILE}
60         rm -f ${FILE}.tmp
61
62 apache.config: ${srcdir}/apache.config.in Makefile ${top_builddir}/config.status
63         $(MAKE) do-build-file FILE=$@
64
65 apache2.config: ${srcdir}/apache2.config.in Makefile ${top_builddir}/config.status
66         $(MAKE) do-build-file FILE=$@
67
68 apache22.config: ${srcdir}/apache22.config.in Makefile ${top_builddir}/config.status
69         $(MAKE) do-build-file FILE=$@
70
71 shibd-redhat: ${srcdir}/shibd-redhat.in Makefile ${top_builddir}/config.status
72         $(MAKE) do-build-file FILE=$@
73
74 shibd-debian: ${srcdir}/shibd-debian.in Makefile ${top_builddir}/config.status
75         $(MAKE) do-build-file FILE=$@
76
77 shibd.logger: ${srcdir}/shibd.logger.in Makefile ${top_builddir}/config.status
78         $(MAKE) do-build-file FILE=$@
79
80 native.logger: ${srcdir}/native.logger.in Makefile ${top_builddir}/config.status
81         $(MAKE) do-build-file FILE=$@
82
83 shibboleth2.xml: ${srcdir}/shibboleth2.xml.in Makefile ${top_builddir}/config.status
84         $(MAKE) do-build-file FILE=$@
85
86 attribute-map.xml: ${srcdir}/attribute-map.xml.in Makefile ${top_builddir}/config.status
87         $(MAKE) do-build-file FILE=$@
88
89 attribute-policy.xml: ${srcdir}/attribute-policy.xml.in Makefile ${top_builddir}/config.status
90         $(MAKE) do-build-file FILE=$@
91
92 example-metadata.xml: ${srcdir}/example-metadata.xml.in Makefile ${top_builddir}/config.status
93         $(MAKE) do-build-file FILE=$@
94
95 all-data-local: $(BUILTCONFIGFILES)
96
97 install-data-local:     all-data-local
98         $(mkinstalldirs) $(DESTDIR)$(pkglogdir)
99         $(mkinstalldirs) $(DESTDIR)$(shirelogdir)
100         $(mkinstalldirs) $(DESTDIR)$(varrundir)
101         $(mkinstalldirs) $(DESTDIR)$(pkgxmldir)
102         $(mkinstalldirs) $(DESTDIR)$(prefix)/data
103         $(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)
104         for f in $(BUILTCONFIGFILES); do \
105                 if test ! -f $(DESTDIR)${pkgsysconfdir}/$$f; then \
106                         $(INSTALL_DATA) $$f $(DESTDIR)${pkgsysconfdir}; \
107                 fi; \
108                 $(INSTALL_DATA) $$f $(DESTDIR)${pkgsysconfdir}/$$f.dist; \
109         done
110         for f in $(CONFIGFILES); do \
111                 if test ! -f $(DESTDIR)${pkgsysconfdir}/$$f; then \
112                         $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)${pkgsysconfdir}; \
113                 fi; \
114                 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)${pkgsysconfdir}/$$f.dist; \
115         done
116
117 CLEANFILES = \
118         apache.config \
119         apache2.config \
120         apache22.config \
121         shibd-redhat \
122         shibd-debian \
123         shibd.logger \
124         native.logger \
125         shibboleth2.xml \
126         attribute-map.xml \
127         attribute-policy.xml \
128         example-metadata.xml
129
130 EXTRA_DIST = \
131         shibboleth2.xml.in \
132         attribute-map.xml.in \
133         attribute-policy.xml.in \
134         example-metadata.xml.in \
135         native.logger.in \
136         shibd.logger.in \
137         apache.config.in \
138         apache2.config.in \
139         apache22.config.in \
140         shibd-redhat.in \
141         shibd-debian.in \
142         $(CONFIGFILES)