Skip to contentSkip to conversation

cleanup: avoid to generate many redundant obj files

PATCH New Li Wang 5 participants 10 messages Feb 18, 2020 – Feb 20, 2020

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

---

Notes:

    Travis: https://travis-ci.com/wangli5665/ltp/builds/149424324
 testcases/kernel/fs/ftest/Makefile               | 2 +-
 testcases/kernel/input/Makefile                  | 2 +-
 testcases/kernel/io/direct_io/Makefile           | 2 +-
 testcases/kernel/sched/clisrv/Makefile           | 2 +-
 testcases/kernel/sched/sched_stress/Makefile     | 2 +-
 testcases/kernel/syscalls/memfd_create/Makefile  | 2 +-
 testcases/kernel/syscalls/migrate_pages/Makefile | 2 +-
 testcases/kernel/syscalls/move_pages/Makefile    | 2 +-
 testcases/kernel/syscalls/swapoff/Makefile       | 2 +-
 testcases/kernel/syscalls/swapon/Makefile        | 2 +-
 testcases/network/nfs/nfslock01/Makefile         | 2 +-
 testcases/network/stress/ns-tools/Makefile       | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)
testcases/kernel/fs/ftest/Makefile +1 -1
index 1566c5c31..e5672d5b1 100644
@@ -28,4 +28,4 @@ FILTER_OUT_MAKE_TARGETS		:= libftest
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o libftest.o
+$(MAKE_TARGETS): %: libftest.o
testcases/kernel/input/Makefile +1 -1
index 5f1db9328..f4d35ab39 100644
@@ -24,4 +24,4 @@ FILTER_OUT_MAKE_TARGETS		:= input_helper
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o input_helper.o
+$(MAKE_TARGETS): %: input_helper.o
testcases/kernel/io/direct_io/Makefile +1 -1
index b522136ca..6d26a7ff3 100644
@@ -30,4 +30,4 @@ INSTALL_TARGETS			:= test_dma_thread_diotest7.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o diotest_routines.o
+$(MAKE_TARGETS): %: diotest_routines.o
testcases/kernel/sched/clisrv/Makefile +1 -1
index af43b7efd..3e311b65b 100644
@@ -31,6 +31,6 @@ INSTALL_TARGETS		:= data run_sched_cliserv.sh
 
 MAKE_TARGETS		:= pthcli pthserv
 
