res_pjsip_config_wizard: Memory leak in module_unload
[asterisk/asterisk.git] / third-party / pjproject / Makefile
index 7fa3902..7349db6 100644 (file)
@@ -45,6 +45,13 @@ ifeq ($(SPECIAL_TARGETS),)
         CF := $(filter-out -I%,$(CF))
         export CFLAGS += $(CF)
         export LDFLAGS += $(CC_LDFLAGS)
+        TARGETS := pjproject.symbols
+        ifeq ($(findstring TEST_FRAMEWORK,$(MENUSELECT_CFLAGS)),TEST_FRAMEWORK)
+            TARGETS += source/pjsip-apps/bin/pjsua-$(TARGET_NAME)
+            ifneq ($(PYTHONDEV_LIB),)
+                TARGETS += source/pjsip-apps/src/python/build/_pjsua.so
+            endif
+        endif
     else
         all install:
     endif
@@ -95,12 +102,10 @@ source/pjlib/build/.pjlib-$(TARGET_NAME).depend: build.mak
        $(ECHO_PREFIX) "Making dependencies"
        +$(CMD_PREFIX) $(SUBMAKE) -C source dep
 
-
 menuselect: ../../menuselect.makeopts ../../makeopts
        -$(CMD_PREFIX) test -d source && ($(SUBMAKE) -C source clean ; find source -name *.a -delete ; rm -rf source/pjsip-apps/src/python/build) || :
        -$(CMD_PREFIX) rm -rf pjproject.symbols
 
-
 source/pjlib/lib/libpj-$(TARGET_NAME).a: menuselect source/pjlib/build/.pjlib-$(TARGET_NAME).depend
        $(ECHO_PREFIX) Compiling libs
        +$(CMD_PREFIX) $(SUBMAKE) -C source lib $(REALLY_QUIET)
@@ -117,17 +122,22 @@ source/pjsip-apps/src/python/build/_pjsua.so: source/pjlib/lib/libpj-$(TARGET_NA
        $(ECHO_PREFIX) Compiling python bindings
        $(CMD_PREFIX) (cd source/pjsip-apps/src/python ; MAKE=$(MAKE) python setup.py build --build-platlib=./build $(REALLY_QUIET))
 
-_all: pjproject.symbols source/pjsip-apps/bin/pjsua-$(TARGET_NAME) source/pjsip-apps/src/python/build/_pjsua.so
+_all: $(TARGETS)
 
 _install: _all
-       $(ECHO_PREFIX) Installing apps and python bindings
        @if [ ! -d "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject" ]; then \
                $(INSTALL) -d "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject"; \
        fi;
+ifneq ($(findstring source/pjsip-apps/bin/pjsua-$(TARGET_NAME),$(TARGETS)),)
+       $(ECHO_PREFIX) Installing apps
        $(CMD_PREFIX) $(INSTALL) -m 755 source/pjsip-apps/bin/pjsua-$(TARGET_NAME) "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject/pjsua"
        $(CMD_PREFIX) $(INSTALL) -m 755 source/pjsip-apps/bin/pjsystest-$(TARGET_NAME) "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject/pjsystest"
+endif
+ifneq ($(findstring source/pjsip-apps/src/python/build/_pjsua.so,$(TARGETS)),)
+       $(ECHO_PREFIX) Installing python bindings
        $(CMD_PREFIX) $(INSTALL) -m 755 source/pjsip-apps/src/python/build/_pjsua.so "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject/"
        $(CMD_PREFIX) $(INSTALL) -m 644 source/pjsip-apps/src/python/build/pjsua.py "$(DESTDIR)$(ASTDATADIR)/third-party/pjproject/"
+endif
 
 uninstall:
        $(ECHO_PREFIX) Uninstalling apps and python bindings
@@ -135,7 +145,7 @@ uninstall:
 
 clean:
        $(ECHO_PREFIX) Cleaning
-       -$(CMD_PREFIX) test -d source && ($(SUBMAKE) -C source clean ; find source -name *.a -delete ; rm -rf source/pjsip-apps/src/python/build) || :
+       -$(CMD_PREFIX) test -d source && ($(SUBMAKE) -C source clean ; find source -name *.a -delete ; rm -rf source/pjsip-apps/src/python/build ; rm -rf source/pjsip-apps/bin/* ) || :
        -$(CMD_PREFIX) rm -rf pjproject.symbols
 
 distclean: