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