-$(MAKE_TARGETS): %: %.o readline.o writen.o
+$(MAKE_TARGETS): %: readline.o writen.o
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/sched/sched_stress/Makefile +1 -1
index 60bdc6936..2303f6950 100644
@@ -32,7 +32,7 @@ MAKE_TARGETS		:= $(filter-out sched,$(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(
 
 RM			+= -r
 
-$(filter-out sched_datafile,$(MAKE_TARGETS)): %: %.o sched.o
+$(filter-out sched_datafile,$(MAKE_TARGETS)): %: sched.o
 
 MAKE_TARGETS		+= sched_datafile
 
testcases/kernel/syscalls/memfd_create/Makefile +1 -1
index f23b8732c..40ccf7f7f 100644
@@ -20,4 +20,4 @@ FILTER_OUT_MAKE_TARGETS         := memfd_create_common
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o memfd_create_common.o
+$(MAKE_TARGETS): %: memfd_create_common.o
testcases/kernel/syscalls/migrate_pages/Makefile +1 -1
index 46a35d3e0..55174f3b8 100644
@@ -21,7 +21,7 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 
 MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
-$(MAKE_TARGETS): %: %.o migrate_pages_common.o
+$(MAKE_TARGETS): %: migrate_pages_common.o
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
testcases/kernel/syscalls/move_pages/Makefile +1 -1
index 27cf0f7a8..96ff7368f 100644
@@ -24,7 +24,7 @@ CPPFLAGS		+= -I$(abs_srcdir)/../utils
 
 MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 
-$(MAKE_TARGETS): %: %.o move_pages_support.o
+$(MAKE_TARGETS): %: move_pages_support.o
 
 LDLIBS			+= -lpthread -lrt
 
testcases/kernel/syscalls/swapoff/Makefile +1 -1
index 536b2dbac..790a2a74e 100644
@@ -21,4 +21,4 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/./Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: %.o ../swapon/libswapon.o
+$(MAKE_TARGETS): %: ../swapon/libswapon.o
testcases/kernel/syscalls/swapon/Makefile +1 -1
index a109ecdf8..a9bd8f19f 100644
@@ -29,4 +29,4 @@ FILTER_OUT_MAKE_TARGETS         := libswapon
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o libswapon.o
+$(MAKE_TARGETS): %: libswapon.o
testcases/network/nfs/nfslock01/Makefile +1 -1
index a07a99ea9..978749a81 100644
@@ -12,4 +12,4 @@ INSTALL_TARGETS			:= nfslock01
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o nfs_flock_func.o
+$(MAKE_TARGETS): %: nfs_flock_func.o
testcases/network/stress/ns-tools/Makefile +1 -1
index 49a05232f..a288066c8 100644
@@ -35,4 +35,4 @@ FILTER_OUT_MAKE_TARGETS	:= ns-common
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o ns-common.o
+$(MAKE_TARGETS): %: ns-common.o
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Hi Li

This patch looks good to me, feel free to add

Also, I think we can replace GPL with SPDX-License-Identifier in these makefiles(Also for all ltp makefiles, we have converted SPDX-License-Identifier in few header since commit b288957a88b1 ).

Best Regard
Yang Xu

Quoted 146 lines

---

Notes:

     Travis: https://travis-ci.com/wangli5665/ltp/builds/149424324
  testcases/kernel/fs/ftest/Makefile               | 2 +-
  testcases/kernel/input/Makefile                  | 2 +-
  testcases/kernel/io/direct_io/Makefile           | 2 +-
  testcases/kernel/sched/clisrv/Makefile           | 2 +-
  testcases/kernel/sched/sched_stress/Makefile     | 2 +-
  testcases/kernel/syscalls/memfd_create/Makefile  | 2 +-
  testcases/kernel/syscalls/migrate_pages/Makefile | 2 +-
  testcases/kernel/syscalls/move_pages/Makefile    | 2 +-
  testcases/kernel/syscalls/swapoff/Makefile       | 2 +-
  testcases/kernel/syscalls/swapon/Makefile        | 2 +-
  testcases/network/nfs/nfslock01/Makefile         | 2 +-
  testcases/network/stress/ns-tools/Makefile       | 2 +-
  12 files changed, 12 insertions(+), 12 deletions(-)
testcases/kernel/fs/ftest/Makefile +1 -1
index 1566c5c31..e5672d5b1 100644
@@ -28,4 +28,4 @@ FILTER_OUT_MAKE_TARGETS		:= libftest
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o libftest.o
+$(MAKE_TARGETS): %: libftest.o
testcases/kernel/input/Makefile +1 -1
index 5f1db9328..f4d35ab39 100644
@@ -24,4 +24,4 @@ FILTER_OUT_MAKE_TARGETS		:= input_helper
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o input_helper.o
+$(MAKE_TARGETS): %: input_helper.o
testcases/kernel/io/direct_io/Makefile +1 -1
index b522136ca..6d26a7ff3 100644
@@ -30,4 +30,4 @@ INSTALL_TARGETS			:= test_dma_thread_diotest7.sh
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o diotest_routines.o
+$(MAKE_TARGETS): %: diotest_routines.o
testcases/kernel/sched/clisrv/Makefile +1 -1
index af43b7efd..3e311b65b 100644
@@ -31,6 +31,6 @@ INSTALL_TARGETS		:= data run_sched_cliserv.sh
 
  MAKE_TARGETS		:= pthcli pthserv
 
-$(MAKE_TARGETS): %: %.o readline.o writen.o
+$(MAKE_TARGETS): %: readline.o writen.o
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/sched/sched_stress/Makefile +1 -1
index 60bdc6936..2303f6950 100644
@@ -32,7 +32,7 @@ MAKE_TARGETS		:= $(filter-out sched,$(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(
 
  RM			+= -r
 
-$(filter-out sched_datafile,$(MAKE_TARGETS)): %: %.o sched.o
+$(filter-out sched_datafile,$(MAKE_TARGETS)): %: sched.o
 
  MAKE_TARGETS		+= sched_datafile
 
testcases/kernel/syscalls/memfd_create/Makefile +1 -1
index f23b8732c..40ccf7f7f 100644
@@ -20,4 +20,4 @@ FILTER_OUT_MAKE_TARGETS         := memfd_create_common
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o memfd_create_common.o
+$(MAKE_TARGETS): %: memfd_create_common.o
testcases/kernel/syscalls/migrate_pages/Makefile +1 -1
index 46a35d3e0..55174f3b8 100644
@@ -21,7 +21,7 @@ top_srcdir		?= ../../../..
  include $(top_srcdir)/include/mk/testcases.mk
 
  MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
-$(MAKE_TARGETS): %: %.o migrate_pages_common.o
+$(MAKE_TARGETS): %: migrate_pages_common.o
 
  CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
testcases/kernel/syscalls/move_pages/Makefile +1 -1
index 27cf0f7a8..96ff7368f 100644
@@ -24,7 +24,7 @@ CPPFLAGS		+= -I$(abs_srcdir)/../utils
 
  MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 
-$(MAKE_TARGETS): %: %.o move_pages_support.o
+$(MAKE_TARGETS): %: move_pages_support.o
 
  LDLIBS			+= -lpthread -lrt
 
testcases/kernel/syscalls/swapoff/Makefile +1 -1
index 536b2dbac..790a2a74e 100644
@@ -21,4 +21,4 @@ top_srcdir		?= ../../../..
  include $(top_srcdir)/include/mk/testcases.mk
  include $(abs_srcdir)/./Makefile.inc
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: %.o ../swapon/libswapon.o
+$(MAKE_TARGETS): %: ../swapon/libswapon.o
testcases/kernel/syscalls/swapon/Makefile +1 -1
index a109ecdf8..a9bd8f19f 100644
@@ -29,4 +29,4 @@ FILTER_OUT_MAKE_TARGETS         := libswapon
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o libswapon.o
+$(MAKE_TARGETS): %: libswapon.o
testcases/network/nfs/nfslock01/Makefile +1 -1
index a07a99ea9..978749a81 100644
@@ -12,4 +12,4 @@ INSTALL_TARGETS			:= nfslock01
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o nfs_flock_func.o
+$(MAKE_TARGETS): %: nfs_flock_func.o
testcases/network/stress/ns-tools/Makefile +0 -0
index 49a05232f..a288066c8 100644

testcases/network/stress/ns-tools/Makefile FILTER_OUT_MAKE_TARGETS := ns-common · line 38

Quoted 5 lines
testcases/network/stress/ns-tools/Makefile +1 -1
@@ -35,4 +35,4 @@ FILTER_OUT_MAKE_TARGETS	:= ns-common
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o ns-common.o
+$(MAKE_TARGETS): %: ns-common.o

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200218/08049e76/attachment.htm>

author
#2 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Hi Yang,

Quoted 7 lines · Yang Xu

Hi Li

This patch looks good to me, feel free to add

Also, I think we can replace GPL with SPDX-License-Identifier in these makefiles

Quoted 7 lines

Yes, I have fixed that as you suggest and pushed. Thanks!

(Also for
all ltp makefiles, we have converted SPDX-License-Identifier in few header since commit b288957a88b1 ).

Good point, but I haven't found a way to do the replacement for whole

files.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200219/556d1f05/attachment.htm>
#3 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

In reply to Li Wang

Hi Li,

Sorry for my late reply?just one question:

For example(ftest):

Why don't you avoid libftest.o as well if you want to build test by new rule?

Thanks,

Xiao Yang

Quoted 151 lines · Li Wang

---

Notes:

     Travis: https://travis-ci.com/wangli5665/ltp/builds/149424324
  testcases/kernel/fs/ftest/Makefile               | 2 +-
  testcases/kernel/input/Makefile                  | 2 +-
  testcases/kernel/io/direct_io/Makefile           | 2 +-
  testcases/kernel/sched/clisrv/Makefile           | 2 +-
  testcases/kernel/sched/sched_stress/Makefile     | 2 +-
  testcases/kernel/syscalls/memfd_create/Makefile  | 2 +-
  testcases/kernel/syscalls/migrate_pages/Makefile | 2 +-
  testcases/kernel/syscalls/move_pages/Makefile    | 2 +-
  testcases/kernel/syscalls/swapoff/Makefile       | 2 +-
  testcases/kernel/syscalls/swapon/Makefile        | 2 +-
  testcases/network/nfs/nfslock01/Makefile         | 2 +-
  testcases/network/stress/ns-tools/Makefile       | 2 +-
  12 files changed, 12 insertions(+), 12 deletions(-)
testcases/kernel/fs/ftest/Makefile +1 -1
index 1566c5c31..e5672d5b1 100644
@@ -28,4 +28,4 @@ FILTER_OUT_MAKE_TARGETS		:= libftest
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o libftest.o
+$(MAKE_TARGETS): %: libftest.o
testcases/kernel/input/Makefile +1 -1
index 5f1db9328..f4d35ab39 100644
@@ -24,4 +24,4 @@ FILTER_OUT_MAKE_TARGETS		:= input_helper
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o input_helper.o
+$(MAKE_TARGETS): %: input_helper.o
testcases/kernel/io/direct_io/Makefile +1 -1
index b522136ca..6d26a7ff3 100644
@@ -30,4 +30,4 @@ INSTALL_TARGETS			:= test_dma_thread_diotest7.sh
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o diotest_routines.o
+$(MAKE_TARGETS): %: diotest_routines.o
testcases/kernel/sched/clisrv/Makefile +1 -1
index af43b7efd..3e311b65b 100644
@@ -31,6 +31,6 @@ INSTALL_TARGETS		:= data run_sched_cliserv.sh
 
  MAKE_TARGETS		:= pthcli pthserv
 
-$(MAKE_TARGETS): %: %.o readline.o writen.o
+$(MAKE_TARGETS): %: readline.o writen.o
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/sched/sched_stress/Makefile +1 -1
index 60bdc6936..2303f6950 100644
@@ -32,7 +32,7 @@ MAKE_TARGETS		:= $(filter-out sched,$(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(
 
  RM			+= -r
 
-$(filter-out sched_datafile,$(MAKE_TARGETS)): %: %.o sched.o
+$(filter-out sched_datafile,$(MAKE_TARGETS)): %: sched.o
 
  MAKE_TARGETS		+= sched_datafile
 
testcases/kernel/syscalls/memfd_create/Makefile +1 -1
index f23b8732c..40ccf7f7f 100644
@@ -20,4 +20,4 @@ FILTER_OUT_MAKE_TARGETS         := memfd_create_common
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o memfd_create_common.o
+$(MAKE_TARGETS): %: memfd_create_common.o
testcases/kernel/syscalls/migrate_pages/Makefile +1 -1
index 46a35d3e0..55174f3b8 100644
@@ -21,7 +21,7 @@ top_srcdir		?= ../../../..
  include $(top_srcdir)/include/mk/testcases.mk
 
  MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
-$(MAKE_TARGETS): %: %.o migrate_pages_common.o
+$(MAKE_TARGETS): %: migrate_pages_common.o
 
  CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
testcases/kernel/syscalls/move_pages/Makefile +1 -1
index 27cf0f7a8..96ff7368f 100644
@@ -24,7 +24,7 @@ CPPFLAGS		+= -I$(abs_srcdir)/../utils
 
  MAKE_TARGETS		:= $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
 
-$(MAKE_TARGETS): %: %.o move_pages_support.o
+$(MAKE_TARGETS): %: move_pages_support.o
 
  LDLIBS			+= -lpthread -lrt
 
testcases/kernel/syscalls/swapoff/Makefile +1 -1
index 536b2dbac..790a2a74e 100644
@@ -21,4 +21,4 @@ top_srcdir		?= ../../../..
  include $(top_srcdir)/include/mk/testcases.mk
  include $(abs_srcdir)/./Makefile.inc
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: %.o ../swapon/libswapon.o
+$(MAKE_TARGETS): %: ../swapon/libswapon.o
testcases/kernel/syscalls/swapon/Makefile +1 -1
index a109ecdf8..a9bd8f19f 100644
@@ -29,4 +29,4 @@ FILTER_OUT_MAKE_TARGETS         := libswapon
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o libswapon.o
+$(MAKE_TARGETS): %: libswapon.o
testcases/network/nfs/nfslock01/Makefile +1 -1
index a07a99ea9..978749a81 100644
@@ -12,4 +12,4 @@ INSTALL_TARGETS			:= nfslock01
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o nfs_flock_func.o
+$(MAKE_TARGETS): %: nfs_flock_func.o
testcases/network/stress/ns-tools/Makefile +1 -1
index 49a05232f..a288066c8 100644
@@ -35,4 +35,4 @@ FILTER_OUT_MAKE_TARGETS	:= ns-common
 
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
-$(MAKE_TARGETS): %: %.o ns-common.o
+$(MAKE_TARGETS): %: ns-common.o
author
#4 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Hi Xiao,

Why don't you avoid libftest.o as well if you want to build test by new

Quoted 1 line

rule?

That should be generated because it is the local library. In LTP Makefile, the sequencing is to build the library first then compile&link to the testcase. We can avoid dumping the testname.o since it only exists in the last phase.

And, I don't want to change too much for LTP build rule(I think it works correctly), especially in the case directory some of the local libraries are reused. e.g The swapoff test needs linking to ../swapon/libswapon.o, that requires libswapon.o is in the correct path.

Or, did I misunderstand your words? if yes, please correct me.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200219/f2185e4b/attachment.htm>
#5 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Quoted 10 lines · Li Wang

Hi Xiao,

Why don't you avoid libftest.o as well if you want to build test by new rule?

That should be generated?because it is the local library. In LTP Makefile, the sequencing is to build the library first then compile&link?to?the testcase. We can avoid dumping the testname.o since it only exists in the last phase.

Hi Li,

Thanks for your detailed explanation.

I think you try to change the building rule, as below:

Previous rule: generate all object files and then link them at the last phase.

---------------------------------------------

gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -I../../../../include -I../../../../include -I../../../../include/old/? -c -o swapoff01.o swapoff01.c
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -I../../../../include -I../../../../include -I../../../../include/old/? -c -o ../swapon/libswapon.o ../swapon/libswapon.c
gcc?? -L/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -L../../../../lib? swapoff01.o ../swapon/libswapon.o?? -lltp -o swapoff01

---------------------------------------------

Current rule: just generate some common object files(e.g. library) and then mix building and link at the last phase.

---------------------------------------------

gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -I../../../../include -I../../../../include -I../../../../include/old/? -c -o ../swapon/libswapon.o ../swapon/libswapon.c
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -I../../../../include -I../../../../include -I../../../../include/old/ -L/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -L../../../../lib? swapoff01.c ../swapon/libswapon.o?? -lltp -o swapoff01

---------------------------------------------

Why don't you remove all object files and mix building and link at the last phase?

---------------------------------------------

gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -I/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -I../../../../include -I../../../../include -I../../../../include/old/ -L/root/ltp/testcases/kernel/syscalls/swapoff/../swapon/ -L../../../../lib? swapoff01.c ../swapon/libswapon.c?? -lltp -o swapoff01

---------------------------------------------

Quoted 5 lines

And, I don't want to change too much for LTP build rule(I think it works correctly), especially in the case directory some of the local libraries are reused.? e.g The swapoff test needs linking to ../swapon/libswapon.o, that requires?libswapon.o?is in the correct path.

You can build and link libswapon.c directly, as below:

---------------------------------

# grep MAKE_TARGETS Makefile
$(MAKE_TARGETS): %: ../swapon/libswapon.c

---------------------------------

Sorry, I am not sure if your improvement is the best way.

Thanks,

Xiao Yang

Quoted 6 lines

Or, did I misunderstand your words? if yes, please correct me.

Signature · 2 lines
Regards,
Li Wang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200219/6a4c8f15/attachment-0001.htm>

#6 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Quoted 12 lines · Xiao Yang

You can build and link libswapon.c directly, as below:

---------------------------------

# grep MAKE_TARGETS Makefile
$(MAKE_TARGETS): %: ../swapon/libswapon.c

---------------------------------

Sorry, I am not sure if your improvement is the best way.

Hi Li,

The root cause is that libswapon.c is built as an object file(libswapon.o) instead of a library file(libswapon.so/libswapon.a).

Sorry, I just feel strange about the left *.o files.

Thanks,

Xiao Yang

#7 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Hi!

Quoted 4 lines

The root cause is that libswapon.c is built as an object file(libswapon.o) instead of a library file(libswapon.so/libswapon.a).

Sorry, I just feel strange about the left *.o files.

Given that the library is used in both swapon and swapoff tests we may as well move it to the toplevel libs/ directory as libltpswap, which would simplify the Makefiles a bit.

Signature · 2 lines
Cyril Hrubis
[email protected]
#8 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

Quoted 8 lines · Cyril Hrubis

Hi!

Quoted 4 lines

The root cause is that libswapon.c is built as an object file(libswapon.o) instead of a library file(libswapon.so/libswapon.a).

Sorry, I just feel strange about the left *.o files.

Given that the library is used in both swapon and swapoff tests we may as well move it to the toplevel libs/ directory as libltpswap, which would simplify the Makefiles a bit.

Hi Cyril,

Thanks, and I will look into it as you suggested. :-)

Best Regards,
Xiao Yang

author
#9 lore raw

PATCH 1/1 cleanup: avoid to generate many redundant obj files

In reply to Xiao Yang
Quoted 3 lines · Xiao Yang

Why don't you remove all object files and mix building and link at the last phase?

As I mentioned the library file shouldn't be deleted.

Quoted 5 lines

And, I don't want to change too much for LTP build rule(I think it works correctly), especially in the case directory some of the local libraries are reused. e.g The swapoff test needs linking to ../swapon/libswapon.o, that requires libswapon.o is in the correct path.

Quoted 7 lines

You can build and link libswapon.c directly, as below:

---------------------------------

# grep MAKE_TARGETS Makefile
$(MAKE_TARGETS): %: ../swapon/libswapon.c

FWIK, It breaks up the principle of the library design in C compilation, it just regards the library as a general C file, I think it's a horrible idea.

Quoted 4 lines

---------------------------------

Sorry, I am not sure if your improvement is the best way.

I have never say that's an improvement, that's just a cleanup patch. I just want the code directory to be cleaner even after compilation.

But if you give a performance evaluation, you will find my build way is a little faster than previous:).

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200219/37e9425c/attachment.htm>