## $Id: Makefile-files,v 1.72 2006/01/22 11:28:00 ensc Exp $  -*- makefile -*-

## Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
##  
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##  
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##  
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##  

src_sbin_CXX_PROGS =	
src_pkglib_CXX_PROGS =	

src_pkglib_C99_PROGS =	src/vunify src/vcopy


AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += \
			src/parserpmdump \
			src/showperm \
			src/vbuild \
			src/vcheck \
			src/vreboot \
			src/save_ctxinfo \
			src/mask2prefix \
			src/ifspec \
			src/rebootmgr \
			src/vfiles

DIETPROGS +=		src/chcontext-compat \
			src/capchroot \
			src/chain-echo \
			src/check-unixfile \
			src/chroot-sh \
			src/filetime \
			src/lockfile \
			src/readlink \
	     		src/secure-mount \
	     		src/save_ctxinfo \
	     		src/mask2prefix \
			src/chbind \
			src/exec-cd \
	     		src/fakerunlevel \
			src/keep-ctx-alive \
			src/exec-ulimit \
			src/vps \
			src/lsxid \
			src/chxid \
			src/reducecap \
			src/showattr \
			src/setattr \
			src/sigexec \
			src/vattribute \
			src/vlimit \
			src/vnamespace \
			src/vunify \
			src/vuname \
			src/rpm-fake-resolver \
			src/vcontext \
			src/vcopy \
			src/vkill \
			src/vsched \
			src/vshelper-sync \
			src/vrsetup \
			src/vserver-stat \
			src/vserver-info \
			src/vdlimit \
			src/vdu \
			src/vwait

if ENSC_CAN_BEECRYPT_WITH_DIETLIBC
DIETPROGS +=		src/vhashify
endif

noinst_HEADERS +=	src/capability-compat.h \
			src/util.h \
			src/fstool.h \
			src/compat-pivot_root.h \
			src/stack-start.h \
			src/vcopy-init.hc \
			src/vunify.h \
			src/vunify-init.hc \
			src/vhashify.h \
			src/vhashify-init.hc \
			src/vserver-visitdir.hc \
			src/context-sync.hc

pkglib_PROGRAMS +=	src/capchroot \
			src/chain-echo \
			src/chcontext-compat \
			src/check-unixfile \
	     		src/chroot-sh \
			src/fakerunlevel \
			src/filetime \
			src/keep-ctx-alive \
			src/lockfile \
			src/readlink \
			src/save_ctxinfo \
			src/secure-mount \
			src/mask2prefix \
			src/exec-ulimit \
			src/rpm-fake-resolver \
			src/vshelper-sync \
			src/sigexec \
			$(src_pkglib_C99_X_PROGS) \
			$(src_pkglib_CXX_X_PROGS)

if ENSC_HAVE_C99_COMPILER
if ENSC_HAVE_BEECRYPT
pkglib_PROGRAMS +=	src/vhashify
endif ENSC_HAVE_BEECRYPT
endif ENSC_HAVE_C99_COMPILER

legacy_PROGRAMS +=	src/ifspec \
			src/listdevip \
			src/parserpmdump \
			src/rebootmgr \
			src/showperm \
			src/vreboot

pkglib_LTLIBRARIES +=	src/rpm-fake.la

sbin_PROGRAMS +=	src/chbind \
			src/exec-cd \
			src/lsxid \
			src/chxid \
			src/vps \
			src/showattr \
			src/setattr \
			src/reducecap \
			src/vdu \
			src/vattribute \
			src/vcontext \
			src/vlimit \
			src/vkill \
			src/vnamespace \
			src/vrsetup \
			src/vsched \
			src/vserver-stat \
			src/vserver-info \
			src/vuname \
			src/vwait \
			$(src_sbin_CXX_X_PROGS)

if ENSC_HAVE_C99_COMPILER
sbin_PROGRAMS +=	src/vdlimit
endif


src_capchroot_SOURCES =		src/capchroot.c
src_capchroot_LDADD =		$(VSERVER_LDADDS)
src_capchroot_LDFLAGS =		$(VSERVER_LDFLGS)

src_chbind_SOURCES =		src/chbind.c
src_chbind_LDADD =		$(VSERVER_LDADDS)
src_chbind_LDFLAGS =		$(VSERVER_LDFLGS)

src_chcontext_compat_SOURCES =	src/chcontext.c
src_chcontext_compat_LDADD =	$(VSERVER_LDADDS) $(LIBINTERNAL)
src_chcontext_compat_LDFLAGS =	$(VSERVER_LDFLGS)

