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