Skip to contentSkip to conversation

Makefile.tests: Add LIBDL make(1) variable for portability sake

PATCH Applied [email protected] 2 participants 2 messages Jan 4, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile.tests: Add LIBDL make(1) variable for portability sake

Some platforms (many, if not all, of the *BSD projects) do not provide a libdl, and instead provide the same functionality in libc. Instead of forcing these platforms to patch out the link against libdl, add a LIBDL make(1) variable to allow the -ldl argument to be excluded easily via make(1) arguments.

---
 tests/Makefile.tests | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/Makefile.tests +4 -1
index 2258135..262944a 100644
@@ -54,9 +54,12 @@ tests:	$(TESTS) $(TESTS_TREES)
 
 $(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
 
+# Not necessary on all platforms; allow -ldl to be excluded instead of forcing
+# other platforms to patch it out.
+LIBDL = -ldl
 $(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
 	@$(VECHO) LD [libdl] $@
-	$(LINK.c) -o $@ $^ -ldl
+	$(LINK.c) -o $@ $^ $(LIBDL)
 
 $(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \
 		util.o $(LIBFDT_archive)
Signature · 1 line
2.15.1

A message that is not in the archive (sent off-list or not yet received): 20180104043013.97083-1-kevans-HZy0K5TPuP5AfugRpC6u6w@public.gmane.org

Applied
#2 lore raw
Quoted 6 lines · On Wed, Jan 03, 2018 at 10:30:13PM -0600…

Some platforms (many, if not all, of the *BSD projects) do not provide a libdl, and instead provide the same functionality in libc. Instead of forcing these platforms to patch out the link against libdl, add a LIBDL make(1) variable to allow the -ldl argument to be excluded easily via make(1) arguments.

Applied, thanks.

Quoted 22 lines
---
 tests/Makefile.tests | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/Makefile.tests +4 -1
index 2258135..262944a 100644
@@ -54,9 +54,12 @@ tests:	$(TESTS) $(TESTS_TREES)
 
 $(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
 
+# Not necessary on all platforms; allow -ldl to be excluded instead of forcing
+# other platforms to patch it out.
+LIBDL = -ldl
 $(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_archive)
 	@$(VECHO) LD [libdl] $@
-	$(LINK.c) -o $@ $^ -ldl
+	$(LINK.c) -o $@ $^ $(LIBDL)
 
 $(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \
 		util.o $(LIBFDT_archive)
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson