provide correct linker flags for shared library on non-darwin systems, e.g., linux

This commit is contained in:
matthias.ringwald 2009-11-23 20:28:00 +00:00
parent 6560583654
commit d1c3f5e5b0
2 changed files with 13 additions and 4 deletions

View File

@ -67,9 +67,13 @@ case "$host_os" in
RUN_LOOP_SOURCES="$RUN_LOOP_SOURCES run_loop_cocoa.m"
LDFLAGS="$LDFLAGS -framework CoreFoundation"
USE_COCOA_RUN_LOOP="yes"
BTSTACK_LIB_LDFLAGS="-dynamiclib -install_name \$(prefix)/lib/libBTstack.dylib"
BTSTACK_LIB_EXTENSION="dylib"
;;
*)
USE_COCOA_RUN_LOOP="no"
BTSTACK_LIB_LDFLAGS="-shared -Wl,-rpath,\$(prefix)/lib"
BTSTACK_LIB_EXTENSION="so"
;;
esac
@ -180,4 +184,6 @@ AC_SUBST(USE_LDID)
AC_SUBST(USB_SOURCES)
AC_SUBST(SPRINGBOARD_ACCESS_SOURCES)
AC_SUBST(RUN_LOOP_SOURCES)
AC_SUBST(BTSTACK_LIB_LDFLAGS)
AC_SUBST(BTSTACK_LIB_EXTENSION)
AC_OUTPUT(Makefile src/Makefile example/Makefile SpringBoardAccess/Makefile)

View File

@ -1,7 +1,10 @@
prefix = @prefix@
CC = @CC@
LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@ -I../include
prefix = @prefix@
BTSTACK_LIB_LDFLAGS = @BTSTACK_LIB_LDFLAGS@
BTSTACK_LIB_EXTENSION = @BTSTACK_LIB_EXTENSION@
springboard_access_sources = @SPRINGBOARD_ACCESS_SOURCES@
usb_sources = @USB_SOURCES@
@ -21,10 +24,10 @@ BTdaemon_SOURCES = $(libBTstack_SOURCES) \
platform_iphone.c \
$(springboard_access_sources)
all: libBTstack.dylib libBTstack.a BTdaemon
all: libBTstack.$(BTSTACK_LIB_EXTENSION) libBTstack.a BTdaemon
libBTstack.dylib: $(libBTstack_SOURCES)
$(CC) $(CPPFLAGS) -dynamiclib -install_name $(prefix)/lib/$@ -o $@ $(libBTstack_SOURCES) $(LDFLAGS)
libBTstack.$(BTSTACK_LIB_EXTENSION): $(libBTstack_SOURCES)
$(CC) $(CPPFLAGS) $(BTSTACK_LIB_LDFLAGS) -o $@ $(libBTstack_SOURCES) $(LDFLAGS)
@USE_LDID@ export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $@
libBTstack.a: $(libBTstack_SOURCES:.c=.o)