Ignore:
Timestamp:
Nov 23, 2013 7:13:40 AM (9 years ago)
Author:
bennylp
Message:

Fixed #1713: Enable building the libraries as shared libraries/DLLs for GNU targets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/build/Makefile

    r4637 r4656  
    77include $(PJDIR)/build/common.mak 
    88 
     9export LIBDIR := ../lib 
     10export BINDIR := ../bin 
     11 
    912RULES_MAK := $(PJDIR)/build/rules.mak 
    1013 
    1114PJLIB_LIB:=../../pjlib/lib/libpj-$(TARGET_NAME)$(LIBEXT) 
    1215PJLIB_UTIL_LIB:=../../pjlib-util/lib/libpjlib-util-$(TARGET_NAME)$(LIBEXT) 
    13 export PJNATH_LIB:=../lib/libpjnath-$(TARGET_NAME)$(LIBEXT) 
     16 
     17export PJNATH_LIB:=libpjnath-$(TARGET_NAME)$(LIBEXT) 
     18 
     19ifeq ($(PJ_SHARED_LIBRARIES),) 
     20else 
     21export PJNATH_SONAME := libpjnath.$(SHLIB_SUFFIX) 
     22export PJNATH_SHLIB := $(PJNATH_SONAME).$(PJ_VERSION_MAJOR) 
     23endif 
    1424 
    1525############################################################################### 
     
    2131export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \ 
    2232                   $(HOST_CXXFLAGS) $(CXXFLAGS) 
    23 export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJNATH_LIB)) \ 
    24                    $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \ 
    25                    $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \ 
    26                    $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \ 
    27                    $(LDFLAGS)  
     33export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \ 
     34                   $(APP_LDFLAGS) $(LDFLAGS)  
    2835 
    2936############################################################################### 
     
    3744export PJNATH_CFLAGS += $(_CFLAGS) 
    3845export PJNATH_CXXFLAGS += $(_CXXFLAGS) 
     46export PJNATH_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS) 
    3947 
    4048############################################################################### 
     
    4654export PJNATH_TEST_CFLAGS += $(_CFLAGS) 
    4755export PJNATH_TEST_CXXFLAGS += $(_CXXFLAGS) 
    48 export PJNATH_TEST_LDFLAGS += $(_LDFLAGS) 
    49 export PJNATH_TEST_EXE:=../bin/pjnath-test-$(TARGET_NAME)$(HOST_EXE) 
     56export PJNATH_TEST_LDFLAGS += $(PJNATH_LDLIB) $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS) 
     57export PJNATH_TEST_EXE:=pjnath-test-$(TARGET_NAME)$(HOST_EXE) 
    5058 
    5159         
     
    5765export PJTURN_CLIENT_CFLAGS += $(_CFLAGS) 
    5866export PJTURN_CLIENT_CXXFLAGS += $(_CXXFLAGS) 
    59 export PJTURN_CLIENT_LDFLAGS += $(_LDFLAGS) 
    60 export PJTURN_CLIENT_EXE:=../bin/pjturn-client-$(TARGET_NAME)$(HOST_EXE) 
     67export PJTURN_CLIENT_LDFLAGS += $(PJNATH_LDLIB) $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS) 
     68export PJTURN_CLIENT_EXE:=pjturn-client-$(TARGET_NAME)$(HOST_EXE) 
    6169 
    6270############################################################################### 
     
    6876export PJTURN_SRV_CFLAGS += $(_CFLAGS) 
    6977export PJTURN_SRV_CXXFLAGS += $(_CXXFLAGS) 
    70 export PJTURN_SRV_LDFLAGS += $(_LDFLAGS) 
    71 export PJTURN_SRV_EXE:=../bin/pjturn-srv-$(TARGET_NAME)$(HOST_EXE) 
     78export PJTURN_SRV_LDFLAGS += $(PJNATH_LDLIB) $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS) 
     79export PJTURN_SRV_EXE:=pjturn-srv-$(TARGET_NAME)$(HOST_EXE) 
    7280 
    7381         
     
    7987# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory. 
    8088# 
    81 TARGETS := pjnath pjnath-test pjturn-client pjturn-srv 
     89TARGETS := $(PJNATH_LIB) $(PJNATH_SONAME) $(PJNATH_TEST_EXE) $(PJTURN_CLIENT_EXE) $(PJTURN_SRV_EXE) 
    8290 
    8391all: $(TARGETS) 
     
    97105distclean: realclean 
    98106 
    99 .PHONY: dep depend clean realclean distclean 
     107.PHONY: all dep depend clean realclean distclean 
    100108.PHONY: $(TARGETS) 
    101 .PHONY: $(PJNATH_LIB) $(PJNATH_TEST_EXE) $(PJTURN_CLIENT_EXE) $(PJTURN_SRV_EXE) 
     109.PHONY: $(PJNATH_LIB) $(PJNATH_SONAME) 
     110.PHONY: $(PJNATH_TEST_EXE) $(PJTURN_CLIENT_EXE) $(PJTURN_SRV_EXE) 
    102111 
    103112pjnath: $(PJNATH_LIB) 
    104 $(PJNATH_LIB): 
    105         $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $(PJNATH_LIB) 
     113$(PJNATH_SONAME): $(PJNATH_LIB) 
     114$(PJNATH_LIB) $(PJNATH_SONAME): $(PJLIB_LIB) $(PJLIB_SONAME) $(PJLIB_UTIL_LIB) $(PJLIB_UTIL_SONAME) 
     115        $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $(subst /,$(HOST_PSEP),$(LIBDIR)/$@) 
    106116 
    107117pjnath-test: $(PJNATH_TEST_EXE) 
    108 $(PJNATH_TEST_EXE): $(PJNATH_LIB) 
    109         $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(PJNATH_TEST_EXE) 
     118$(PJNATH_TEST_EXE): $(PJNATH_LIB) $(PJNATH_SONAME) 
     119        $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(subst /,$(HOST_PSEP),$(BINDIR)/$@) 
    110120 
    111121pjturn-client: $(PJTURN_CLIENT_EXE) 
    112 $(PJTURN_CLIENT_EXE): $(PJNATH_LIB) 
    113         $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $(PJTURN_CLIENT_EXE) 
     122$(PJTURN_CLIENT_EXE): $(PJNATH_LIB) $(PJNATH_SONAME) 
     123        $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $(subst /,$(HOST_PSEP),$(BINDIR)/$@) 
    114124 
    115125pjturn-srv: $(PJTURN_SRV_EXE) 
    116 $(PJTURN_SRV_EXE): $(PJNATH_LIB) 
    117         $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $(PJTURN_SRV_EXE) 
     126$(PJTURN_SRV_EXE): $(PJNATH_LIB) $(PJNATH_SONAME) 
     127        $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $(subst /,$(HOST_PSEP),$(BINDIR)/$@) 
    118128 
    119 .PHONY: ../lib/pjnath.ko 
    120 ../lib/pjnath.ko: 
     129.PHONY: pjnath.ko 
     130pjnath.ko: 
    121131        echo Making $@ 
    122         $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@ 
     132        $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $(subst /,$(HOST_PSEP),$(LIBDIR)/$@) 
    123133 
    124 .PHONY: ../lib/pjnath-test.ko 
    125 ../lib/pjnath-test.ko: 
    126         $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@ 
     134.PHONY: pjnath-test.ko 
     135pjnath-test.ko: 
     136        $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(subst /,$(HOST_PSEP),$(LIBDIR)/$@) 
    127137 
    128138clean: 
     
    147157        $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@ 
    148158        $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@ 
    149         echo '$(PJNATH_TEST_EXE): $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjnath-test-$(TARGET_NAME).depend 
    150         echo '$(PJTURN_CLIENT_EXE): $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjturn-client-$(TARGET_NAME).depend 
    151         echo '$(PJTURN_SRV_EXE): $(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjturn-srv-$(TARGET_NAME).depend 
     159        echo '$(BINDIR)/$(PJNATH_TEST_EXE): $(LIBDIR)/$(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjnath-test-$(TARGET_NAME).depend 
     160        echo '$(BINDIR)/$(PJTURN_CLIENT_EXE): $(LIBDIR)/$(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjturn-client-$(TARGET_NAME).depend 
     161        echo '$(BINDIR)/$(PJTURN_SRV_EXE): $(LIBDIR)/$(PJNATH_LIB) $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjturn-srv-$(TARGET_NAME).depend 
    152162 
    153163 
Note: See TracChangeset for help on using the changeset viewer.