Try to fix compile failures.
[util-vserver.git] / Makefile.am
1 ## $Id: Makefile.am 2482 2007-01-29 23:37:07Z dhozac $
2
3 # Copyright (C) 2003,2004,2005,2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 #  
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #  
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #  
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #  
19
20 ACLOCAL_AMFLAGS         =  -I m4
21 SUBDIRS                 =  . distrib python
22
23 SVN2CL_AMFLAGS          =  $(SVN2CL_TAG) --authors=svnusers.map
24 SVN2CL_ALLFLAGS        :=  $(SVN2CL_AMFLAGS) $(SVN2CL_FLAGS)
25
26 confdir                 =  $(sysconfdir)/vservers
27 confdefaultsdir         =  $(confdir)/.defaults
28 sbincfgdir              =  $(sbindir)
29 legacydir               =  $(pkglibdir)/legacy
30
31 include_HEADERS =
32 noinst_HEADERS =        $(ENSC_VECTOR_HDRS) \
33                         compat.h compat-c99.h
34
35 noinst_LIBRARIES =      $(ENSC_VECTOR_LIBS)
36 lib_LIBRARIES =
37 lib_LTLIBRARIES =
38 pkglib_LTLIBRARIES =
39
40 pkglib_SCRIPTS =
41 pkglib_DATA =           FEATURES.txt
42 pkglib_PROGRAMS =
43 legacy_SCRIPTS =
44 legacy_PROGRAMS =
45
46 sbin_SCRIPTS =
47 sbin_PROGRAMS =
48 noinst_PROGRAMS =
49 noinst_DATA =
50
51 initrd_SCRIPTS =
52 sysconf_DATA =
53
54 DIETPROGS =             $(LIBENSCVECTOR_DIET)
55
56 BUILT_SOURCES =         pathconfig.h \
57                         .fixups
58
59 man_MANS =
60
61 kernel_HDRS =           $(wildcard kernel/*.h)
62
63
64 EXTRA_PROGRAMS =
65 EXTRA_DIST =            pathconfig.h.pathsubst \
66                         util-vserver.spec \
67                         THANKS REQUIREMENTS \
68                         $(kernel_HDRS)
69
70 check_PROGRAMS =
71 check_SCRIPTS =
72
73 TESTS_DEBUG =           no
74 TESTS =
75 TESTS_ENVIRONMENT =     ensc_use_expensive_tests="$(ENSC_USE_EXPENSIVE_TESTS)" \
76                         ensc_test_debug="$(TESTS_DEBUG)"
77
78 AM_CPPFLAGS =           -I $(top_srcdir)/lib -I $(top_srcdir)/ensc_wrappers \
79                         -D_GNU_SOURCE -D_REENTRANT $(RELEASE_CPPFLAGS)
80
81 CLEANFILES =            $(BUILT_SOURCES) \
82                         .*.pathsubst.stamp */.*.pathsubst.stamp */*/.*.pathsubst.stamp \
83                         pathconfig.h .fixups
84
85 DISTCLEANFILES =        FEATURES.txt
86
87
88 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT =
89
90 if USE_DIETLIBC
91 DIET_CC                :=  $(DIET) $(DIETFLAGS) $(CC)
92 VSERVER_LDFLGS         :=  -static
93 else
94 VSERVER_LDFLGS         :=
95 endif
96
97 if USE_DIETLIBC_COMPAT
98 DIET_COMPAT_LDADDS =    -lcompat
99 else
100 DIET_COMPAT_LDADDS =
101 endif
102
103 VSERVER_LDADDS =        $(LIBVSERVER) $(DIET_COMPAT_LDADDS)
104
105 silent.%:               FORCE
106                         @t=$$($(MKTEMP) -d /tmp/build.XXXXXX) && \
107                         trap "rm -rf $$t" EXIT && \
108                         mkfifo $$t/fifo && \
109                         ( grep --line-buffered -v \
110                                      -e ': In function' \
111                                      -e 'your code still has assertions enabled' \
112                                      -e ' is obsoleted' \
113                                      -e 'warning: #warning' <$$t/fifo & ) && \
114                         exec 2>$$t/fifo && \
115                         $(MAKE) '$*' -s >/dev/null
116
117 pathsubst_RULES =       s!@'PKGLIBDIR'@!$(pkglibdir)!g; \
118                         s!@'LEGACYDIR'@!$(legacydir)!g; \
119                         s!@'SBINDIR'@!$(sbindir)!g; \
120                         s!@'CONFDIR'@!$(confdir)!g; \
121                         s!@'SYSCONFDIR'@!$(sysconfdir)!g; \
122                         s!@'PKGSTATEDIR'@!$(pkgstatedir)!g; \
123                         s!@'PKGCACHEDIR'@!$(pkgcachedir)!g; \
124                         s!@'PKGSTATEREVDIR'@!$(pkgstaterevdir)!g; \
125                         s!@'VSERVERDIR'@!$(vserverdir)!g; \
126                         s!@'VSERVERPKGDIR'@!$(vserverpkgdir)!g; \
127                         s!@'VSERVERPKGDIR'@!$(vserverpkgdir)!g; \
128                         s!@'VSHELPERSTATEDIR'@!$(vshelperstatedir)!g; \
129                         s!@'INITRDDIR'@!$(initrddir)!g; \
130                         s!@'LIBDIR'@!$(libdir)!g; \
131                         s!@'MANDIR'@!$(mandir)!g; \
132                         s!@'INCLUDEDIR'@!$(includedir)!g; \
133                         s!@'PACKAGE'@!$(PACKAGE)!g; \
134                         s!@'PACKAGE_BUGREPORT'@!$(PACKAGE_BUGREPORT)!g; \
135                         s!@'PACKAGE_NAME'@!$(PACKAGE_NAME)!g; \
136                         s!@'PACKAGE_STRING'@!$(PACKAGE_STRING)!g; \
137                         s!@'PACKAGE_TARNAME'@!$(PACKAGE_TARNAME)!g; \
138                         s!@'PACKAGE_VERSION'@!$(PACKAGE_VERSION)!g; \
139                         s!@'ENSC_HAVE_C99_COMPILER_TRUE'@!\@ENSC_HAVE_C99_COMPILER_TRUE@ !g; \
140                         s!@'ENSC_HAVE_C99_COMPILER_FALSE'@!\@ENSC_HAVE_C99_COMPILER_FALSE@ !g; \
141                         s!@'ENSC_HAVE_CXX_COMPILER_TRUE'@!\@ENSC_HAVE_CXX_COMPILER_TRUE@ !g; \
142                         s!@'ENSC_HAVE_CXX_COMPILER_FALSE'@!\@ENSC_HAVE_CXX_COMPILER_FALSE@ !g; \
143                         s!@'ENSC_HAVE_LIBNL_TRUE'@!\@ENSC_HAVE_LIBNL_TRUE@ !g; \
144                         s!@'ENSC_HAVE_LIBNL_FALSE'@!\@ENSC_HAVE_LIBNL_FALSE@ !g; \
145                         $(ENSC_PATHPROG_SED)
146
147 pathconfig.h:           .pathconfig.h.pathsubst.stamp
148 .%.pathsubst.stamp:     %.pathsubst Makefile
149                         @mkdir -p $$(dirname '$@')
150                         @echo "$(SED) -e '...' $*.pathsubst >$*"
151                         @$(SED) -e '$(pathsubst_RULES)' '$<' >'$@.tmp'
152                         @-chmod --reference='$<' '$@.tmp'
153                         @if cmp -s '$@.tmp' '$*'; then \
154                                 echo "... no changes, reusing old version"; \
155                                 rm -f '$@.tmp'; \
156                         else \
157                                 rm -f '$*'; mv '$@.tmp' '$*'; \
158                         fi
159                         @chmod a-w '$*'
160                         @touch '$@'
161
162 pkgcachedir =           $(localstatedir)/cache/vservers
163 pkgstatedir =           $(localstatedir)/run/vservers
164 pkgstaterevdir =        $(confdefaultsdir)/run.rev
165 vserverpkgdir =         $(vserverdir)/.pkg
166 vshelperstatedir =      $(localstatedir)/run/vshelper
167
168 fix_SCRPTS              =  $(addprefix $(pkglibdir)/, $(notdir $(pkglib_SCRIPTS))) \
169                            $(addprefix $(legacydir)/, $(notdir $(legacy_SCRIPTS))) \
170                            $(addprefix $(sbindir)/,   $(notdir $(sbin_SCRIPTS))) \
171                            $(addprefix $(initrddir)/, $(notdir $(initrd_SCRIPTS)))
172
173 update-doc:             doc
174                         $(top_srcdir)/update-doc
175
176 install-data-hook:      install-fix-script-paths install-create-dirs
177
178 install-create-dirs:
179                         $(mkinstalldirs) -m 0755 $(DESTDIR)$(pkgstatedir) $(DESTDIR)$(pkgstatedir).rev $(DESTDIR)$(vshelperstatedir)
180                         $(mkinstalldirs) -m 0700 $(DESTDIR)$(pkgcachedir)
181                         $(mkinstalldirs) -m 0755 $(DESTDIR)$(confdefaultsdir)
182                         f=$(DESTDIR)$(confdefaultsdir)/vdirbase;  test -e "$$f" || ln -sf '$(vserverdir)'      "$$f"
183                         f=$(DESTDIR)$(confdefaultsdir)/cachebase; test -e "$$f" || ln -sf '$(pkgcachedir)'     "$$f"
184                         f=$(DESTDIR)$(pkgstaterevdir);            test -e "$$f" || ln -sf '$(pkgstatedir).rev' "$$f"
185
186 install-fix-script-paths:
187                         test "/usr/lib/util-vserver" = "$(pkglibdir)" || \
188                         for i in $(fix_SCRPTS); do \
189                                 f="$(DESTDIR)$$i"; \
190                                 $(SED) -e 's!/usr/lib/util-vserver!$(pkglibdir)!g' "$$f" >"$$f.tmp"; \
191                                 $(CMP) -s "$$f.tmp" "$$f" || cat "$$f.tmp" >"$$f"; \
192                                 rm -f "$$f.tmp"; \
193                         done
194
195 install-distribution:   _install-vserverdir _install-vshelperlink
196
197 _install-vshelperlink:
198                         $(mkinstalldirs) $(DESTDIR)/sbin
199                         ln -sf ..$(pkglibdir)/vshelper $(DESTDIR)/sbin/vshelper
200
201 _install-vserverdir:
202                         $(mkinstalldirs) $(DESTDIR)$(vserverdir) $(DESTDIR)$(vserverpkgdir)
203
204
205 .fixups:                config.status util-vserver.spec
206                         chmod a-w util-vserver.spec
207                         touch $@
208
209 if USE_DIETLIBC
210 $(addsuffix $(EXEEXT), $(DIETPROGS)) \
211 $(addsuffix $(OBJEXT), $(DIETPROGS)) \
212                 :               CC=$(DIET_CC)
213 else    !USE_DIETLIBC
214 nodist_lib_dietlibc_not_enabled_error_a_SOURCES = \
215                         lib-dietlibc-not-enabled-error.c
216 endif
217
218 install-exec-hook:
219         cd $(DESTDIR)$(sbindir) && $(LN_S)f vuseradd vadduser
220         cd $(DESTDIR)$(sbindir) && $(LN_S)f vuserdel vdeluser
221         mkdir -p $(DESTDIR)/bin
222         cd $(DESTDIR)/bin && $(LN_S)f ../$(sbindir)/vsh
223
224 install-data-hook:
225         install -D -m 644 scripts/vcached.logrotate $(DESTDIR)/$(sysconfdir)/logrotate.d/vcached
226         install -D -m 644 scripts/vcached.cron $(DESTDIR)/$(sysconfdir)/cron.d/vcached
227
228 include $(top_srcdir)/lib/Makefile-files
229 include $(top_srcdir)/src/Makefile-files
230 include $(top_srcdir)/doc/Makefile-files
231 include $(top_srcdir)/man/Makefile-files
232 include $(top_srcdir)/scripts/Makefile-files
233 include $(top_srcdir)/tests/Makefile-files
234 include $(top_srcdir)/sysv/Makefile-files
235 include $(top_srcdir)/contrib/Makefile-files
236 include $(top_srcdir)/ensc_vector/Makefile-files
237 include $(top_srcdir)/ensc_wrappers/Makefile-files
238 include $(top_srcdir)/ensc_fmt/Makefile-files
239 include $(top_srcdir)/lib_internal/Makefile-files
240 include $(top_srcdir)/vserver-start/Makefile-files
241 include $(top_srcdir)/gentoo/Makefile-files
242
243 include $(top_srcdir)/m4/gpgsig.am
244 include $(top_srcdir)/m4/validate.am
245 include $(top_srcdir)/m4/changelog.am
246 include $(top_srcdir)/m4/pkgconfig.am
247 include $(top_srcdir)/m4/libsel.am
248 include $(top_srcdir)/m4/install-notify.am
249
250 .PHONY:         FORCE update-doc