Hi,

I've rearranged Makefile for setgid test case.

I've put _16 related macros to compat_16.mk file.
The original Makefile includes it. So when I work
on more _16 test cases, I just have to do the same.

I'll do the same on _64.

I hope you put compat_16.mk at ltp/testcases/kernel/syscalls or
something like ltp/testcases/kernel/syscalls/common because there
are manyh _16 and _64 system calls. I don't want to make many copies.


Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]>

<compat_16.mk>
#
#  Copyright (c) Red Hat Inc., 2008
#
#  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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

# Author: Masatake YAMATO <[EMAIL PROTECTED]>
# Technique used here is suggested by Garrett Cooper <[EMAIL PROTECTED]>

# Usage:
# 
# This makefile snippet is for writing test cases
# for foo16 system calls. Here I assume you already have 
# test cases for foo like foo01, foo02.. fooN and I also 
# assume the source file name for fooN is fooN.c.
# On the above assumption, this file does:
# 
# * adding fooN_16 as TARGETS, 
# * making *.c depend on compat_16.h if the header file exists,
# * adding rules to build fooN_16 from fooN.c (and compat_16.h), and
# * passing a cpp symbol TST_USE_COMPAT16_SYSCALL to 
#   CC when building fooN_16.
#
#
# You can use this file in following procedures:
# 
# 1. write fooN.c.
# 2. add the code for 16 bit syscall and wrap
#    it #ifdef TST_USE_COMPAT16_SYSCALL/endif.
# 3. introduce your own compat_16.h if the ifdef 
#    block is too large.
# 4. don't forget putting compat_16.h in all fooN.c
#    if you introduced compat_16.h.


TARGETS_16 = $(patsubst %.c,%_16,$(SRCS))
TARGETS  +=  $(TARGETS_16)

DEF_16 = TST_USE_COMPAT16_SYSCALL
COMPAT_16_H = compat_16.h
HAS_COMPAT_16 := $(shell if [ -f $(COMPAT_16_H) ]; then \
                                echo yes;               \
                        else                            \
                                echo no;                \
                        fi)


ifeq ($(HAS_COMPAT_16),yes)
%.c: $(COMPAT_16_H)
endif

%_16.o: %.c
        $(COMPILE.c) $(OUTPUT_OPTION) $<
%_16: CFLAGS += -D$(DEF_16)=1



Index: testcases/kernel/syscalls/setgid/Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/setgid/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- testcases/kernel/syscalls/setgid/Makefile   20 Aug 2008 10:55:21 -0000      
1.10
+++ testcases/kernel/syscalls/setgid/Makefile   22 Aug 2008 03:16:00 -0000
@@ -19,13 +19,10 @@
 CFLAGS += -I../../../../include -Wall
 LDLIBS += -L../../../../lib -lltp
 
-SRCS    = $(wildcard *.c) 
-TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%_16,$(SRCS))
+include compat_16.mk
 
-%.c: compat_16.h
-%_16.o: %.c
-       $(COMPILE.c) $(OUTPUT_OPTION) $<
-%_16: CFLAGS += -DTST_USE_COMPAT16_SYSCALL=1
+SRCS    = $(wildcard *.c) 
+TARGETS += $(patsubst %.c,%,$(SRCS))
 
 
 all: $(TARGETS)

-------------------------------------------------------------------------
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

Reply via email to