Skip to contentSkip to conversation

Fix including config.mk and features.mk in env_pre.mk

PATCH New Yuriy Kolerov 2 participants 2 messages Sep 17, 2015 – Sep 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix including config.mk and features.mk in env_pre.mk

If you try to run make in the clean sources tree then it leads to the infinite loop.

So check if config.mk or features.mk exists before inclusing and don't use "-include" form. The problem is that inclusion of these files may lead to the infinite loop if these files don't exist. It happens because config.mk and features.mk have recipes and Make tries to generate them and include them in env_pre.mk again and again until resources are exhausted.

---
 include/mk/env_pre.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
include/mk/env_pre.mk +6 -2
index 9c757e3..b8d47d4 100644
@@ -98,8 +98,12 @@ endif
 # which are filtered below (e.g. clean). However these config files may be
 # needed for those targets (eg. the open posix testsuite is not cleaned even if
 # it's enabled by configure) thus it would be wise to do silent inclusion.
--include $(abs_top_builddir)/include/mk/config.mk
--include $(abs_top_builddir)/include/mk/features.mk
+ifneq ("$(wildcard $(abs_top_builddir)/include/mk/config.mk)","")
+include $(abs_top_builddir)/include/mk/config.mk
+endif
+ifneq ("$(wildcard $(abs_top_builddir)/include/mk/features.mk)","")
+include $(abs_top_builddir)/include/mk/features.mk
+endif
 
 # autotools, *clean, and help don't require config.mk, features.mk, etc...
 ifeq ($(filter autotools %clean .gitignore gitignore.% help,$(MAKECMDGOALS)),)
Signature · 1 line
2.2.0
#1 lore raw

PATCH 1/1 Fix including config.mk and features.mk in env_pre.mk

----- Original Message -----

Quoted 9 lines

From: "Yuriy Kolerov" <[email protected]>
To: [email protected]
Cc: "Anton Kolesov" <[email protected]>, "Francois Bedard" <[email protected]>
Sent: Thursday, 17 September, 2015 8:51:57 PM
Subject: [LTP] [PATCH] Fix including config.mk and features.mk in env_pre.mk

If you try to run make in the clean sources tree then it leads to the infinite loop.

Quoted 8 lines

So check if config.mk or features.mk exists before inclusing and don't use "-include" form. The problem is that inclusion of these files may lead to the infinite loop if these files don't exist. It happens because config.mk and features.mk have recipes and Make tries to generate them and include them in env_pre.mk again and again until resources are exhausted.

Yuriy, you were first, I tested/pushed your version.

Thanks,
Jan

Quoted 32 lines
---
 include/mk/env_pre.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
include/mk/env_pre.mk +6 -2
index 9c757e3..b8d47d4 100644
@@ -98,8 +98,12 @@ endif
 # which are filtered below (e.g. clean). However these config files may be
 # needed for those targets (eg. the open posix testsuite is not cleaned even
 if
 # it's enabled by configure) thus it would be wise to do silent inclusion.
--include $(abs_top_builddir)/include/mk/config.mk
--include $(abs_top_builddir)/include/mk/features.mk
+ifneq ("$(wildcard $(abs_top_builddir)/include/mk/config.mk)","")
+include $(abs_top_builddir)/include/mk/config.mk
+endif
+ifneq ("$(wildcard $(abs_top_builddir)/include/mk/features.mk)","")
+include $(abs_top_builddir)/include/mk/features.mk
+endif
 
 # autotools, *clean, and help don't require config.mk, features.mk, etc...

ifeq ($(filter autotools %clean .gitignore gitignore.% help,$(MAKECMDGOALS)),)
--
2.2.0

--
Mailing list info: http://lists.linux.it/listinfo/ltp