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