Add support for ICE/STUN/TURN in res_rtp_asterisk and chan_sip.
[asterisk/asterisk.git] / res / pjproject / pjlib-util / build / Makefile
1 # By default, the test application includes main.o.
2 # OS make file may override this with os-specific files
3 export UTIL_TEST_OBJS = main.o
4
5 include ../../build.mak
6 include ../../version.mak
7 include $(PJDIR)/build/common.mak
8
9 RULES_MAK := $(PJDIR)/build/rules.mak
10
11 PJLIB_LIB:=$(PJDIR)/pjlib/lib/libpj-$(TARGET_NAME)$(LIBEXT)
12 export PJLIB_UTIL_LIB:=../lib/libpjlib-util-$(TARGET_NAME)$(LIBEXT)
13
14 ###############################################################################
15 # Gather all flags.
16 #
17 export _CFLAGS  := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
18                    $(CFLAGS) $(CC_INC)../include $(CC_INC)../../pjlib/include
19 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
20                    $(HOST_CXXFLAGS) $(CXXFLAGS)
21 export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \
22                    $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \
23                    $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
24                    $(LDFLAGS) 
25
26 ###############################################################################
27 # Defines for building PJLIB-UTIL library
28 #
29 export PJLIB_UTIL_SRCDIR = ../src/pjlib-util
30 export PJLIB_UTIL_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
31                 base64.o crc32.o errno.o dns.o dns_dump.o dns_server.o \
32                 getopt.o hmac_md5.o hmac_sha1.o http_client.o md5.o pcap.o resolver.o \
33                 scanner.o sha1.o srv_resolver.o string.o stun_simple.o \
34                 stun_simple_client.o xml.o
35 export PJLIB_UTIL_CFLAGS += $(_CFLAGS)
36
37 ###############################################################################
38 # Defines for building test application
39 #
40 export UTIL_TEST_SRCDIR = ../src/pjlib-util-test
41 export UTIL_TEST_OBJS += xml.o encryption.o stun.o resolver_test.o test.o \
42                 http_client.o
43 export UTIL_TEST_CFLAGS += $(_CFLAGS)
44 export UTIL_TEST_LDFLAGS += $(_LDFLAGS)
45 export UTIL_TEST_EXE:=../bin/pjlib-util-test-$(TARGET_NAME)$(HOST_EXE)
46
47         
48 export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 
49 ###############################################################################
50 # Main entry
51 #
52 # $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
53 #
54 TARGETS := pjlib-util pjlib-util-test
55
56 all: $(TARGETS)
57
58 doc:
59         cd .. && rm -rf docs/$(PJ_VERSION) && doxygen docs/doxygen.cfg
60         @if [ -n "$(WWWDIR)" ] && ! [ -d "$(WWWDIR)/docs/$(PJ_VERSION)/pjlib-util/docs/html" ] ; then \
61                 echo "Creating docs/$(PJ_VERSION)/pjlib-util/docs/html" ; \
62                 mkdir -p $(WWWDIR)/docs/$(PJ_VERSION)/pjlib-util/docs/html ; \
63         fi 
64         @if [ -n "$(WWWDIR)" ] && [ -d "$(WWWDIR)/docs/$(PJ_VERSION)/pjlib-util/docs/html" ] ; then \
65                 echo "Copying docs/$(PJ_VERSION) to $(WWWDIR)/docs/$(PJ_VERSION)/pjlib-util/docs/html.." ; \
66                 cp -v -a ../docs/$(PJ_VERSION)/html/* $(WWWDIR)/docs/$(PJ_VERSION)/pjlib-util/docs/html/ ; \
67         fi
68
69 dep: depend
70 distclean: realclean
71
72 .PHONY: dep depend pjlib pjlib-test clean realclean distclean
73
74 pjlib-util:
75         $(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $(PJLIB_UTIL_LIB)
76
77 pjlib-util-test:
78         $(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $(UTIL_TEST_EXE)
79
80 .PHONY: ../lib/pjlib-util.ko
81 ../lib/pjlib-util.ko:
82         echo Making $@
83         $(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
84
85 .PHONY: ../lib/pjlib-util-test.ko
86 ../lib/pjlib-util-test.ko:
87         $(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
88
89 clean:
90         $(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
91         $(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
92
93 realclean:
94         $(subst @@,$(subst /,$(HOST_PSEP),.pjlib-util-$(TARGET_NAME).depend),$(HOST_RMR))
95         $(subst @@,$(subst /,$(HOST_PSEP),.pjlib-util-test-$(TARGET_NAME).depend),$(HOST_RMR))
96         $(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
97         $(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
98
99 depend:
100         $(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
101         $(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
102         echo '$(UTIL_TEST_EXE): $(PJLIB_UTIL_LIB) $(PJLIB_LIB)' >> .pjlib-util-test-$(TARGET_NAME).depend; \
103
104