generalized building with dietlibc
[util-vserver.git] / util-vserver / Makefile.am
1 ## $Id$
2
3 # Copyright (C) 2003 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
24 CVS2CL_ALLFLAGS        :=  $(CVS2CL_AMFLAGS) $(CVS2CL_FLAGS)
25
26 sysvdir                 =  $(sysconfdir)/init.d
27 confdir                 =  $(sysconfdir)/vservers
28
29 include_HEADERS         =  $(lib_HDRS)
30 noinst_HEADERS          =  $(src_HDRS) $(lib_XHDRS) compat.h
31
32 lib_LIBRARIES           =  $(lib_lib_LIBS)
33
34 pkglib_SCRIPTS          =  $(scripts_SCRPTS)
35 pkglib_DATA             =  $(scriptscfg_DATA) $(scripts_DTA)
36 pkglib_PROGRAMS         =  $(src_pkglib_PRGS)
37
38 sbin_SCRIPTS            =  $(scripts_PRGS)
39 sbin_PROGRAMS           =  $(src_sbin_PRGS)
40 noinst_PROGRAMS         =  $(test_PRGS)
41
42 sysv_SCRIPTS            =  $(sysv_SCRPTS)
43 sysconf_DATA            =  $(sysv_CFG)
44
45 DIETPROGS               =  $(src_DIETPROGS) $(tests_DIETPROGS)
46
47 BUILT_SOURCES           =  linuxcaps.h pathconfig.h linuxvirtual.h
48
49 man_MANS                =  $(man_DATMAN)
50
51 EXTRA_DIST              =  $(sysv_XTRAS) $(sysv_CFG) \
52                            $(doc_DAT) $(man_DATMAN) \
53                            $(scripts_SCRPTS) $(scripts_PRGS) $(scripts_XTRAS) \
54                            pathconfig.h.pathsubst \
55                            util-vserver.spec \
56                            m4/ensc_cflags.m4 \
57                            THANKS
58
59 AM_CPPFLAGS             =  -I $(top_srcdir)/lib -D _GNU_SOURCE
60 AM_CFLAGS               =  -Wall -pedantic
61
62 CLEANFILES              =  $(sysv_GENSCRPTS) $(scripts_GENSCRPTS) $(BUILT_SOURCES) \
63                            .*.pathsubst.stamp */.*.pathsubst.stamp \
64                            linuxcaps.h pathconfig.h
65
66 if USE_DIETLIBC
67 DIET                    =  diet
68 DIET_FLAGS              =
69 DIET_CC                :=  $(DIET) $(DIET_FLAGS) $(CC)
70 endif
71
72 linuxcaps.h:
73                         ln -sf ${kernelincludedir}/linux/capability.h linuxcaps.h
74
75 linuxvirtual.h:
76                         ln -sf '$(kernelincludedir)/linux/virtual.h' '$@' && test -e '$@' || \
77                         ln -sf '$(top_srcdir)/lib/virtual.h' '$@'
78
79 pathconfig.h:           .pathconfig.h.pathsubst.stamp
80 .%.pathsubst.stamp:     %.pathsubst Makefile
81                         @mkdir -p $$(dirname '$@')
82                         @echo "sed -e '...' $*.pathsubst >$*"
83                         @sed -e 's!@'PKGLIBDIR'@!$(pkglibdir)!g; \
84                                 s!@'SBINDIR'@!$(sbindir)!g; \
85                                 s!@'CONFDIR'@!$(confdir)!g; \
86                                 s!@'SYSCONFDIR'@!$(sysconfdir)!g; \
87                                 s!@'PACKAGE'@!$(PACKAGE)!g; \
88                                 s!@'PACKAGE_BUGREPORT'@!$(PACKAGE_BUGREPORT)!g; \
89                                 s!@'PACKAGE_NAME'@!$(PACKAGE_NAME)!g; \
90                                 s!@'PACKAGE_STRING'@!$(PACKAGE_STRING)!g; \
91                                 s!@'PACKAGE_TARNAME'@!$(PACKAGE_TARNAME)!g; \
92                                 s!@'PACKAGE_VERSION'@!$(PACKAGE_VERSION)!g; \
93                                 s!@'AWK'@!$(AWK)!g; \
94                                 s!@'GREP'@!$(GREP)!g; \
95                                 s!@'IP'@!$(IP)!g; \
96                                 s!@'MOUNT'@!$(MOUNT)!g; \
97                                 s!@'UMOUNT'@!$(UMOUNT)!g; \
98                                 s!@'NICE'@!$(NICE)!g; \
99                                 s!@'VCONFIG'@!$(VCONFIG)!g; \
100                                 s!@'WC'@!$(WC)!g; \
101                                ' '$<' >'$@.tmp'
102                         @if cmp -s '$@.tmp' '$*'; then \
103                                 echo "... no changes, reusing old version"; \
104                                 rm -f '$@.tmp'; \
105                         else \
106                                 rm -f '$*'; mv '$@.tmp' '$*'; \
107                         fi
108                         @chmod a-w '$*'
109                         @touch '$@'
110
111 install-data-local:
112                         $(INSTALL) -d -m755 $(DESTDIR)$(localstatedir)/run/vservers
113
114 if USE_DIETLIBC
115 $(addsuffix $(EXEEXT), $(DIETPROGS)) \
116 $(addsuffix $(OBJEXT), $(DIETPROGS)) \
117                 :               CC=$(DIET_CC)
118 endif
119
120 include $(top_srcdir)/lib/Makefile-files
121 include $(top_srcdir)/src/Makefile-files
122 include $(top_srcdir)/doc/Makefile-files
123 include $(top_srcdir)/man/Makefile-files
124 include $(top_srcdir)/scripts/Makefile-files
125 include $(top_srcdir)/tests/Makefile-files
126 include $(top_srcdir)/sysv/Makefile-files
127
128 include $(top_srcdir)/m4/gpgsig.am
129 include $(top_srcdir)/m4/validate.am
130 include $(top_srcdir)/m4/changelog.am
131 include $(top_srcdir)/m4/pkgconfig.am