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