src_vcontext_SOURCES		=  src/vcontext.c
src_vcontext_LDADD		=  $(VSERVER_LDADDS) $(LIBINTERNAL)
src_vcontext_LDFLAGS		=  $(VSERVER_LDFLGS)

src_vsched_SOURCES		=  src/vsched.c
src_vsched_LDADD		=  $(VSERVER_LDADDS)
src_vsched_LDFLAGS		=  $(VSERVER_LDFLGS)

src_filetime_SOURCES		=  src/filetime.c
src_filetime_LDADD		=  $(VSERVER_LDADDS)
src_filetime_LDFLAGS		=  $(VSERVER_LDFLGS)

src_chain_echo_SOURCES		=  src/chain-echo.c
src_chroot_sh_SOURCES		=  src/chroot-sh.c
src_exec_cd_SOURCES		=  src/exec-cd.c
src_fakerunlevel_SOURCES	=  src/fakerunlevel.c
src_ifspec_SOURCES		=  src/ifspec.c
src_listdevip_SOURCES		=  src/listdevip.c
src_lockfile_SOURCES		=  src/lockfile.c
src_parserpmdump_SOURCES	=  src/parserpmdump.c
src_readlink_SOURCES		=  src/readlink.c
src_rebootmgr_SOURCES		=  src/rebootmgr.c
src_exec_ulimit_SOURCES		=  src/exec-ulimit.c
src_vshelper_sync_SOURCES	=  src/vshelper-sync.c

src_reducecap_SOURCES		=  src/reducecap.c
src_reducecap_LDADD		=  $(VSERVER_LDADDS)
src_reducecap_LDFLAGS		=  $(VSERVER_LDFLGS)

src_vkill_SOURCES		=  src/vkill.c
src_vkill_LDADD			=  $(VSERVER_LDADDS)
src_vkill_LDFLAGS		=  $(VSERVER_LDFLGS)
src_vkill_CPPFLAGS		=  $(AM_CPPFLAGS) -DLEGACYDIR=\"$(legacydir)\"

src_vlimit_SOURCES		=  src/vlimit.c
src_vlimit_LDADD		=  $(VSERVER_LDADDS)
src_vlimit_LDFLAGS		=  $(VSERVER_LDFLGS)

src_save_ctxinfo_SOURCES	=  src/save_ctxinfo.c
src_save_ctxinfo_LDADD		=  $(VSERVER_LDADDS)
src_save_ctxinfo_LDFLAGS	=  $(VSERVER_LDFLGS)

src_vdu_SOURCES 		=  src/vdu.c
src_vdu_LDADD			=  $(VSERVER_LDADDS) $(LIBINTERNAL)
src_vdu_LDFLAGS			=  $(VSERVER_LDFLGS)

src_vreboot_SOURCES =		src/vreboot.c

src_secure_mount_SOURCES =	src/secure-mount.c
src_secure_mount_LDADD =	$(VSERVER_LDADDS)
src_secure_mount_LDFLAGS =	$(VSERVER_LDFLGS)

src_vattribute_SOURCES =	src/vattribute.c
src_vattribute_LDADD =		$(VSERVER_LDADDS)
src_vattribute_LDFLAGS =	$(VSERVER_LDFLGS)

src_vnamespace_SOURCES =	src/vnamespace.c
src_vnamespace_LDADD =		$(VSERVER_LDADDS) $(LIBINTERNAL)
src_vnamespace_LDFLAGS =	$(VSERVER_LDFLGS)

src_rpm_fake_resolver_SOURCES	=  src/rpm-fake-resolver.c
src_rpm_fake_resolver_LDADD	=  $(VSERVER_LDADDS)
src_rpm_fake_resolver_LDFLAGS	=  $(VSERVER_LDFLGS)

src_mask2prefix_SOURCES		=  src/mask2prefix.c

src_vps_SOURCES			=  src/vps.c
src_vps_LDADD			=  $(LIBINTERNAL) $(VSERVER_LDADDS)
src_vps_LDFLAGS			=  $(VSERVER_LDFLGS)

src_vserver_info_SOURCES	=  src/vserver-info.c
src_vserver_info_LDADD		=  $(LIBINTERNAL) $(VSERVER_LDADDS)
src_vserver_info_LDFLAGS	=  $(VSERVER_LDFLGS)

src_vserver_stat_SOURCES	=  src/vserver-stat.c
src_vserver_stat_LDADD		=  $(LIBINTERNAL) $(VSERVER_LDADDS) $(LIBENSCVECTOR)
src_vserver_stat_LDFLAGS	=  $(VSERVER_LDFLGS)

