public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH RFC v2] change MAKE_TARGETS's dependency to normal prerequisites and order-only prerequisites
@ 2014-05-15  9:43 Xiaoguang Wang
  2014-05-19 12:34 ` chrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaoguang Wang @ 2014-05-15  9:43 UTC (permalink / raw)
  To: ltp-list

See the below issue:
  When we made modifications to source files in lib/, for example lib/tst_mkfs.c, then
  back to testcases/kernel/syscalls/access and execute 'make'. This will not make the
  access[0-5] to be re-linked with the newly generated libltp.a, we need to touch
  access[0-5].c or remove access[0-5] files first, then make. This will make no sense.
  Users may expect just a make command to ensure a new access[0-5] generated with the
  new libltp.a.

This is because in 'include/mk/generic_leaf_target.inc', MAKE_TARGETS's dependency is
order-only prerequisites, not normal prerequisites, so we change lib's dependency type
to normal prerequisites, not order-only prerequisites.

The original MAKE_DEPS is replaced by MAKE_NORMAL_DEPS or MAKE_ORDER_ONLY_DEPS.

And fix some small bugs:
  In testcases/kernel/include/lib.mk, '$(KERNEL_DIR)/libkerntest.a' is not a
valid path, the correct path is '$(KERNEL_DIR)/lib/libkerntest.a'.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 include/mk/generic_leaf_target.inc                      |  2 +-
 include/mk/generic_trunk_target.inc                     |  2 +-
 include/mk/testcases.mk                                 |  3 ++-
 testcases/kernel/Makefile                               |  2 +-
 testcases/kernel/containers/Makefile                    |  2 +-
 testcases/kernel/containers/Makefile.inc                |  2 +-
 testcases/kernel/controllers/Makefile                   |  2 +-
 testcases/kernel/controllers/Makefile.inc               | 15 ++++++++-------
 testcases/kernel/controllers/cpuset/Makefile            |  2 +-
 testcases/kernel/controllers/cpuset/Makefile.inc        |  2 +-
 testcases/kernel/include/lib.mk                         |  4 ++--
 testcases/kernel/mem/hugetlb/Makefile                   |  2 +-
 testcases/kernel/mem/hugetlb/Makefile.inc               |  2 +-
 testcases/kernel/mem/include/libmem.mk                  |  2 +-
 testcases/kernel/power_management/Makefile              |  2 +-
 testcases/kernel/syscalls/ipc/Makefile                  |  2 +-
 testcases/kernel/syscalls/ipc/Makefile.inc              |  2 +-
 testcases/kernel/syscalls/ipc/msgctl/Makefile           |  2 +-
 testcases/kernel/syscalls/kill/Makefile                 |  2 +-
 testcases/kernel/syscalls/mremap/Makefile               |  2 +-
 testcases/network/rpc/basic_tests/rpc01/Makefile        |  2 +-
 testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc |  2 +-
 testcases/network/tcp_cmds/Makefile.inc                 |  4 ++--
 23 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/include/mk/generic_leaf_target.inc b/include/mk/generic_leaf_target.inc
index a88586f..71c8a07 100644
--- a/include/mk/generic_leaf_target.inc
+++ b/include/mk/generic_leaf_target.inc
@@ -92,7 +92,7 @@
 
 .PHONY: all clean install
 
-$(MAKE_TARGETS): | $(MAKE_DEPS)
+$(MAKE_TARGETS): $(MAKE_NORMAL_DEPS) | $(MAKE_ORDER_ONLY_DEPS)
 
 all: $(MAKE_TARGETS)
 
diff --git a/include/mk/generic_trunk_target.inc b/include/mk/generic_trunk_target.inc
index c49e3c6..994e7c0 100644
--- a/include/mk/generic_trunk_target.inc
+++ b/include/mk/generic_trunk_target.inc
@@ -57,7 +57,7 @@ $(eval $(get_make_dirs))
 $(SUBDIRS): %:
 	mkdir -m 00755 -p "$@"
 
-$(MAKE_TARGETS): | $(MAKE_DEPS)
+$(MAKE_TARGETS): $(MAKE_NORMAL_DEPS) | $(MAKE_ORDER_ONLY_DEPS)
 
 trunk-all: $(MAKE_TARGETS)
 
diff --git a/include/mk/testcases.mk b/include/mk/testcases.mk
index ea26d4f..6ab587b 100644
--- a/include/mk/testcases.mk
+++ b/include/mk/testcases.mk
@@ -42,7 +42,8 @@ $(LIBLTP): $(LIBLTP_DIR)
 $(LSN_H): $(abs_top_builddir)/$(TKI_DIR)
 	$(MAKE) -C "$^" -f "$(abs_top_srcdir)/$(TKI_DIR)/Makefile" all
 
-MAKE_DEPS	:= $(LIBLTP) $(LSN_H)
+MAKE_ORDER_ONLY_DEPS	:= $(LSN_H)
+MAKE_NORMAL_DEPS	:= $(LIBLTP)
 
 # For linux_syscall_numbers.h
 CPPFLAGS	+= -I$(abs_top_builddir)/$(TKI_DIR)
diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
index 50a12fa..0460827 100644
--- a/testcases/kernel/Makefile
+++ b/testcases/kernel/Makefile
@@ -60,7 +60,7 @@ endif
 
 endif
 
-MAKE_DEPS		:= include/linux_syscall_numbers.h
+MAKE_NORMAL_DEPS	:= include/linux_syscall_numbers.h
 
 include:
 	mkdir -p "$@"
diff --git a/testcases/kernel/containers/Makefile b/testcases/kernel/containers/Makefile
index 6620ed9..eafbfd1 100644
--- a/testcases/kernel/containers/Makefile
+++ b/testcases/kernel/containers/Makefile
@@ -38,7 +38,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$(LIBDIR)/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/containers/Makefile.inc b/testcases/kernel/containers/Makefile.inc
index 0750f50..ae90a1a 100644
--- a/testcases/kernel/containers/Makefile.inc
+++ b/testcases/kernel/containers/Makefile.inc
@@ -40,6 +40,6 @@ $(LIBS): $(LIBDIR)
 
 INSTALL_TARGETS		?= *.sh
 
-MAKE_DEPS		:= $(LIBS)
+MAKE_NORMAL_DEPS	:= $(LIBS)
 
 # vim: syntax=make
diff --git a/testcases/kernel/controllers/Makefile b/testcases/kernel/controllers/Makefile
index 80e5e9e..9d38531 100644
--- a/testcases/kernel/controllers/Makefile
+++ b/testcases/kernel/controllers/Makefile
@@ -35,7 +35,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/controllers/Makefile.inc b/testcases/kernel/controllers/Makefile.inc
index b106283..6790035 100644
--- a/testcases/kernel/controllers/Makefile.inc
+++ b/testcases/kernel/controllers/Makefile.inc
@@ -22,20 +22,21 @@
 
 # DO NOT USE THIS FILE FOR controllers / libcontrollers!!!
 
-LIBDIR			:= libcontrollers
+LIBCONTROLLER_SRCDIR	:= $(abs_top_srcdir)/testcases/kernel/controllers/libcontrollers
+LIBDIR			:= $(abs_top_builddir)/testcases/kernel/controllers/libcontrollers
 LIB			:= $(LIBDIR)/libcontrollers.a
 
-../$(LIBDIR):
+$(LIBDIR):
 	mkdir -p "$@"
 
-$(LIB): ../$(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+$(LIB): $(LIBDIR)
+	$(MAKE) -C $^ -f $(LIBCONTROLLER_SRCDIR)/Makefile all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
-CPPFLAGS		+= -I$(abs_srcdir)/../$(LIBDIR)
+CPPFLAGS		+= -I$(LIBCONTROLLER_SRCDIR)
 
-LDFLAGS			+= -L$(abs_builddir)/../$(LIBDIR)
+LDFLAGS			+= -L$(LIBDIR)
 
 INSTALL_TARGETS		?= *.sh
 
diff --git a/testcases/kernel/controllers/cpuset/Makefile b/testcases/kernel/controllers/cpuset/Makefile
index d988d0c..c265118 100644
--- a/testcases/kernel/controllers/cpuset/Makefile
+++ b/testcases/kernel/controllers/cpuset/Makefile
@@ -35,7 +35,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/controllers/cpuset/Makefile.inc b/testcases/kernel/controllers/cpuset/Makefile.inc
index 9e002f4..332b2bf 100644
--- a/testcases/kernel/controllers/cpuset/Makefile.inc
+++ b/testcases/kernel/controllers/cpuset/Makefile.inc
@@ -37,7 +37,7 @@ $(LIBCONTROLLERS): $(LIBCONTROLLERS_DIR)
 $(LIBCPUSET): $(LIBCPUSET_DIR) | $(LIBCONTROLLERS)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIBCONTROLLERS) $(LIBCPUSET)
+MAKE_NORMAL_DEPS	:= $(LIBCONTROLLERS) $(LIBCPUSET)
 
 LDFLAGS			+= -L$(abs_builddir)/$(LIBCPUSET_DIR) -L$(abs_builddir)/$(LIBCONTROLLERS_DIR)
 
diff --git a/testcases/kernel/include/lib.mk b/testcases/kernel/include/lib.mk
index c193ca3..7a1c85b 100644
--- a/testcases/kernel/include/lib.mk
+++ b/testcases/kernel/include/lib.mk
@@ -21,7 +21,7 @@ LIBKERNTEST_SRCDIR	:= $(KERNEL_SRCDIR)/lib
 
 KERNEL_DIR		:= $(abs_top_builddir)/testcases/kernel
 LIBKERNTEST_DIR		:= $(KERNEL_DIR)/lib
-LIBKERNTEST		:= $(KERNEL_DIR)/libkerntest.a
+LIBKERNTEST		:= $(LIBKERNTEST_DIR)/libkerntest.a
 CPPFLAGS		+= $(NUMA_CPPFLAGS) -I$(KERNEL_SRCDIR)/include
 LDLIBS			+= $(NUMA_LIBS) -lkerntest -lltp
 LDFLAGS			+= -L$(LIBKERNTEST_DIR)
@@ -32,7 +32,7 @@ $(LIBKERNTEST_DIR):
 $(LIBKERNTEST): $(LIBKERNTEST_DIR)
 	$(MAKE) -C $^ -f "$(LIBKERNTEST_SRCDIR)/Makefile" all
 
-MAKE_DEPS		+= $(LIBKERNTEST)
+MAKE_NORMAL_DEPS	+= $(LIBKERNTEST)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/mem/hugetlb/Makefile b/testcases/kernel/mem/hugetlb/Makefile
index 1e8f8f8..0fbc0dd 100644
--- a/testcases/kernel/mem/hugetlb/Makefile
+++ b/testcases/kernel/mem/hugetlb/Makefile
@@ -30,7 +30,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/mem/hugetlb/Makefile.inc b/testcases/kernel/mem/hugetlb/Makefile.inc
index cc0ada6..6b7983f 100644
--- a/testcases/kernel/mem/hugetlb/Makefile.inc
+++ b/testcases/kernel/mem/hugetlb/Makefile.inc
@@ -32,7 +32,7 @@ $(LIBIPC): $(LIBIPCDIR)
 CPPFLAGS		+= -I$(abs_srcdir)/$(LIBIPCDIR)
 LDFLAGS			+= -L$(abs_builddir)/$(LIBIPCDIR)
 LDLIBS			+= -lipc_hugetlb
-MAKE_DEPS		+= $(LIBIPC)
+MAKE_NORMAL_DEPS	+= $(LIBIPC)
 
 include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 # vim: syntax=make
diff --git a/testcases/kernel/mem/include/libmem.mk b/testcases/kernel/mem/include/libmem.mk
index 4503e78..8b84b6c 100644
--- a/testcases/kernel/mem/include/libmem.mk
+++ b/testcases/kernel/mem/include/libmem.mk
@@ -33,7 +33,7 @@ $(LIBMEM_DIR):
 $(LIBMEM): $(LIBMEM_DIR)
 	$(MAKE) -C $^ -f "$(LIBMEM_SRCDIR)/Makefile" all
 
-MAKE_DEPS		+= $(LIBMEM)
+MAKE_NORMAL_DEPS	+= $(LIBMEM)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/power_management/Makefile b/testcases/kernel/power_management/Makefile
index 24f75f8..f3289d2 100644
--- a/testcases/kernel/power_management/Makefile
+++ b/testcases/kernel/power_management/Makefile
@@ -26,6 +26,6 @@ vpath %.c $(srcdir):$(top_srcdir)/lib
 
 INSTALL_TARGETS		:= lib/*.py *.py *.sh
 
-MAKE_DEPS		+= $(APICMDS_DIR)/tst_kvercmp
+MAKE_NORMAL_DEPS	+= $(APICMDS_DIR)/tst_kvercmp
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/Makefile b/testcases/kernel/syscalls/ipc/Makefile
index 42492db..4a5ce2d 100644
--- a/testcases/kernel/syscalls/ipc/Makefile
+++ b/testcases/kernel/syscalls/ipc/Makefile
@@ -30,7 +30,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS		:= $(LIB)
 
 trunk-clean:: | lib-clean
 
diff --git a/testcases/kernel/syscalls/ipc/Makefile.inc b/testcases/kernel/syscalls/ipc/Makefile.inc
index c7890a9..ed8a086 100644
--- a/testcases/kernel/syscalls/ipc/Makefile.inc
+++ b/testcases/kernel/syscalls/ipc/Makefile.inc
@@ -33,7 +33,7 @@ $(LIBDIR):
 $(LIBIPC): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIBIPC)
+MAKE_NORMAL_DEPS	:= $(LIBIPC)
 
 CPPFLAGS		+= -I$(abs_srcdir)/$(LIBDIR)
 
diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
index 4472eeb..d38cbe8 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
@@ -23,7 +23,7 @@ include $(top_srcdir)/include/mk/testcases.mk
 LIBMSGCTL               := $(LIBDIR)/libmsgctl.a
 LDLIBS                  += -lmsgctl
 
-MAKE_DEPS               := $(LIBMSGCTL)
+MAKE_NORMAL_DEPS	:= $(LIBMSGCTL)
 
 include $(abs_srcdir)/../Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/kill/Makefile b/testcases/kernel/syscalls/kill/Makefile
index 23dabfc..f413fe6 100644
--- a/testcases/kernel/syscalls/kill/Makefile
+++ b/testcases/kernel/syscalls/kill/Makefile
@@ -32,7 +32,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 CPPFLAGS                += -I$(abs_srcdir)/$(LIBDIR)
 
diff --git a/testcases/kernel/syscalls/mremap/Makefile b/testcases/kernel/syscalls/mremap/Makefile
index 102e473..f20c4c5 100644
--- a/testcases/kernel/syscalls/mremap/Makefile
+++ b/testcases/kernel/syscalls/mremap/Makefile
@@ -32,7 +32,7 @@ $(LIBDIR):
 $(LIB): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 CPPFLAGS                += -I$(abs_srcdir)/$(LIBDIR)
 
diff --git a/testcases/network/rpc/basic_tests/rpc01/Makefile b/testcases/network/rpc/basic_tests/rpc01/Makefile
index b07e14e..4687675 100644
--- a/testcases/network/rpc/basic_tests/rpc01/Makefile
+++ b/testcases/network/rpc/basic_tests/rpc01/Makefile
@@ -46,6 +46,6 @@ lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
 MAKE_TARGETS		:= rpc1 rpc_server
-MAKE_DEPS		:= $(LIB)
+MAKE_NORMAL_DEPS	:= $(LIB)
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc b/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc
index ff6b2e0..7db45d4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc
@@ -27,7 +27,7 @@ $(LIBDDIR):
 $(LIBRPC-TIRPC): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(LIBSRCDIR)/Makefile" all
 
-MAKE_DEPS	+= $(LIBRPC-TIRPC)
+MAKE_NORMAL_DEPS	+= $(LIBRPC-TIRPC)
 
 LDFLAGS		+= -L$(LIBDIR)
 LDLIBS		+= $(TIRPC_LIBS) -lrpc-tirpc
diff --git a/testcases/network/tcp_cmds/Makefile.inc b/testcases/network/tcp_cmds/Makefile.inc
index 8ef8717..8c10599 100644
--- a/testcases/network/tcp_cmds/Makefile.inc
+++ b/testcases/network/tcp_cmds/Makefile.inc
@@ -22,9 +22,9 @@
 
 GENERATE_FILE_DIR	:= ../..
 
-MAKE_DEPS		:= $(GENERATE_FILE_DIR)/datafiles/bin.sm
+MAKE_ORDER_ONLY_DEPS	:= $(GENERATE_FILE_DIR)/datafiles/bin.sm
 
-$(MAKE_DEPS):
+$(MAKE_ORDER_ONLY_DEPS):
 	$(MAKE) -C $(GENERATE_FILE_DIR) \
 	    -f "$(abs_srcdir)/$(GENERATE_FILE_DIR)/Makefile" generate
 
-- 
1.8.2.1


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH RFC v2] change MAKE_TARGETS's dependency to normal prerequisites and order-only prerequisites
  2014-05-15  9:43 [LTP] [PATCH RFC v2] change MAKE_TARGETS's dependency to normal prerequisites and order-only prerequisites Xiaoguang Wang
@ 2014-05-19 12:34 ` chrubis
       [not found]   ` <537B4607.3030207@cn.fujitsu.com>
  0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2014-05-19 12:34 UTC (permalink / raw)
  To: Xiaoguang Wang; +Cc: ltp-list

Hi!
> -MAKE_DEPS	:= $(LIBLTP) $(LSN_H)
> +MAKE_ORDER_ONLY_DEPS	:= $(LSN_H)
> +MAKE_NORMAL_DEPS	:= $(LIBLTP)

Looking at this, the LSN_H is linux_syscall_numbers.h header, shouldn't
we recompile a testcases if this header changes as well?

Can't we just change the MAKE_DEPS to normal dependencies and be done
with it?

Anyway we should check twice that this would not break recepies with
automatic list of prerequisities $^ which does not include order only
ones.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH RFC v2] change MAKE_TARGETS's dependency to normal prerequisites and order-only prerequisites
       [not found]   ` <537B4607.3030207@cn.fujitsu.com>
