Build system fixes
cover Build system fixes
This patchset does
* Introduce LTPLDLIBS to solve linker dependencies once for all
* Cleans up the output from make a bit, this could be even more fine tuned if we agree on this part
Cyril Hrubis (3):
build system: Add explicit make rules
testcases: Make use of LTPLDLIBS
build system: Silence the output a bit more
include/mk/env_post.mk | 2 ++ include/mk/generic_trunk_target.inc | 14 +++++++++ include/mk/lib.mk | 2 +- include/mk/rules.mk | 29 +++++++++++++++++++ include/mk/testcases.mk | 5 ++++ .../kernel/syscalls/clock_gettime/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgctl/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgget/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgrcv/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgsnd/Makefile | 2 +- .../kernel/syscalls/ipc/msgstress/Makefile | 2 +- testcases/kernel/syscalls/ipc/semctl/Makefile | 4 +-- testcases/kernel/syscalls/ipc/semget/Makefile | 2 +- testcases/kernel/syscalls/ipc/semop/Makefile | 2 +- testcases/kernel/syscalls/ipc/shmat/Makefile | 2 +- testcases/kernel/syscalls/ipc/shmctl/Makefile | 4 +-- testcases/kernel/syscalls/ipc/shmdt/Makefile | 2 +- testcases/kernel/syscalls/ipc/shmget/Makefile | 2 +- testcases/kernel/syscalls/kill/Makefile | 4 +-- testcases/kernel/syscalls/mbind/Makefile | 6 ++-- testcases/kernel/syscalls/mremap/Makefile | 2 +- .../kernel/syscalls/rt_sigtimedwait/Makefile | 2 +- .../kernel/syscalls/set_mempolicy/Makefile | 3 +- .../kernel/syscalls/sigtimedwait/Makefile | 2 +- testcases/kernel/syscalls/sigwait/Makefile | 2 +- .../kernel/syscalls/sigwaitinfo/Makefile | 2 +- 26 files changed, 79 insertions(+), 26 deletions(-) create mode 100644 include/mk/rules.mk
Signature · 1 line
2.26.2
PATCH 1/3 build system: Add explicit make rules
This commit adds explicit build rules, the main motivation are recent build failures caused by library orderings. To fix that this commit introduces LTPLDLIBS special variable that is passed to linker before the LDLIBS which avoids the need for tricks as
"LDLIBS := -lltpfoo $(LDLIBS)" in the Makefiles.
This commit also silences the output by default a bit, the verbose output could be enabled by VERBOSE=1 env variable, which is probably what most of the build systems will do if this gets commited. I guess that we can as well silence a bit the "make entering/leaving directory" if this the right way to go.
--- include/mk/env_post.mk | 2 ++ include/mk/rules.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 include/mk/rules.mk
include/mk/env_post.mk +2 -0
@@ -107,4 +107,6 @@ $(error You must define $$(prefix) before executing install) endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) endif +include $(top_srcdir)/include/mk/rules.mk + endif
include/mk/rules.mk new file +29 -0
@@ -0,0 +1,29 @@ +%.o: %.c +ifdef VERBOSE + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +else + @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + @echo CC $@ +endif + +ifdef VERBOSE +COMPILE.c=$(CC) $(CPPFLAGS) $(CFLAGS) -c +else +COMPILE.c=@echo CC $@; $(CC) $(CPPFLAGS) $(CFLAGS) -c +endif + +%: %.o +ifdef VERBOSE + $(CC) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ +else + @$(CC) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ + @echo LD $@ +endif + +%: %.c +ifdef VERBOSE + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ +else + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ + @echo CC $@ +endif
Signature · 1 line
2.26.2
PATCH 1/3 build system: Add explicit make rules
----- Original Message -----
Quoted 11 lines
This commit adds explicit build rules, the main motivation are recent build failures caused by library orderings. To fix that this commit introduces LTPLDLIBS special variable that is passed to linker before the LDLIBS which avoids the need for tricks as
"LDLIBS := -lltpfoo $(LDLIBS)" in the Makefiles.This commit also silences the output by default a bit, the verbose output could be enabled by VERBOSE=1 env variable, which is probably what most of the build systems will do if this gets commited. I guess that we can as well silence a bit the "make entering/leaving directory" if this the right way to go.
alias for V=0 / V=1 would be nice
LTPLDLIBS should probably be mentioned in doc/build-system-guide.txt
Quoted 26 lines
Signed-off-by Cyril Hrubis <[email protected]>--- include/mk/env_post.mk | 2 ++ include/mk/rules.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 include/mk/rules.mkinclude/mk/env_post.mk +2
-0@@ -107,4 +107,6 @@ $(error You must define $$(prefix) before executing install) endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) endif +include $(top_srcdir)/include/mk/rules.mk +endif
include/mk/rules.mk new file +0
-0
include/mk/rules.mk line 7
Quoted 7 lines
include/mk/rules.mk new file +7
-0@@ -0,0 +1,29 @@ +%.o: %.c +ifdef VERBOSE + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +else + @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + @echo CC $@ +endif
What if we wouldn't print "DIR" (for non-clean targets) and printed relative paths instead?
CC lib/tst_timer_test.o
CC lib/tst_checkpoint.o
CC lib/tst_supported_fs_types.o
...
CC lib/tests/tst_dataroot03
CC lib/tests/tst_strerrno
..
CC lib/newlib_tests/test07
CC lib/newlib_tests/test13
CC lib/newlib_tests/test11
..
CC testcases/kernel/syscalls/execv/execv01_child CC testcases/kernel/syscalls/execv/execv01 CC testcases/kernel/syscalls/exit/exit01
CC testcases/kernel/syscalls/exit/exit02
CC testcases/kernel/syscalls/setresgid/setresgid02.o LD testcases/kernel/syscalls/setresgid/setresgid02 CC testcases/kernel/syscalls/setresgid/setresgid03.o LD testcases/kernel/syscalls/setresgid/setresgid03
include/mk/env_pre.mk +3 -1
@@ -79,7 +79,9 @@ builddir := . abs_builddir := $(CURDIR) -cwd_rel_from_top := $(subst $(abs_top_builddir),,$(abs_builddir)) +cwd_rel1 := $(subst $(abs_top_builddir),,$(abs_builddir)) +cwd_rel2 := $(subst $(abs_top_builddir)/,,$(abs_builddir)) +cwd_rel_from_top := $(if $(cwd_rel1),$(cwd_rel2),$(cwd_rel1)) # Where's the source located at? Squish all of the / away by using abspath... ifdef MAKE_3_80_COMPAT
include/mk/generic_trunk_target.inc +0 -1
@@ -103,7 +103,6 @@ ifdef VERBOSE done else @set -e; for dir in $(SUBDIRS); do \ - echo "DIR $$dir"; \ $(MAKE) --no-print-directory -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ done endif
include/mk/rules.mk +6 -4
@@ -1,15 +1,17 @@ +target_rel_dir := $(if $(cwd_rel_from_top),$(cwd_rel_from_top)/,) + %.o: %.c ifdef VERBOSE $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< else @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< - @echo CC $@ + @echo CC $(target_rel_dir)$@ endif ifdef VERBOSE COMPILE.c=$(CC) $(CPPFLAGS) $(CFLAGS) -c else -COMPILE.c=@echo CC $@; $(CC) $(CPPFLAGS) $(CFLAGS) -c +COMPILE.c=@echo CC $(target_rel_dir)$@; $(CC) $(CPPFLAGS) $(CFLAGS) -c endif %: %.o
@@ -17,7 +19,7 @@ ifdef VERBOSE $(CC) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ else @$(CC) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ - @echo LD $@ + @echo LD $(target_rel_dir)$@ endif %: %.c
@@ -25,5 +27,5 @@ ifdef VERBOSE $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ else @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@ - @echo CC $@ + @echo CC $(target_rel_dir)$@ endif
PATCH 1/3 build system: Add explicit make rules
Quoted 47 lines · Jan Stancek
----- Original Message -----
Quoted 11 lines
This commit adds explicit build rules, the main motivation are recent build failures caused by library orderings. To fix that this commit introduces LTPLDLIBS special variable that is passed to linker before the LDLIBS which avoids the need for tricks as
"LDLIBS := -lltpfoo $(LDLIBS)" in the Makefiles.This commit also silences the output by default a bit, the verbose output could be enabled by VERBOSE=1 env variable, which is probably what most of the build systems will do if this gets commited. I guess that we can as well silence a bit the "make entering/leaving directory" if this the right way to go.
alias for V=0 / V=1 would be nice
LTPLDLIBS should probably be mentioned in
doc/build-system-guide.txtQuoted 28 lines
Signed-off-by Cyril Hrubis <[email protected]>--- include/mk/env_post.mk | 2 ++ include/mk/rules.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 include/mk/rules.mkinclude/mk/env_post.mk +2
-0@@ -107,4 +107,6 @@ $(error You must define $$(prefix) before executing install) endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) endif +include $(top_srcdir)/include/mk/rules.mk +endif
include/mk/rules.mk new file +2
-0@@ -0,0 +1,29 @@ +%.o: %.c +ifdef VERBOSE
Quoted 9 lines
include/mk/rules.mk line 7
Quoted 5 lines
include/mk/rules.mk new file +5
-0+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +else + @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + @echo CC $@ +endifWhat if we wouldn't print "DIR" (for non-clean targets) and printed relative paths instead?
+1
This looks better, I'd give my vote to this.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200803/bfdd6dc6/attachment-0001.htm>
PATCH 1/3 build system: Add explicit make rules
In reply to Jan StancekHi all,
Quoted 16 lines
----- Original Message -----
Quoted 11 lines
This commit adds explicit build rules, the main motivation are recent build failures caused by library orderings. To fix that this commit introduces LTPLDLIBS special variable that is passed to linker before the LDLIBS which avoids the need for tricks as
"LDLIBS := -lltpfoo $(LDLIBS)" in the Makefiles.This commit also silences the output by default a bit, the verbose output could be enabled by VERBOSE=1 env variable, which is probably what most of the build systems will do if this gets commited. I guess that we can as well silence a bit the "make entering/leaving directory" if this the right way to go.
alias for V=0 / V=1 would be nice
LTPLDLIBS should probably be mentioned in
doc/build-system-guide.txt
...
Quoted 1 line
What if we wouldn't print "DIR" (for non-clean targets) and printed relative paths instead?
+1 to all suggestions (including Li's to avoid printing DIR in 3rd commit).
Kind regards,
Petr
PATCH 1/3 build system: Add explicit make rules
In reply to Jan StancekHi!
Quoted 6 lines
Quoted 6 lines
This commit adds explicit build rules, the main motivation are recent build failures caused by library orderings. To fix that this commit introduces LTPLDLIBS special variable that is passed to linker before the LDLIBS which avoids the need for tricks as
"LDLIBS := -lltpfoo $(LDLIBS)" in the Makefiles.
Quoted 7 lines
Quoted 5 lines
This commit also silences the output by default a bit, the verbose output could be enabled by VERBOSE=1 env variable, which is probably what most of the build systems will do if this gets commited. I guess that we can as well silence a bit the "make entering/leaving directory" if this the right way to go.
alias for V=0 / V=1 would be nice
Done in a follow up patch.
Quoted 1 line
LTPLDLIBS should probably be mentioned in
doc/build-system-guide.txt
I've added a line to the variables listing in there before pushing.
Quoted 27 lines
Quoted 27 lines
Signed-off-by Cyril Hrubis <[email protected]>--- include/mk/env_post.mk | 2 ++ include/mk/rules.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 include/mk/rules.mkinclude/mk/env_post.mk +2
-0@@ -107,4 +107,6 @@ $(error You must define $$(prefix) before executing install) endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) endif +include $(top_srcdir)/include/mk/rules.mk +endif
include/mk/rules.mk new file +1
-0@@ -0,0 +1,29 @@ +%.o: %.c
Quoted 8 lines
include/mk/rules.mk line 7
Quoted 6 lines
include/mk/rules.mk new file +6
-0+ifdef VERBOSE + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +else + @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + @echo CC $@ +endifWhat if we wouldn't print "DIR" (for non-clean targets) and printed relative paths instead?
Great idea, I've added these changes to the first patch in the series before I pushed it.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/3 build system: Add explicit make rules
Quoted 3 lines
Great idea, I've added these changes to the first patch in the series before I pushed it.
There is still a DIR output at:
include/mk/generic_trunk_target.inc:84: echo "DIR $$dir"; \
Not sure it is on purpose or forgot removing?
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200805/97f721ca/attachment.htm>
PATCH 1/3 build system: Add explicit make rules
Hi!
Quoted 4 lines
There is still a DIR output at:
include/mk/generic_trunk_target.inc:84: echo "DIR $$dir"; \Not sure it is on purpose or forgot removing?
That's the one for the clean target, we may clean up 'make clean' output as well, but without further changes this shall stay.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/3 testcases: Make use of LTPLDLIBS
In reply to Cyril Hrubis--- testcases/kernel/syscalls/clock_gettime/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgctl/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgget/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgrcv/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgsnd/Makefile | 2 +- testcases/kernel/syscalls/ipc/msgstress/Makefile | 2 +- testcases/kernel/syscalls/ipc/semctl/Makefile | 4 ++-- testcases/kernel/syscalls/ipc/semget/Makefile | 2 +- testcases/kernel/syscalls/ipc/semop/Makefile | 2 +- testcases/kernel/syscalls/ipc/shmat/Makefile | 2 +- testcases/kernel/syscalls/ipc/shmctl/Makefile | 4 ++-- testcases/kernel/syscalls/ipc/shmdt/Makefile | 2 +- testcases/kernel/syscalls/ipc/shmget/Makefile | 2 +- testcases/kernel/syscalls/kill/Makefile | 4 ++-- testcases/kernel/syscalls/mbind/Makefile | 6 ++++-- testcases/kernel/syscalls/mremap/Makefile | 2 +- testcases/kernel/syscalls/rt_sigtimedwait/Makefile | 2 +- testcases/kernel/syscalls/set_mempolicy/Makefile | 3 ++- testcases/kernel/syscalls/sigtimedwait/Makefile | 2 +- testcases/kernel/syscalls/sigwait/Makefile | 2 +- testcases/kernel/syscalls/sigwaitinfo/Makefile | 2 +- 21 files changed, 28 insertions(+), 25 deletions(-)
testcases/kernel/syscalls/clock_gettime/Makefile +1 -1
@@ -8,6 +8,6 @@ LTPLIBS = ltpvdso include $(top_srcdir)/include/mk/testcases.mk LDLIBS+=-lrt -clock_gettime04: LDLIBS += -lltpvdso +clock_gettime04: LTPLDLIBS = -lltpvdso include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgctl/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpnewipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpnewipc +LTPLDLIBS = -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgget/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpnewipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpnewipc +LTPLDLIBS = -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgsnd/Makefile +1 -1
@@ -11,6 +11,6 @@ endif include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpnewipc +LTPLDLIBS += -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +LTPLDLIBS += -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/Makefile +2 -2
@@ -7,7 +7,7 @@ LTPLIBS = ltpipc ltpnewipc include $(top_srcdir)/include/mk/testcases.mk -semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc -semctl08: LDLIBS += -lltpnewipc +semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LTPLDLIBS = -lltpipc +semctl08: LTPLDLIBS = -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semget/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semop/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmat/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpnewipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpnewipc +LTPLDLIBS = -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/Makefile +2 -2
@@ -10,7 +10,7 @@ shmctl05: LDLIBS += -lrt include $(top_srcdir)/include/mk/testcases.mk -shmctl01 shmctl02 shmctl03 shmctl04 shmctl05: LDLIBS += -lltpipc -shmctl06: LDLIBS += -lltpnewipc +shmctl01 shmctl02 shmctl03 shmctl04 shmctl05: LTPLDLIBS = -lltpipc +shmctl06: LTPLDLIBS = -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmdt/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmget/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/kill/Makefile +2 -2
@@ -7,7 +7,7 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -kill07: LDLIBS += -lltpipc -kill05: LDLIBS += -lltpipc +kill07: LTPLDLIBS = -lltpipc +kill05: LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mbind/Makefile +4 -2
@@ -3,12 +3,14 @@ top_srcdir ?= ../../../.. +LTPLIBS=ltpnuma + include $(top_srcdir)/include/mk/testcases.mk CPPFLAGS += -I$(abs_srcdir)/../utils/ -LDLIBS += $(NUMA_LIBS) -lltpnuma -LDFLAGS += -L$(top_builddir)/libs/libltpnuma +LDLIBS += $(NUMA_LIBS) +LTPLDLIBS = -lltpnuma include $(top_srcdir)/testcases/kernel/include/lib.mk include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mremap/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpipc include $(top_srcdir)/include/mk/testcases.mk -mremap04: LDLIBS += -lltpipc +mremap04: LTPLDLIBS = -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/rt_sigtimedwait/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpsigwait include $(top_srcdir)/include/mk/testcases.mk -LDLIBS := -lltpsigwait $(LDLIBS) +LTPLDLIBS = -lltpsigwait include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/set_mempolicy/Makefile +2 -1
@@ -4,6 +4,7 @@ LTPLIBS = ltpnuma include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += $(NUMA_LIBS) -lltpnuma +LDLIBS += $(NUMA_LIBS) +LTPLDLIBS = -lltpnuma include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/sigtimedwait/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpsigwait include $(top_srcdir)/include/mk/testcases.mk -LDLIBS := -lltpsigwait $(LDLIBS) +LTPLDLIBS = -lltpsigwait include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/sigwait/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpsigwait include $(top_srcdir)/include/mk/testcases.mk -LDLIBS := -lltpsigwait $(LDLIBS) +LTPLDLIBS = -lltpsigwait include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/sigwaitinfo/Makefile +1 -1
@@ -7,6 +7,6 @@ LTPLIBS = ltpsigwait include $(top_srcdir)/include/mk/testcases.mk -LDLIBS := -lltpsigwait $(LDLIBS) +LTPLDLIBS = -lltpsigwait include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.26.2
PATCH 3/3 build system: Silence the output a bit more
In reply to Cyril HrubisThis hides a few more messages, mostly make entering/leaving directory and the empty library check.
Now rebuilding a ltp library and test looks like:
$ make BUILD libltpsigwait.a CC sigwait.o ar -rc "libltpsigwait.a" sigwait.o ranlib "libltpsigwait.a" CC sigwait01
While previously (or with a VERBOSE=1) it looks like:
$ VERBOSE=1 make make -C "/home/metan/Work/ltp-dev/libs/libltpsigwait/" -f "/home/metan/Work/ltp-dev/libs/libltpsigwait//Makefile" all make[1]: Entering directory '/home/metan/Work/ltp-dev/libs/libltpsigwait' gcc -I../../include -I../../include -I../../include/old/ -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -c -o sigwait.o sigwait.c ar -rc "libltpsigwait.a" sigwait.o ranlib "libltpsigwait.a" make[1]: Leaving directory '/home/metan/Work/ltp-dev/libs/libltpsigwait' gcc -I../../../../include -I../../../../include -I../../../../include/old/ -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -L../../../../libs/libltpsigwait -L../../../../lib sigwait01.c -lltpsigwait -lltp -o sigwait01
--- include/mk/generic_trunk_target.inc | 14 ++++++++++++++ include/mk/lib.mk | 2 +- include/mk/testcases.mk | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-)
include/mk/generic_trunk_target.inc +14 -0
@@ -75,9 +75,16 @@ trunk-install: $(INSTALL_FILES) all: trunk-all clean:: trunk-clean +ifdef VERBOSE @set -e; for dir in $(SUBDIRS); do \ $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ done +else + @set -e; for dir in $(SUBDIRS); do \ + echo "DIR $$dir"; \ + $(MAKE) --no-print-directory -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done +endif ifneq ($(abs_builddir),$(abs_srcdir)) $(RM) -Rf $(SUBDIRS) endif
@@ -90,9 +97,16 @@ ifeq ($(strip $(SUBDIRS)),) $(error SUBDIRS empty -- did you want generic_leaf_target instead?) else $(RECURSIVE_TARGETS): %: | $(SUBDIRS) +ifdef VERBOSE @set -e; for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ done +else + @set -e; for dir in $(SUBDIRS); do \ + echo "DIR $$dir"; \ + $(MAKE) --no-print-directory -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done +endif endif # vim: syntax=make
include/mk/lib.mk +1 -1
@@ -63,7 +63,7 @@ LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS)) LIBOBJS := $(LIBSRCS:.c=.o) $(LIB): $(notdir $(LIBOBJS)) - if [ -z "$(strip $^)" ] ; then \ + @if [ -z "$(strip $^)" ] ; then \ echo "Cowardly refusing to create empty archive"; \ exit 1; \ fi
include/mk/testcases.mk +5 -0
@@ -53,7 +53,12 @@ MAKE_DEPS += $(LTPLIBS_FILES) $(LTPLIBS_FILES): $(LTPLIBS_DIRS) $(LTPLIBS_FILES): %: +ifdef VERBOSE $(MAKE) -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all +else + @echo "BUILD $(notdir $@)" + @$(MAKE) --no-print-directory -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all +endif LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
Signature · 1 line
2.26.2
PATCH 3/3 build system: Silence the output a bit more
include/mk/generic_trunk_target.inc trunk-install: $(INSTALL_FILES) · line 84
Quoted 8 lines
include/mk/generic_trunk_target.inc +4
-0+ifdef VERBOSE @set -e; for dir in $(SUBDIRS); do \ $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ done +else + @set -e; for dir in $(SUBDIRS); do \ + echo "DIR $$dir"; \
I don't think to print the DIR has any help for debugging, we could find the correct source file easily without it too.
Otherwise, the patchset looks pretty good.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200803/0341da2c/attachment.htm>
cover Build system fixes
In reply to Cyril HrubisHi Cyril,
Quoted 11 lines
This patchset does
* Introduce LTPLDLIBS to solve linker dependencies once for all
* Cleans up the output from make a bit, this could be even more fine tuned if we agree on this part
Cyril Hrubis (3):
build system: Add explicit make rules
testcases: Make use of LTPLDLIBS
build system: Silence the output a bit more
Thanks for addressing this issue!
Works as expected:
https://travis-ci.org/github/pevik/ltp/builds/713670475
LGTM and silence output is also a nice feature.
nit: I was thinking how to reduce verbosity (adding --no-print-directory and @ into a variable), but as there is also echo, it's not worth of it.
Kind regards,
Petr