src_lsxid_SOURCES		=  src/fstool.c src/lsxid.c
src_lsxid_LDADD			=  $(LIBINTERNAL) $(VSERVER_LDADDS) $(LIBENSCVECTOR)
src_lsxid_LDFLAGS		=  $(VSERVER_LDFLGS) 

src_chxid_SOURCES		=  src/fstool.c src/chxid.c
src_chxid_LDADD			=  $(LIBINTERNAL) $(VSERVER_LDADDS)
src_chxid_LDFLAGS		=  $(VSERVER_LDFLGS)

src_showattr_SOURCES		=  src/fstool.c src/showattr.c
src_showattr_LDADD		=  $(LIBINTERNAL) $(VSERVER_LDADDS)
src_showattr_LDFLAGS		=  $(VSERVER_LDFLGS)

src_setattr_SOURCES		=  src/fstool.c src/setattr.c
src_setattr_LDADD		=  $(LIBINTERNAL) $(VSERVER_LDADDS)
src_setattr_LDFLAGS		=  $(VSERVER_LDFLGS)

src_keep_ctx_alive_SOURCES =	src/keep-ctx-alive.c
src_keep_ctx_alive_LDADD =	$(VSERVER_LDADDS)
src_keep_ctx_alive_LDFLAGS =	$(VSERVER_LDFLGS)


src_vcopy_SOURCES =		src/vcopy.c
src_vcopy_LDADD =		$(LIBINTERNAL) $(VSERVER_LDADDS)
src_vcopy_LDFLAGS =		$(VSERVER_LDFLGS)

src_vunify_SOURCES =		src/vunify.c
src_vunify_LDADD =		$(LIBINTERNAL) $(VSERVER_LDADDS)
src_vunify_LDFLAGS =		$(VSERVER_LDFLGS)

src_vhashify_SOURCES =		src/vhashify.c
if ENSC_CAN_BEECRYPT_WITH_DIETLIBC
src_vhashify_LDADD =		$(LIBINTERNAL) $(LIBENSCVECTOR) -lbeecrypt $(VSERVER_LDADDS)
src_vhashify_LDFLAGS =		$(VSERVER_LDFLGS)
else
src_vhashify_LDADD =		$(LIBINTERNAL_GLIBC) $(LIBENSCVECTOR_GLIBC) $(LIBVSERVER_GLIBC) -lbeecrypt
src_vhashify_LDFLAGS =
endif

src_vuname_SOURCES =		src/vuname.c
src_vuname_LDADD =		$(VSERVER_LDADDS)
src_vuname_LDFLAGS =		$(VSERVER_LDFLGS)

src_rpm_fake_la_SOURCES		=  src/rpm-fake.c
src_rpm_fake_la_CFLAGS		=  $(AM_CFLAGS)
src_rpm_fake_la_LDFLAGS		=  -module -avoid-version -rpath $(pkglibdir)
src_rpm_fake_la_LIBADD		=  $(LIBVSERVER_GLIBC) -ldl

src_vdlimit_SOURCES		= src/vdlimit.c
src_vdlimit_LDADD		= $(VSERVER_LDADDS)
src_vdlimit_LDFLAGS		= $(VSERVER_LDFLGS)

src_vwait_SOURCES		= src/vwait.c
src_vwait_LDADD			= $(VSERVER_LDADDS)
src_vwait_LDFLAGS		= $(VSERVER_LDFLGS)

EXTRA_PROGRAMS +=		$(src_sbin_CXX_PROGS) $(src_pkglib_CXX_PROGS)

TESTS_ENVIRONMENT +=		srctestsuitedir=$(top_builddir)/src/testsuite

if ENSC_HAVE_C99_COMPILER
src_sbin_C99_X_PROGS =		$(src_sbin_C99_PROGS)
src_pkglib_C99_X_PROGS =	$(src_pkglib_C99_PROGS)
else
src_sbin_C99_X_PROGS =
src_pkglib_C99_X_PROGS =  
endif

if ENSC_HAVE_CXX_COMPILER
src_sbin_CXX_X_PROGS =		$(src_sbin_CXX_PROGS)
src_pkglib_CXX_X_PROGS =	$(src_pkglib_CXX_PROGS)
else
src_sbin_CXX_X_PROGS =
src_pkglib_CXX_X_PROGS =  
endif

install-exec-hook:		src_install_exec_hook

src_install_exec_hook:
				-rm -f $(DESTDIR)$(pkglibdir)/rpm-fake.a $(DESTDIR)$(pkglibdir)/rpm-fake.la

include $(top_srcdir)/src/testsuite/Makefile-files
