f5203907c9609869c78802febaa3a795e5cf0325
[asterisk/asterisk.git] / channels / h323 / Makefile
1 # include the Makefile of OpenH323 
2
3 ifndef OPENH323DIR
4 OPENH323DIR=$(HOME)/openh323
5 endif
6
7 ifndef PWLIBDIR
8 PWLIBDIR=$(HOME)/pwlib
9 endif
10
11 ifndef ASTERISKDIR
12 ASTERISKDIR= /usr/lib/asterisk/modules
13 endif
14
15 ifndef ASTETCDIR
16 ASTETCDIR=/etc/asterisk
17 endif
18
19 PWLIB_MAJOR_VERSION=$(shell cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' ')
20 PWLIB_MINOR_VERSION=$(shell cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' ')
21 PWLIB_BUILD_NUMBER=$(shell cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' ')
22 PWLIB_VERSION="${PWLIB_MAJOR_VERSION}.${PWLIB_MINOR_VERSION}.${PWLIB_BUILD_NUMBER}"
23
24 OPENH323_MAJOR_VERSION=$(shell cat ${OPENH323DIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' ')
25 OPENH323_MINOR_VERSION=$(shell cat ${OPENH323DIR}/version.h | grep MINOR_VERSION | cut -f3 -d' ')
26 OPENH323_BUILD_NUMBER=$(shell cat ${OPENH323DIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' ')
27 OPENH323_VERSION="${OPENH323_MAJOR_VERSION}.${OPENH323_MINOR_VERSION}.${OPENH323_BUILD_NUMBER}"
28
29 #
30 # This needs to be updated to deal with more than just little endian machines
31 #
32 OSARCH=$(shell uname -s)
33 PROC=$(shell uname -m)
34 ifneq (${OSARCH},FreeBSD)
35 ifneq (${OSARCH},NetBSD)
36 ifneq (${PROC},ppc)
37 CFLAGS += -march=$(PROC)
38 endif
39 endif
40 endif
41 CFLAGS += -DPBYTE_ORDER=PLITTLE_ENDIAN
42
43 ifeq (${OSARCH},Linux)
44 LDLIBS+=-ldl
45 endif
46
47 #############################################
48 #
49 # Only change below if you know WTF your doing
50 #
51 OSARCH=$(shell uname -s)
52 CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS
53 CFLAGS += -pipe -Wall -fPIC -Wmissing-prototypes
54 CFLAGS += -D_REENTRANT -D_GNU_SOURCE
55 CFLAGS += -I../../include
56 CFLAGS += -I$(PWLIBDIR)/include 
57 CFLAGS += -I$(OPENH323DIR)/include -Wno-missing-prototypes
58
59 all:    checkversion depend libchanh323.a
60
61 samples: 
62         if [ -f $(ASTETCDIR)/h323.conf ]; then \
63                 mv -f $(ASTETCDIR)/h323.conf $(ASTETCDIR)/h323.conf.old ; \
64         fi ; 
65         install h323.conf.sample $(ASTETCDIR)/h323.conf
66  
67
68 libchanh323.a:  ast_h323.o
69         ar cr libchanh323.a ast_h323.o
70         touch ../chan_h323.c
71
72 ast_h323.o:     ast_h323.cpp
73         $(CXX) -g -c -o $@ $(CFLAGS) $<
74
75 ifneq ($(wildcard .depend),)
76 include .depend
77 endif
78
79 chan_h323.so:   
80         $(CXX)  -g -shared -Xlinker -x -o chan_h323.so chan_h323.o ast_h323.o -L$(PWLIBDIR)/lib  -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib $(CHANH323LIB)
81
82 chan_h323_d.so: chan_h323.o ast_h323.o
83         $(CXX)     -shared -Xlinker -x -o chan_h323.so chan_h323.o ast_h323.o -L$(PWLIBDIR)/lib  -lpt_linux_x86_d -L$(OPENH323DIR)/lib -lh323_linux_x86_d -L/usr/lib $(CHANH323LIB)
84
85 chan_h323_s.so: chan_h323.o ast_h323.o
86         $(CXX)  -shared -Xlinker -x -o chan_h323.so chan_h323.o ast_h323.o -L$(PWLIBDIR)/lib  -lpt_linux_x86_r_s -L$(OPENH323DIR)/lib -lh323_linux_x86_r_s -L/usr/lib $(CHANH323LIB)
87 clean:
88         rm -f *.o *.so core.* libchanh323.a .depend
89
90 depend: .depend
91
92 .depend:
93         ../../mkdep $(CFLAGS) `ls *.cpp`
94
95 checkversion:
96         @echo -n "PWLib version is ${PWLIB_VERSION}... "
97         @if [ ${PWLIB_VERSION} == "1.8.1" ]; then \
98                 echo "ok" ; \
99         else \
100                 echo "BAD" ; \
101                 echo ; \
102                 echo "Please read README for further details!" ; \
103                 echo ; \
104                 exit 1 ; \
105         fi
106         @echo -n "OpenH323 version is ${OPENH323_VERSION}... "
107         @if [ ${OPENH323_VERSION} == "1.15.1" ]; then \
108                 echo "ok" ; \
109         else \
110                 echo "BAD" ; \
111                 echo ; \
112                 echo "Please read README for further details!" ; \
113                 echo ; \
114                 exit 1 ; \
115         fi