Fix the load_* using test Makefiles not to link -ldl on NetBSD.
There is no such a library on NetBSD, and dlopen() is available
without a library. Quoting the manpage:
(These functions are not in a library. They are included in every
dynamically linked program automatically.)
To resolve this portably, introduce a new USE_LIBDL option. If it set
to 1, Makefile.rules automatically appends -ldl on platforms needing it.
Differential Revision: https://reviews.llvm.org/D58517
llvm-svn: 354617
31 lines
734 B
Makefile
31 lines
734 B
Makefile
LEVEL := ../../make
|
|
|
|
LIB_PREFIX := loadunload_
|
|
|
|
LD_EXTRAS := -L. -l$(LIB_PREFIX)d
|
|
CXX_SOURCES := main.cpp
|
|
USE_LIBDL := 1
|
|
|
|
include $(LEVEL)/Makefile.rules
|
|
|
|
a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool
|
|
|
|
lib_%:
|
|
$(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/$*.mk
|
|
|
|
install_name_tool:
|
|
ifeq ($(OS),Darwin)
|
|
install_name_tool -id @executable_path/libloadunload_d.dylib libloadunload_d.dylib
|
|
endif
|
|
|
|
|
|
hidden_lib_d:
|
|
$(MAKE) VPATH=$(SRCDIR)/hidden -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile
|
|
|
|
clean::
|
|
$(MAKE) -f $(SRCDIR)/a.mk clean
|
|
$(MAKE) -f $(SRCDIR)/b.mk clean
|
|
$(MAKE) -f $(SRCDIR)/c.mk clean
|
|
$(MAKE) -f $(SRCDIR)/d.mk clean
|
|
$(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean
|