Subrata Modak wrote: > On Thu, 2008-09-04 at 15:49 -0500, Serge E. Hallyn wrote: > >> Quoting Matt Helsley ([EMAIL PROTECTED]): >> >>> Now that we have proper dependencies on check_for_unshare we take explicit >>> tests >>> for unshare out of the top-level make file and distribute to each subdir >>> Makefile as ifeq...endif sections which control which targets to build. >>> While it doesn't avoid descending into subdirs it's easier to read and >>> check the >>> make code when most of the build rules don't have shell flow control. >>> >>> Even better if we could change the contents of SUBDIRS based on the results >>> of >>> running check_for_unshare. >>> >>> Also note the use of := and not =. info Make is our friend. >>> >>> Signed-off-by: Matt Helsley <[EMAIL PROTECTED]> >>> >> I'll take your word for this one. Though wouldn't it be better to just >> set SUBDIRS := \n in the containers/Makefile if not HAS_UNSHARE? Keeps >> the rest of the Makefiles simpler and particularly simplifies Makefiles >> for any future directories... >> >> But I'll assume this works. >> >> Acked-by: Serge Hallyn <[EMAIL PROTECTED]> >> > > Merged-By: Subrata Modak <[EMAIL PROTECTED]> > > >>> Cc: Veerendra Chandrappa <[EMAIL PROTECTED]> >>> Cc: Sudhir Kumar15 <[EMAIL PROTECTED]> >>> Cc: Subrata Modak <[EMAIL PROTECTED]> >>> Cc: Serge E. Hallyn <[EMAIL PROTECTED]> >>> --- >>> testcases/kernel/containers/Makefile | 10 +++------- >>> testcases/kernel/containers/libclone/Makefile | 10 ++++++++-- >>> testcases/kernel/containers/pidns/Makefile | 8 +++++++- >>> testcases/kernel/containers/sysvipc/Makefile | 5 +++++ >>> testcases/kernel/containers/utsname/Makefile | 5 +++++ >>> 5 files changed, 28 insertions(+), 10 deletions(-) >>> >>> Index: ltp-intermediate-20080820/testcases/kernel/containers/Makefile >>> =================================================================== >>> --- ltp-intermediate-20080820.orig/testcases/kernel/containers/Makefile >>> +++ ltp-intermediate-20080820/testcases/kernel/containers/Makefile >>> @@ -21,9 +21,7 @@ >>> SUBDIRS = libclone utsname sysvipc pidns >>> >>> all: check_for_unshare >>> - @set -e; if './check_for_unshare' > /dev/null 2>&1; then \ >>> - for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done \ >>> - else echo "system does not support unshare"; true; fi >>> + @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done >>> >>> noltp noltp_check: check_for_unshare >>> @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done >>> @@ -34,10 +32,8 @@ check_for_unshare: check_for_unshare.c >>> install: check_for_unshare >>> @set -e; ln -f check_for_unshare ../../bin/check_for_unshare; \ >>> ln -f container_test.sh ../../bin/container_test.sh; \ >>> - if './check_for_unshare' > /dev/null 2>&1; then \ >>> - for i in $(SUBDIRS); do $(MAKE) -C $$i $@ ; done; \ >>> - chmod ugo+x container_test.sh; \ >>> - else echo "system does not support unshare"; true; fi >>> + for i in $(SUBDIRS); do $(MAKE) -C $$i $@ ; done; \ >>> + chmod ugo+x container_test.sh >>> >>> clean: >>> @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@ ; done >>> Index: >>> ltp-intermediate-20080820/testcases/kernel/containers/libclone/Makefile >>> =================================================================== >>> --- >>> ltp-intermediate-20080820.orig/testcases/kernel/containers/libclone/Makefile >>> +++ ltp-intermediate-20080820/testcases/kernel/containers/libclone/Makefile >>> @@ -18,13 +18,19 @@ >>> ## >>> ## >>> >>> ################################################################################ >>> >>> -TARGET=libclone.a >>> SRCS=$(wildcard *.c) >>> OBJS=$(patsubst %.c,%.o,$(SRCS)) >>> >>> +HAS_UNSHARE ?= $(shell ../check_for_unshare && echo y) >>> +ifeq ($(HAS_UNSHARE),y) >>> +TARGET := libclone.a >>> +else >>> +TARGET := >>> +endif >>> + >>> all noltp : $(TARGET) >>> >>> -$(TARGET): $(OBJS) >>> +libclone.a: $(OBJS) >>> $(AR) -cr $@ $^ >>> >>> clean: >>> Index: ltp-intermediate-20080820/testcases/kernel/containers/pidns/Makefile >>> =================================================================== >>> --- >>> ltp-intermediate-20080820.orig/testcases/kernel/containers/pidns/Makefile >>> +++ ltp-intermediate-20080820/testcases/kernel/containers/pidns/Makefile >>> @@ -23,10 +23,16 @@ CPPFLAGS += -I../../../../include -I../l >>> LDLIBS += -L../../../../lib -L../libclone ../libclone/libclone.a -lltp >>> >>> SRCS = $(wildcard *.c) >>> -NOLTPSRCS = pidns01.c pidns02.c pidns03.c >>> TARGETS = $(patsubst %.c,%,$(SRCS)) >>> + >>> +NOLTPSRCS = pidns01.c pidns02.c pidns03.c >>> NOLTP_TARGETS = $(patsubst %.c,%_noltp,$(NOLTPSRCS)) >>> >>> +HAS_UNSHARE ?= $(shell ../check_for_unshare && echo y) >>> +ifneq ($(HAS_UNSHARE),y) >>> +TARGETS := >>> +endif >>> + >>> %_noltp : %.c >>> $(CC) -g -DNO_LTP -o $@ $< ../libclone/libclone.a >>> >>> Index: >>> ltp-intermediate-20080820/testcases/kernel/containers/sysvipc/Makefile >>> =================================================================== >>> --- >>> ltp-intermediate-20080820.orig/testcases/kernel/containers/sysvipc/Makefile >>> +++ ltp-intermediate-20080820/testcases/kernel/containers/sysvipc/Makefile >>> @@ -25,6 +25,11 @@ SRCS = $(wildcard *.c) >>> TARGETS = $(patsubst %.c,%,$(SRCS)) >>> NOLTP_TARGETS = $(patsubst %.c,%_noltp,$(SRCS)) >>> >>> +HAS_UNSHARE ?= $(shell ../check_for_unshare && echo y) >>> +ifneq ($(HAS_UNSHARE),y) >>> +TARGETS := >>> +endif >>> + >>> %_noltp : %.c >>> $(CC) -g -DNO_LTP -o $@ $< ../libclone/libclone.a >>> >>> Index: >>> ltp-intermediate-20080820/testcases/kernel/containers/utsname/Makefile >>> =================================================================== >>> --- >>> ltp-intermediate-20080820.orig/testcases/kernel/containers/utsname/Makefile >>> +++ ltp-intermediate-20080820/testcases/kernel/containers/utsname/Makefile >>> @@ -27,6 +27,11 @@ NOLTPSRCS = utstest.c >>> TARGETS = $(patsubst %.c,%,$(SRCS)) >>> NOLTP_TARGETS = $(patsubst %.c,%_noltp,$(NOLTPSRCS)) >>> >>> +HAS_UNSHARE ?= $(shell ../check_for_unshare && echo y) >>> +ifneq ($(HAS_UNSHARE),y) >>> +TARGETS := >>> +endif >>> + >>> %_noltp : %.c >>> $(CC) -g -DNO_LTP -o $@ $< ../libclone/libclone.a >>> >>> >>> -- >>> > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Ltp-list mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ltp-list > > Subrata/Matt,
I am trying to verify the latest container code downloaded from the CVS repo of LTP. On my latest kernel supporting the sys_unshare. ( 2.6.27-rc2) The check_for_unshare was failing for me and I had to include the header file to make this work. #include "libclone/libclone.h" Now it worked fine .. [EMAIL PROTECTED] pidns]# ../check_for_unshare && echo $? 0 But due to the below Makefile changes, no subdir's are compiling ! HAS_UNSHARE ?= $(shell ../check_for_unshare && echo y) ifneq ($(HAS_UNSHARE),y) TARGETS := endif Suppose if I give a specific binary to create explictly , as below it works ! # not generating any binaries [EMAIL PROTECTED] pidns]# ls check_pidns_enabled.c Makefile pidns01.c pidns02.c pidns03.c README runpidnstest.sh runtests_noltp.sh [EMAIL PROTECTED] pidns]# make make: Nothing to be done for `all'. [EMAIL PROTECTED] pidns]# echo $? 0 # Now the pidns01 is generated [EMAIL PROTECTED] pidns]# make pidns01 cc -Wall -I../../../../include -I../libclone pidns01.c -L../../../../lib -L../libclone ../libclone/libclone.a -lltp -o pidns01 [EMAIL PROTECTED] pidns]# ls check_pidns_enabled.c Makefile *pidns01* pidns01.c pidns02.c pidns03.c README runpidnstest.sh runtests_noltp.sh Regards Veerendra C ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
