summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2013-11-23 07:13:40 +0000
committerBenny Prijono <bennylp@teluu.com>2013-11-23 07:13:40 +0000
commit831823773e16aff2a237335145effd426d5ebf87 (patch)
treeaf728a2862c4d62796dfdf508feafa4e57f42e46 /pjlib
parentb4549841bb9e71c7856e145046795f1dd010aeb3 (diff)
Fixed #1713: Enable building the libraries as shared libraries/DLLs for GNU targets
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4656 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/build/Makefile51
-rw-r--r--pjlib/build/os-auto.mak.in2
-rw-r--r--pjlib/build/os-darwinos.mak2
-rw-r--r--pjlib/build/os-linux-kernel.mak2
-rw-r--r--pjlib/build/os-linux.mak2
-rw-r--r--pjlib/build/os-rtems.mak2
-rw-r--r--pjlib/build/os-sunos.mak2
-rw-r--r--pjlib/build/os-win32.mak2
8 files changed, 39 insertions, 26 deletions
diff --git a/pjlib/build/Makefile b/pjlib/build/Makefile
index a1c9acf9..56e5ead2 100644
--- a/pjlib/build/Makefile
+++ b/pjlib/build/Makefile
@@ -2,10 +2,18 @@ include ../../build.mak
include ../../version.mak
include $(PJDIR)/build/common.mak
+export LIBDIR := ../lib
+export BINDIR := ../bin
+
RULES_MAK := $(PJDIR)/build/rules.mak
+export PJLIB_LIB := libpj-$(TARGET_NAME)$(LIBEXT)
-export PJLIB_LIB := ../lib/libpj-$(TARGET_NAME)$(LIBEXT)
+ifeq ($(PJ_SHARED_LIBRARIES),)
+else
+export PJLIB_SONAME := libpj.$(SHLIB_SUFFIX)
+export PJLIB_SHLIB := $(PJLIB_SONAME).$(PJ_VERSION_MAJOR)
+endif
###############################################################################
# Gather all flags.
@@ -14,9 +22,9 @@ export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
$(CFLAGS) $(CC_INC)../include
export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
$(HOST_CXXFLAGS) $(CXXFLAGS)
-export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \
- $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
- $(LDFLAGS)
+export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+ $(APP_LDFLAGS) $(LDFLAGS)
+
###############################################################################
# Defines for building PJLIB library
@@ -31,6 +39,7 @@ export PJLIB_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
string.o timer.o types.o
export PJLIB_CFLAGS += $(_CFLAGS)
export PJLIB_CXXFLAGS += $(_CXXFLAGS)
+export PJLIB_LDFLAGS += $(_LDFLAGS)
###############################################################################
# Defines for building test application
@@ -46,10 +55,10 @@ export TEST_OBJS += activesock.o atomic.o echo_clt.o errno.o exception.o \
util.o
export TEST_CFLAGS += $(_CFLAGS)
export TEST_CXXFLAGS += $(_CXXFLAGS)
-export TEST_LDFLAGS += $(_LDFLAGS)
-export TEST_EXE := ../bin/pjlib-test-$(TARGET_NAME)$(HOST_EXE)
+export TEST_LDFLAGS += $(PJLIB_LDLIB) $(_LDFLAGS)
+export TEST_EXE := pjlib-test-$(TARGET_NAME)$(HOST_EXE)
+
-
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
###############################################################################
# Main entry
@@ -76,34 +85,38 @@ print:
depend: ../include/pj/config_site.h
$(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib depend
$(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test depend
- echo '$(TEST_EXE): $(PJLIB_LIB)' >> .pjlib-test-$(TARGET_NAME).depend
+ echo '$(BINDIR)/$(TEST_EXE): $(LIBDIR)/$(PJLIB_LIB)' >> .pjlib-test-$(TARGET_NAME).depend
-.PHONY: dep depend clean realclean distclean
+.PHONY: all dep depend clean realclean distclean
.PHONY: $(TARGETS)
-.PHONY: $(PJLIB_LIB) $(TEST_EXE)
+.PHONY: $(PJLIB_LIB) $(PJLIB_SONAME)
+.PHONY: $(TEST_EXE)
dep: depend
pjlib: $(PJLIB_LIB)
$(PJLIB_LIB): ../include/pj/config_site.h
- $(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib $(PJLIB_LIB)
+
+$(PJLIB_SONAME): $(PJLIB_LIB)
+$(PJLIB_LIB) $(PJLIB_SONAME):
+ $(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
../include/pj/config_site.h:
touch ../include/pj/config_site.h
pjlib-test: $(TEST_EXE)
-$(TEST_EXE): $(PJLIB_LIB)
- $(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test $(TEST_EXE)
+$(TEST_EXE): $(PJLIB_LIB) $(PJLIB_SONAME)
+ $(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test $(subst /,$(HOST_PSEP),$(BINDIR)/$@)
-.PHONY: ../lib/pjlib.ko
-../lib/pjlib.ko:
+.PHONY: pjlib.ko
+pjlib.ko:
echo Making $@
- $(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib $@
+ $(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
-.PHONY: ../lib/pjlib-test.ko
-../lib/pjlib-test.ko:
- $(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test $@
+.PHONY: pjlib-test.ko
+pjlib-test.ko:
+ $(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
clean:
$(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib clean
diff --git a/pjlib/build/os-auto.mak.in b/pjlib/build/os-auto.mak.in
index a4a2b8aa..3f35dce6 100644
--- a/pjlib/build/os-auto.mak.in
+++ b/pjlib/build/os-auto.mak.in
@@ -29,7 +29,7 @@ export TEST_LDFLAGS += @LDFLAGS@ @LIBS@
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS = pjlib pjlib-test
+export TARGETS = $(PJLIB_LIB) $(PJLIB_SONAME) $(TEST_EXE)
diff --git a/pjlib/build/os-darwinos.mak b/pjlib/build/os-darwinos.mak
index ee83decb..a0d99e71 100644
--- a/pjlib/build/os-darwinos.mak
+++ b/pjlib/build/os-darwinos.mak
@@ -33,5 +33,5 @@ export TEST_LDFLAGS += -lm
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS = pjlib pjlib-test
+export TARGETS = $(PJLIB_LIB) $(PJLIB_SONAME) $(TEST_EXE)
diff --git a/pjlib/build/os-linux-kernel.mak b/pjlib/build/os-linux-kernel.mak
index 934c8898..28cfbc79 100644
--- a/pjlib/build/os-linux-kernel.mak
+++ b/pjlib/build/os-linux-kernel.mak
@@ -42,6 +42,6 @@ export TEST_LDFLAGS += -lgcc
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS := ../lib/pjlib.ko ../lib/pjlib-test.ko
+export TARGETS := pjlib.ko pjlib-test.ko
diff --git a/pjlib/build/os-linux.mak b/pjlib/build/os-linux.mak
index 11c6fa73..78123efd 100644
--- a/pjlib/build/os-linux.mak
+++ b/pjlib/build/os-linux.mak
@@ -35,5 +35,5 @@ export TEST_LDFLAGS += -lm
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS = pjlib pjlib-test
+export TARGETS = $(PJLIB_LIB) $(PJLIB_SONAME) $(TEST_EXE)
diff --git a/pjlib/build/os-rtems.mak b/pjlib/build/os-rtems.mak
index 1501dd9b..30a81f9b 100644
--- a/pjlib/build/os-rtems.mak
+++ b/pjlib/build/os-rtems.mak
@@ -40,7 +40,7 @@ export TEST_LDFLAGS +=
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS = pjlib pjlib-test
+export TARGETS = $(PJLIB_LIB) $(TEST_EXE)
diff --git a/pjlib/build/os-sunos.mak b/pjlib/build/os-sunos.mak
index f0043ad6..7aa658da 100644
--- a/pjlib/build/os-sunos.mak
+++ b/pjlib/build/os-sunos.mak
@@ -32,5 +32,5 @@ export TEST_LDFLAGS += -lm
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS = pjlib pjlib-test
+export TARGETS = $(PJLIB_LIB) $(PJLIB_SONAME) $(TEST_EXE)
diff --git a/pjlib/build/os-win32.mak b/pjlib/build/os-win32.mak
index 0290fea9..5be3c8e5 100644
--- a/pjlib/build/os-win32.mak
+++ b/pjlib/build/os-win32.mak
@@ -29,5 +29,5 @@ export TEST_OBJS += main.o
# TARGETS are make targets in the Makefile, to be executed for this given
# operating system.
#
-export TARGETS = pjlib pjlib-test
+export TARGETS = $(PJLIB_LIB) $(TEST_EXE)