@ 2014-05-20 13:05     ` chrubis
  0 siblings, 0 replies; 3+ messages in thread
From: chrubis @ 2014-05-20 13:05 UTC (permalink / raw)
  To: Xiaoguang Wang; +Cc: ltp-list

Hi!
> Here I met some issues. Could you please give me some hint and  currently I
> do not know how to fix it.
> 
> When I applied the v2 Patch and according to your comments,
> make "MAKE_NORMAL_DEPS        := $(LIBLTP) $(LSN_H)" in include/mk/testcases.mk.
> 
> For this rule "$(MAKE_TARGETS): $(MAKE_NORMAL_DEPS) | $(MAKE_ORDER_ONLY_DEPS)" in
> include/mk/generic_leaf_target.inc.
> 
> The implicit rule in Makefile will also make  "MAKE_NORMAL_DEPS" in the compile command.
> 
> For example:
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -g -O2 -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/home/lege/extern_stroage/test/ltp-dev/testcases/kernel/include -I../../../../include -I../../../../include   -L../../../../lib  access05.c /home/lege/extern_stroage/test/ltp-dev/lib/libltp.a /home/lege/extern_stroage/test/ltp-dev/testcases/kernel/include/linux_syscall_numbers.h   -lltp -o access05
> 
> But before this patch,
> the command will be:
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -g -O2 -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/home/lege/extern_stroage/test/ltp-dev/testcases/kernel/include -I../../../../include -I../../../../include   -L../../../../lib  access05.c   -lltp -o access05
> 
> How can I remove these "MAKE_NORMAL_DEPS" from the command. I googled this issue, but
> do not find any useful, thanks.

Well that is the problem with implicit rule that pulls in all the dependencies.

The problem is that Make is confused because we don't go the *.c + *.h
-> *.o -> binary route but take shortcut *.c -> binary instead.

If you look at the list of implicit rules (make --print-data-base) there is:

LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)

%: %.c
        $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@


So the final command used to link the testcase is:

$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LOADLIBES) $(LDLIBS) -o $@

If you get choose to use the .c -> .o rule instead it uses:

%.o: %.c:
        $(COMPILE.c) $(OUTPUT_OPTION) $<

Note the $< instead of $^. In this case only first dependency is passed to the
compiler.


One solution would be to override the build-in rule with our own:

% %.c:
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LOADLIBES) $(LDLIBS) -o $@

However there may be places that will break by this change.

Or we may do a big step forward and stop using the implicit rules complety and
write our own rules (which is what quite a lot of projects does). We can even
utilize the gcc -MM and generate all testcase dependencies automatically...

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-20 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-15  9:43 [LTP] [PATCH RFC v2] change MAKE_TARGETS's dependency to normal prerequisites and order-only prerequisites Xiaoguang Wang
2014-05-19 12:34 ` chrubis
     [not found]   ` <537B4607.3030207@cn.fujitsu.com>
2014-05-20 13:05     ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox