Merge major BSD mutex and symbol conflict patches (bug #1816) (link patch still pending)
[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 #
20 # This needs to be updated to deal with more than just little endian machines
21 #
22 OSARCH=$(shell uname -s)
23 ifneq (${OSARCH},FreeBSD)
24 CFLAGS += -march=$(shell uname -m)
25 endif
26 CFLAGS += -DPBYTE_ORDER=PLITTLE_ENDIAN
27
28 ifeq (${OSARCH},Linux)
29 LDLIBS+=-ldl
30 endif
31
32 #############################################
33 #
34 # Only change below if you know WTF your doing
35 #
36 #
37 # Janus release directives, comment below if your brave enough for Janus
38 #OSARCH=$(shell uname -s)
39 #CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS
40 #CFLAGS += -pipe -Wall -fPIC -Wmissing-prototypes -Wmissing-declarations 
41 #CFLAGS += -D_REENTRANT -D_GNU_SOURCE
42 #CFLAGS += -I../../include
43 #CFLAGS += -I$(PWLIBDIR)/include 
44 #CFLAGS += -I$(OPENH323DIR)/include -Wno-missing-prototypes -Wno-missing-declarations
45
46 # Pre Janus release directives
47 CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS
48 CFLAGS += -pipe -Wall -fPIC
49 ifeq (${OSARCH},Linux)
50 CFLAGS += -DP_LINUX
51 LIBS+=-lpthread
52 endif
53 ifeq ($(findstring BSD,${OSARCH}),BSD)
54 CFLAGS += -pthread
55 endif
56 CFLAGS += -D_REENTRANT -D_GNU_SOURCE
57 CFLAGS += -DP_HAS_SEMAPHORES -DP_SSL -DP_PTHREADS
58 CFLAGS += -DPHAS_TEMPLATES -DPTRACING -DP_USE_PRAGMA
59 CFLAGS += -I../../include
60 CFLAGS += -I$(PWLIBDIR)/include/ptlib/unix -I$(PWLIBDIR)/include
61 CFLAGS += -I$(OPENH323DIR)/include
62 CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations
63 LIBS+= -lcrypto -lssl -lexpat
64
65 all:    libchanh323.a
66
67 samples: 
68         if [ -f $(ASTETCDIR)/h323.conf ]; then \
69                 mv -f $(ASTETCDIR)/h323.conf $(ASTETCDIR)/h323.conf.old ; \
70         fi ; 
71         install h323.conf.sample $(ASTETCDIR)/h323.conf
72  
73
74 ast_h323.o:     ast_h323.cpp
75         $(CXX) -g -c -fno-rtti -o $@ $(CFLAGS) $<
76
77 libchanh323.a:  ast_h323.o
78         ar cr libchanh323.a ast_h323.o
79
80 chan_h323.so:   
81         $(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)
82
83 chan_h323_d.so: chan_h323.o ast_h323.o
84         $(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)
85
86 chan_h323_s.so: chan_h323.o ast_h323.o
87         $(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)
88 clean:
89         rm -f *.o *.so core.* libchanh323.a
90
91