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