https://issues.shibboleth.net/jira/browse/SSPCPP-646
[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         cmp -s ${FILE} ${FILE}.tmp || mv ${FILE}.tmp ${FILE}
74         rm -f ${FILE}.tmp
75
76 apache.config: ${srcdir}/apache.config.in Makefile ${top_builddir}/config.status
77         $(MAKE) do-build-file FILE=$@
78
79 apache2.config: ${srcdir}/apache2.config.in Makefile ${top_builddir}/config.status
80         $(MAKE) do-build-file FILE=$@
81
82 apache22.config: ${srcdir}/apache22.config.in Makefile ${top_builddir}/config.status
83         $(MAKE) do-build-file FILE=$@
84
85 apache24.config: ${srcdir}/apache24.config.in Makefile ${top_builddir}/config.status
86         $(MAKE) do-build-file FILE=$@
87
88 shibd-redhat: ${srcdir}/shibd-redhat.in Makefile ${top_builddir}/config.status
89         $(MAKE) do-build-file FILE=$@
90
91 shibd-amazon: ${srcdir}/shibd-amazon.in Makefile ${top_builddir}/config.status
92         $(MAKE) do-build-file FILE=$@
93
94 shibd-suse: ${srcdir}/shibd-suse.in Makefile ${top_builddir}/config.status
95         $(MAKE) do-build-file FILE=$@
96
97 shibd-debian: ${srcdir}/shibd-debian.in Makefile ${top_builddir}/config.status
98         $(MAKE) do-build-file FILE=$@
99
100 shibd-osx.plist: ${srcdir}/shibd-osx.plist.in Makefile ${top_builddir}/config.status
101         $(MAKE) do-build-file FILE=$@
102
103 shibd.logger: ${srcdir}/shibd.logger.in Makefile ${top_builddir}/config.status
104         $(MAKE) do-build-file FILE=$@
105
106 native.logger: ${srcdir}/native.logger.in Makefile ${top_builddir}/config.status
107         $(MAKE) do-build-file FILE=$@
108
109 all-data-local: $(BUILTCONFIGFILES)
110
111 install-data-local:     all-data-local
112         $(mkinstalldirs) $(DESTDIR)$(pkglogdir)
113         $(mkinstalldirs) $(DESTDIR)$(shirelogdir)
114         $(mkinstalldirs) $(DESTDIR)$(pkgrundir)
115         $(mkinstalldirs) $(DESTDIR)$(pkgcachedir)
116         $(mkinstalldirs) $(DESTDIR)$(pkgxmldir)
117         $(mkinstalldirs) $(DESTDIR)$(pkgsysconfdir)
118         for f in $(BUILTCONFIGFILES); do \
119                 if test ! -f $(DESTDIR)${pkgsysconfdir}/$$f; then \
120                         $(INSTALL_DATA) $$f $(DESTDIR)${pkgsysconfdir}; \
121                 fi; \
122                 $(INSTALL_DATA) $$f $(DESTDIR)${pkgsysconfdir}/$$f.dist; \
123         done
124         for f in $(CONFIGFILES); do \
125                 if test ! -f $(DESTDIR)${pkgsysconfdir}/$$f; then \
126                         $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)${pkgsysconfdir}; \
127                 fi; \
128                 $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)${pkgsysconfdir}/$$f.dist; \
129         done
130
131 install-data-hook:
132         chmod +x $(DESTDIR)$(pkgsysconfdir)/keygen.sh
133         chmod +x $(DESTDIR)$(pkgsysconfdir)/metagen.sh
134         if test -z "$(NOKEYGEN)"; then \
135                 cd $(DESTDIR)$(pkgsysconfdir); \
136                 sh ./keygen.sh -b ; \
137         fi
138
139 CLEANFILES = \
140         apache.config \
141         apache2.config \
142         apache22.config \
143         apache24.config \
144         shibd-redhat \
145     shibd-amazon \
146         shibd-suse \
147         shibd-debian \
148         shibd-osx.plist \
149         shibd.logger \
150         native.logger
151
152 EXTRA_DIST = \
153         native.logger.in \
154         shibd.logger.in \
155         apache.config.in \
156         apache2.config.in \
157         apache22.config.in \
158         apache24.config.in \
159         shibd-redhat.in \
160     shibd-amazon.in \
161         shibd-suse.in \
162         shibd-debian.in \
163         shibd-osx.plist.in \
164         keygen.bat \
165         keygen.sh \
166         metagen.sh \
167         SetService32.bat \
168         SetService64.bat \
169         upgrade.xsl \
170         xsltproc.js \
171         $(CONFIGFILES)