Add forgotten kernel headers (not important, but makes it easier to keep track).
[util-vserver.git] / Makefile.am
1 ## $Id$
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
22
23 CVS2CL_AMFLAGS          =  $(CVS2CL_TAG) -U cvsusers.map --show-dead -S --no-wrap
24 CVS2CL_ALLFLAGS        :=  $(CVS2CL_AMFLAGS) $(CVS2CL_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 =                                   \
62                         kernel/context.h        \
63                         kernel/context_cmd.h    \
64                         kernel/cvirt.h          \
65                         kernel/cvirt_cmd.h      \
66                         kernel/cvirt_def.h      \
67                         kernel/debug.h          \
68                         kernel/debug_cmd.h      \
69                         kernel/dlimit.h         \
70                         kernel/dlimit_cmd.h     \
71                         kernel/inode.h          \
72                         kernel/inode_cmd.h      \
73                         kernel/legacy.h         \
74                         kernel/limit.h          \
75                         kernel/limit_cmd.h      \
76                         kernel/limit_def.h      \
77                         kernel/namespace.h      \
78                         kernel/namespace_cmd.h  \
79                         kernel/network.h        \
80                         kernel/network_cmd.h    \
81                         kernel/sched.h          \
82                         kernel/sched_cmd.h      \
83                         kernel/sched_def.h      \
84                         kernel/signal_cmd.h     \
85                         kernel/switch.h         \
86                         kernel/xid.h
87
88
89
90 EXTRA_PROGRAMS =
91 EXTRA_DIST =            pathconfig.h.pathsubst \
92                         util-vserver.spec \
93                         THANKS REQUIREMENTS \
94                         $(kernel_HDRS)
95
96 check_PROGRAMS =
97 check_SCRIPTS =
98
99 TESTS_DEBUG =           no
100 TESTS =
101 TESTS_ENVIRONMENT =     ensc_use_expensive_tests="$(ENSC_USE_EXPENSIVE_TESTS)" \
102                         ensc_test_debug="$(TESTS_DEBUG)"
103
104 AM_CPPFLAGS =           -I $(top_srcdir)/lib -I $(top_srcdir)/ensc_wrappers \
105                         -D_GNU_SOURCE -D_REENTRANT $(RELEASE_CPPFLAGS)
106
107 CLEANFILES =            $(BUILT_SOURCES) \
108                         .*.pathsubst.stamp */.*.pathsubst.stamp */*/.*.pathsubst.stamp \
109                         pathconfig.h .fixups
110
111 DISTCLEANFILES =        FEATURES.txt
112
113
114 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT =
115
116 if USE_DIETLIBC
117 DIET_CC                :=  $(DIET) $(DIETFLAGS) $(CC)
118 VSERVER_LDFLGS         :=  -static
119 else
120 VSERVER_LDFLGS         :=
121 endif
122
123 if USE_DIETLIBC_COMPAT
124 DIET_COMPAT_LDADDS =    -lcompat
125 else
126 DIET_COMPAT_LDADDS =
127 endif
128
129 VSERVER_LDADDS =        $(LIBVSERVER) $(DIET_COMPAT_LDADDS)
130
131 silent.%:               FORCE
132                         @t=$$($(MKTEMP) -d /tmp/build.XXXXXX) && \
133                         trap "rm -rf $$t" EXIT && \
134                         mkfifo $$t/fifo && \
135                         ( grep --line-buffered -v \
136                                      -e ': In function' \
137                                      -e 'your code still has assertions enabled' \
138                                      -e ' is obsoleted' \
139                                      -e 'warning: #warning' <$$t/fifo & ) && \
140                         exec 2>$$t/fifo && \
141                         $(MAKE) '$*' -s >/dev/null
142
143 pathsubst_RULES =       s!@'PKGLIBDIR'@!$(pkglibdir)!g; \
144                         s!@'LEGACYDIR'@!$(legacydir)!g; \
145                         s!@'SBINDIR'@!$(sbindir)!g; \
146                         s!@'CONFDIR'@!$(confdir)!g; \
147                         s!@'SYSCONFDIR'@!$(sysconfdir)!g; \
148                         s!@'PKGSTATEDIR'@!$(pkgstatedir)!g; \
149                         s!@'PKGCACHEDIR'@!$(pkgcachedir)!g; \
150                         s!@'PKGSTATEREVDIR'@!$(pkgstaterevdir)!g; \
151                         s!@'VSERVERDIR'@!$(vserverdir)!g; \
152                         s!@'VSERVERPKGDIR'@!$(vserverpkgdir)!g; \
153                         s!@'VSERVERPKGDIR'@!$(vserverpkgdir)!g; \
154                         s!@'VSHELPERSTATEDIR'@!$(vshelperstatedir)!g; \
155                         s!@'INITRDDIR'@!$(initrddir)!g; \
156                         s!@'LIBDIR'@!$(libdir)!g; \
157                         s!@'MANDIR'@!$(mandir)!g; \
158                         s!@'INCLUDEDIR'@!$(includedir)!g; \
159                         s!@'PACKAGE'@!$(PACKAGE)!g; \
160                         s!@'PACKAGE_BUGREPORT'@!$(PACKAGE_BUGREPORT)!g; \
161                         s!@'PACKAGE_NAME'@!$(PACKAGE_NAME)!g; \
162                         s!@'PACKAGE_STRING'@!$(PACKAGE_STRING)!g; \
163                         s!@'PACKAGE_TARNAME'@!$(PACKAGE_TARNAME)!g; \
164                         s!@'PACKAGE_VERSION'@!$(PACKAGE_VERSION)!g; \
165                         s!@'ENSC_HAVE_C99_COMPILER_TRUE'@!\@ENSC_HAVE_C99_COMPILER_TRUE@ !g; \
166                         s!@'ENSC_HAVE_C99_COMPILER_FALSE'@!\@ENSC_HAVE_C99_COMPILER_FALSE@ !g; \
167                         s!@'ENSC_HAVE_CXX_COMPILER_TRUE'@!\@ENSC_HAVE_CXX_COMPILER_TRUE@ !g; \
168                         s!@'ENSC_HAVE_CXX_COMPILER_FALSE'@!\@ENSC_HAVE_CXX_COMPILER_FALSE@ !g; \
169                         $(ENSC_PATHPROG_SED)
170
171 pathconfig.h:           .pathconfig.h.pathsubst.stamp
172 .%.pathsubst.stamp:     %.pathsubst Makefile
173                         @mkdir -p $$(dirname '$@')
174                         @echo "$(SED) -e '...' $*.pathsubst >$*"
175                         @$(SED) -e '$(pathsubst_RULES)' '$<' >'$@.tmp'
176                         @-chmod --reference='$<' '$@.tmp'
177                         @if cmp -s '$@.tmp' '$*'; then \
178                                 echo "... no changes, reusing old version"; \
179                                 rm -f '$@.tmp'; \
180                         else \
181                                 rm -f '$*'; mv '$@.tmp' '$*'; \
182                         fi
183                         @chmod a-w '$*'
184                         @touch '$@'
185
186 pkgcachedir =           $(localstatedir)/cache/vservers
187 pkgstatedir =           $(localstatedir)/run/vservers
188 pkgstaterevdir =        $(confdefaultsdir)/run.rev
189 vserverpkgdir =         $(vserverdir)/.pkg
190 vshelperstatedir =      $(localstatedir)/run/vshelper
191
192 fix_SCRPTS              =  $(addprefix $(pkglibdir)/, $(notdir $(pkglib_SCRIPTS))) \
193                            $(addprefix $(legacydir)/, $(notdir $(legacy_SCRIPTS))) \
194                            $(addprefix $(sbindir)/,   $(notdir $(sbin_SCRIPTS))) \
195                            $(addprefix $(initrddir)/, $(notdir $(initrd_SCRIPTS)))
196
197 update-doc:             doc
198                         $(top_srcdir)/update-doc
199
200 install-data-hook:      install-fix-script-paths install-create-dirs
201
202 install-create-dirs:
203                         $(mkinstalldirs) -m 0755 $(DESTDIR)$(pkgstatedir) $(DESTDIR)$(pkgstatedir).rev $(DESTDIR)$(vshelperstatedir)
204                         $(mkinstalldirs) -m 0700 $(DESTDIR)$(pkgcachedir)
205                         $(mkinstalldirs) -m 0755 $(DESTDIR)$(confdefaultsdir)
206                         f=$(DESTDIR)$(confdefaultsdir)/vdirbase;  test -e "$$f" || ln -sf '$(vserverdir)'      "$$f"
207                         f=$(DESTDIR)$(confdefaultsdir)/cachebase; test -e "$$f" || ln -sf '$(pkgcachedir)'     "$$f"
208                         f=$(DESTDIR)$(pkgstaterevdir);            test -e "$$f" || ln -sf '$(pkgstatedir).rev' "$$f"
209
210 install-fix-script-paths:
211                         test "/usr/lib/util-vserver" = "$(pkglibdir)" || \
212                         for i in $(fix_SCRPTS); do \
213                                 f="$(DESTDIR)$$i"; \
214                                 $(SED) -e 's!/usr/lib/util-vserver!$(pkglibdir)!g' "$$f" >"$$f.tmp"; \
215                                 $(CMP) -s "$$f.tmp" "$$f" || cat "$$f.tmp" >"$$f"; \
216                                 rm -f "$$f.tmp"; \
217                         done
218
219 install-distribution:   _install-vserverdir _install-vshelperlink
220
221 _install-vshelperlink:
222                         $(mkinstalldirs) $(DESTDIR)/sbin
223                         ln -sf ..$(pkglibdir)/vshelper $(DESTDIR)/sbin/vshelper
224
225 _install-vserverdir:
226                         $(mkinstalldirs) $(DESTDIR)$(vserverdir) $(DESTDIR)$(vserverpkgdir)
227
228
229 .fixups:                config.status util-vserver.spec
230                         chmod a-w util-vserver.spec
231                         touch $@
232
233 if USE_DIETLIBC
234 $(addsuffix $(EXEEXT), $(DIETPROGS)) \
235 $(addsuffix $(OBJEXT), $(DIETPROGS)) \
236                 :               CC=$(DIET_CC)
237 else    !USE_DIETLIBC
238 nodist_lib_dietlibc_not_enabled_error_a_SOURCES = \
239                         lib-dietlibc-not-enabled-error.c
240 endif
241
242 include $(top_srcdir)/lib/Makefile-files
243 include $(top_srcdir)/src/Makefile-files
244 include $(top_srcdir)/doc/Makefile-files
245 include $(top_srcdir)/man/Makefile-files
246 include $(top_srcdir)/scripts/Makefile-files
247 include $(top_srcdir)/tests/Makefile-files
248 include $(top_srcdir)/sysv/Makefile-files
249 include $(top_srcdir)/contrib/Makefile-files
250 include $(top_srcdir)/ensc_vector/Makefile-files
251 include $(top_srcdir)/ensc_wrappers/Makefile-files
252 include $(top_srcdir)/ensc_fmt/Makefile-files
253 include $(top_srcdir)/lib_internal/Makefile-files
254 include $(top_srcdir)/vserver-start/Makefile-files
255
256 include $(top_srcdir)/m4/gpgsig.am
257 include $(top_srcdir)/m4/validate.am
258 include $(top_srcdir)/m4/changelog.am
259 include $(top_srcdir)/m4/pkgconfig.am
260 include $(top_srcdir)/m4/libsel.am
261 include $(top_srcdir)/m4/install-notify.am
262
263 .PHONY:         FORCE update-doc