Generalized the determination of the host library path for most platforms.

This commit is contained in:
Mark Pizzolato 2011-11-25 17:24:55 -08:00
parent a808ca561c
commit 041e192fa9

View file

@ -17,7 +17,7 @@
# #
# Dynamic loading of libpcap is the default behavior if pcap.h is # Dynamic loading of libpcap is the default behavior if pcap.h is
# available at build time. Direct calls to libpcap can be enabled # available at build time. Direct calls to libpcap can be enabled
# if GNU make is invoked with USE_NETWORK on the command line. # if GNU make is invoked with USE_NETWORK=1 on the command line.
# #
# Internal ROM support can be disabled if GNU make is invoked with # Internal ROM support can be disabled if GNU make is invoked with
# DONT_USE_ROMS=1 on the command line. # DONT_USE_ROMS=1 on the command line.
@ -37,22 +37,18 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
OS_CCDEFS = -D_GNU_SOURCE -DSIM_ASYNCH_IO OS_CCDEFS = -D_GNU_SOURCE -DSIM_ASYNCH_IO
OS_LDFLAGS = -lm OS_LDFLAGS = -lm
else # Non-Android Builds else # Non-Android Builds
INCPATH=/usr/include INCPATH:=/usr/include
LIBPATH=/usr/lib LIBPATH:=/usr/lib
OS_CCDEFS = -D_GNU_SOURCE OS_CCDEFS = -D_GNU_SOURCE
ifeq (Darwin,$(shell uname)) ifeq (Darwin,$(shell uname))
LIBEXT = dylib LIBEXT = dylib
else else
ifeq (Linux,$(shell uname)) ifeq (Linux,$(shell uname))
LIBPATH := $(sort $(foreach lib,$(shell ldconfig -p | grep ' => /' | sed 's/^.* => //'),$(dir $(lib))))
LIBEXT = so LIBEXT = so
ifeq (usrlib64,$(shell if $(TEST) -d /usr/lib64; then echo usrlib64; fi))
LIBPATH += /usr/lib64
endif
ifeq (lib32,$(shell if $(TEST) -d /usr/lib32; then echo lib32; fi))
LIBPATH += /usr/lib32
endif
else else
ifeq (SunOS,$(shell uname)) ifeq (SunOS,$(shell uname))
LIBPATH := $(shell crle | grep 'Default Library Path' | awk '{ print $$5 }' | sed 's/:/ /g')
LIBEXT = so LIBEXT = so
OS_LDFLAGS += -lsocket -lnsl OS_LDFLAGS += -lsocket -lnsl
ifeq (incsfw,$(shell if $(TEST) -d /opt/sfw/include; then echo incsfw; fi)) ifeq (incsfw,$(shell if $(TEST) -d /opt/sfw/include; then echo incsfw; fi))
@ -64,6 +60,10 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
OS_LDFLAGS += -L/opt/sfw/lib -R/opt/sfw/lib OS_LDFLAGS += -L/opt/sfw/lib -R/opt/sfw/lib
endif endif
else else
LDSEARCH :=$(shell ldconfig -r | grep 'search directories' | awk '{print $$3}' | sed 's/:/ /g')
ifneq (,$(LDSEARCH)
LIBPATH := $(LDSEARCH)
endif
ifeq (usrpkglib,$(shell if $(TEST) -d /usr/pkg/lib; then echo usrpkglib; fi)) ifeq (usrpkglib,$(shell if $(TEST) -d /usr/pkg/lib; then echo usrpkglib; fi))
LIBPATH += /usr/pkg/lib LIBPATH += /usr/pkg/lib
OS_LDFLAGS += -L/usr/pkg/lib -R/usr/pkg/lib OS_LDFLAGS += -L/usr/pkg/lib -R/usr/pkg/lib
@ -77,6 +77,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
endif endif
endif endif
endif endif
$(info lib paths are: $(LIBPATH))
ifeq (cygwin,$(findstring cygwin,$(OSTYPE))) ifeq (cygwin,$(findstring cygwin,$(OSTYPE)))
OS_CCDEFS += -O2 OS_CCDEFS += -O2
endif endif