1EXTRA_DIST =
2SUBDIRS = . src build tests/unit
3AUTOMAKE_OPTIONS = foreign subdir-objects
4NAME = freeswitch
5
6if SYSTEM_APR
7AM_LIBAPR_CFLAGS := $(shell apr-1-config --cflags)
8AM_LIBAPR_CPPFLAGS := $(shell apr-1-config --cppflags --includes)
9AM_LIBAPR_LDFLAGS := $(shell apr-1-config --ldflags)
10AM_LIBAPR_LIBS := $(shell apr-1-config \--libs)
11AM_LIBAPR_LINKLIBTOOL := $(shell apr-1-config \--link-libtool)
12else
13AM_LIBAPR_CFLAGS := $(shell ./libs/apr/apr-1-config --cflags)
14AM_LIBAPR_CPPFLAGS := $(shell ./libs/apr/apr-1-config --cppflags --includes)
15AM_LIBAPR_LDFLAGS := $(shell ./libs/apr/apr-1-config --ldflags)
16AM_LIBAPR_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr/apr-1-config \--libs))
17endif
18if SYSTEM_APRUTIL
19AM_LIBAPU_CPPFLAGS := $(shell apu-1-config --includes)
20AM_LIBAPU_LDFLAGS := $(shell apu-1-config --ldflags)
21AM_LIBAPU_LIBS := $(shell apu-1-config \--libs)
22AM_LIBAPU_LINKLIBTOOL := $(shell apu-1-config \--link-libtool)
23else
24AM_LIBAPU_CPPFLAGS := $(shell ./libs/apr-util/apu-1-config --includes)
25AM_LIBAPU_LDFLAGS := $(shell ./libs/apr-util/apu-1-config --ldflags)
26AM_LIBAPU_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr-util/apu-1-config \--libs))
27endif
28
29
30AM_CFLAGS   = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
31AM_CPPFLAGS =
32AM_CPPFLAGS += -I$(switch_srcdir)/libs/libvpx
33AM_CPPFLAGS += $(SWITCH_AM_CXXFLAGS) -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/sdp
34AM_CPPFLAGS += -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/su -I$(switch_builddir)/libs/sofia-sip/libsofia-sip-ua/su
35AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS) $(AM_LIBAPR_LDFLAGS) $(AM_LIBAPU_LDFLAGS)
36
37DEFAULT_SOUNDS=en-us-callie-8000
38MY_DEFAULT_ARGS= --build=$(build) --host=$(host) --target=$(target) --prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)"
39
40.INTERMEDIATE: -ldl -liconv -lpthread
41
42.DEFAULT: $(switch_builddir)/modules.conf src/mod/modules.inc
43	@target=`echo $@ | sed -e 's|^.*-||'`; \
44	 target_prefix=`echo $@ | sed -e 's|-.*$$||'`; \
45	 sound_perfix=`echo $@ | sed -e 's|-.*||'`; \
46	 moh_version=`cat $(switch_srcdir)/build/moh_version.txt`;\
47	 full_sound_dir=`echo $@ | sed -e 's|^sounds||' | sed -e 's|^-||' | sed -e 's|-install$$||'`; \
48	 test ! -z $$full_sound_dir || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \
49	 base_sound_dir=`echo $$full_sound_dir | sed -e 's|-[^-]*000$$||' ` ;\
50	 sounds_version=`grep $$base_sound_dir $(switch_srcdir)/build/sounds_version.txt | cut -d ' '  -f2`;\
51	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$moh_version.tar.gz`; \
52	 echo $$full_sound_dir | grep  music  >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
53	 args="$@"; if test -z "$$args" || test "$${args#-l*}" = "$$args"; then \
54	   if test "$$target_prefix" = "sounds"; then \
55	     if test "$$target" = "install"; then \
56	        $(GETSOUNDS) $$soundfile $(DESTDIR)$(soundsdir)/;\
57	     else \
58	        $(GETSOUNDS) $$soundfile ; \
59	     fi; \
60	   else \
61	     if test "$$target" = "install"; then \
62	        $(MAKE) $(AM_MAKEFLAGS) core_install && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ; \
63	     else \
64		if test "$$target" = "clean"; then \
65		        cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
66		else \
67		        $(MAKE) $(AM_MAKEFLAGS) core && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
68		fi; \
69	     fi; \
70	   fi; fi
71
72sounds: sounds-en-us-callie-8000
73sounds-install: sounds-en-us-callie-8000-install
74sounds-allison: sounds-en-us-allison-8000
75sounds-allison-install: sounds-en-us-allison-8000-install
76sounds-ru: sounds-ru-RU-elena-8000
77sounds-ru-install: sounds-ru-RU-elena-8000-install
78sounds-fr: sounds-fr-ca-june-8000
79sounds-fr-install: sounds-fr-ca-june-8000-install
80moh: sounds-music-8000
81moh-install: sounds-music-8000-install
82
83hd-sounds: sounds sounds-en-us-callie-16000
84hd-sounds-install: sounds-install sounds-en-us-callie-16000-install
85hd-sounds-allison: sounds-allison sounds-en-us-allison-16000
86hd-sounds-allison-install: sounds-allison-install sounds-en-us-allison-16000-install
87hd-sounds-ru: sounds-ru sounds-ru-RU-elena-16000
88hd-sounds-ru-install: sounds-ru-install sounds-ru-RU-elena-16000-install
89hd-sounds-fr: sounds-fr-ca-june-16000
90hd-sounds-fr-install: sounds-fr-ca-june-16000-install
91hd-moh: moh sounds-music-16000
92hd-moh-install: moh-install sounds-music-16000-install
93
94uhd-sounds: hd-sounds sounds-en-us-callie-32000
95uhd-sounds-install: hd-sounds-install sounds-en-us-callie-32000-install
96uhd-sounds-allison: hd-sounds-allison sounds-en-us-allison-32000
97uhd-sounds-allison-install: hd-sounds-allison-install sounds-en-us-allison-32000-install
98uhd-sounds-ru: hd-sounds-ru sounds-ru-RU-elena-32000
99uhd-sounds-ru-install: hd-sounds-ru-install sounds-ru-RU-elena-32000-install
100uhd-sounds-fr: sounds-fr-ca-june-32000
101uhd-sounds-fr-install: sounds-fr-ca-june-32000-install
102uhd-moh: hd-moh sounds-music-32000
103uhd-moh-install: hd-moh-install sounds-music-32000-install
104
105cd-sounds: uhd-sounds sounds-en-us-callie-48000
106cd-sounds-install: uhd-sounds-install sounds-en-us-callie-48000-install
107cd-sounds-allison: uhd-sounds-allison sounds-en-us-allison-48000
108cd-sounds-allison-install: uhd-sounds-allison-install sounds-en-us-allison-48000-install
109cd-sounds-ru: uhd-sounds-ru sounds-ru-RU-elena-48000
110cd-sounds-ru-install: uhd-sounds-ru-install sounds-ru-RU-elena-48000-install
111cd-sounds-fr: sounds-fr-ca-june-48000
112cd-sounds-fr-install: sounds-fr-ca-june-48000-install
113cd-moh: uhd-moh sounds-music-48000
114cd-moh-install: uhd-moh-install sounds-music-48000-install
115
116# This directory's subdirectories are mostly independent; you can cd
117# into them and run `make' without going through this Makefile.
118# To change the values of `make' variables: instead of editing Makefiles,
119# (1) if the variable is set in `config.status', edit `config.status'
120#     (which will cause the Makefiles to be regenerated when you run `make');
121# (2) otherwise, pass the desired values on the `make' command line.
122all-recursive: libfreeswitch.la
123clean-recusive: clean_core
124install-recursive: install-libLTLIBRARIES install-binPROGRAMS
125
126CORE_CFLAGS  = $(AM_LIBAPR_CFLAGS) $(AM_LIBAPR_CPPFLAGS)
127CORE_CFLAGS += $(AM_LIBAPU_CPPFLAGS)
128CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include
129if ENABLE_LIBYUV
130CORE_CFLAGS += -I$(switch_srcdir)/libs/libyuv/include
131CORE_CFLAGS += -DSWITCH_HAVE_YUV
132endif
133CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
134CORE_CFLAGS += -I$(switch_builddir)/libs/spandsp/src -I$(switch_srcdir)/libs/spandsp/src
135if ENABLE_LIBVPX
136CORE_CFLAGS += -DSWITCH_HAVE_VPX
137endif
138
139APR_LIBS   = $(AM_LIBAPU_LIBS) $(AM_LIBAPR_LIBS)
140CORE_LIBS=
141
142if ENABLE_LIBVPX
143CORE_LIBS += libs/libvpx/libvpx.a
144endif
145if SYSTEM_APRUTIL
146CORE_LIBS += $(AM_LIBAPU_LINKLIBTOOL)
147else
148CORE_LIBS +=  libs/apr-util/libaprutil-1.la
149endif
150if SYSTEM_APR
151CORE_LIBS += $(AM_LIBAPR_LINKLIBTOOL)
152else
153CORE_LIBS += libs/apr/libapr-1.la
154endif
155
156if ENABLE_SRTP
157CORE_CFLAGS += -DENABLE_SRTP
158CORE_LIBS += libs/srtp/libsrtp.la
159endif
160
161MOD_LINK      = $(switch_srcdir)/libfreeswitch.la
162CLEANFILES    = src/include/switch_version.h src/include/switch_swigable_cpp.h
163BUILT_SOURCES = src/mod/modules.inc src/include/switch_version.h src/include/switch_swigable_cpp.h
164
165if HAVE_ODBC
166CORE_CFLAGS += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
167endif
168
169if HAVE_PNG
170CORE_CFLAGS += -DSWITCH_HAVE_PNG $(LIBPNG_CFLAGS)
171endif
172
173if HAVE_FREETYPE
174CORE_CFLAGS += -DSWITCH_HAVE_FREETYPE $(LIBFREETYPE_CFLAGS)
175endif
176
177if HAVE_GUMBO
178CORE_CFLAGS += -DSWITCH_HAVE_GUMBO $(LIBGUMBO_CFLAGS)
179endif
180
181if HAVE_FVAD
182CORE_CFLAGS += -DSWITCH_HAVE_FVAD $(LIBFVAD_CFLAGS)
183endif
184
185##
186## libfreeswitch
187##
188noinst_LTLIBRARIES        = libfreeswitch_spandsp.la
189if ENABLE_LIBYUV
190noinst_LTLIBRARIES += libfreeswitch_libyuv.la
191endif
192libfreeswitch_spandsp_la_SOURCES = libs/spandsp/src/plc.c libs/spandsp/src/alloc.c libs/spandsp/src/bit_operations.c
193libfreeswitch_spandsp_la_CFLAGS  = -Ilibs/spandsp/src $(CORE_CFLAGS) $(AM_CFLAGS)
194CORE_LIBS+=libfreeswitch_spandsp.la
195
196if ENABLE_LIBYUV
197libfreeswitch_libyuv_la_SOURCES = \
198libs/libyuv/source/compare.cc	\
199libs/libyuv/source/compare_common.cc	\
200libs/libyuv/source/compare_gcc.cc	\
201libs/libyuv/source/compare_mmi.cc	\
202libs/libyuv/source/compare_msa.cc	\
203libs/libyuv/source/compare_neon64.cc	\
204libs/libyuv/source/compare_neon.cc	\
205libs/libyuv/source/compare_win.cc	\
206libs/libyuv/source/convert_argb.cc	\
207libs/libyuv/source/convert.cc	\
208libs/libyuv/source/convert_from_argb.cc	\
209libs/libyuv/source/convert_from.cc	\
210libs/libyuv/source/convert_jpeg.cc	\
211libs/libyuv/source/convert_to_argb.cc	\
212libs/libyuv/source/convert_to_i420.cc	\
213libs/libyuv/source/cpu_id.cc	\
214libs/libyuv/source/mjpeg_decoder.cc	\
215libs/libyuv/source/mjpeg_validate.cc	\
216libs/libyuv/source/planar_functions.cc	\
217libs/libyuv/source/rotate_any.cc	\
218libs/libyuv/source/rotate_argb.cc	\
219libs/libyuv/source/rotate.cc	\
220libs/libyuv/source/rotate_common.cc	\
221libs/libyuv/source/rotate_gcc.cc	\
222libs/libyuv/source/rotate_mmi.cc	\
223libs/libyuv/source/rotate_msa.cc	\
224libs/libyuv/source/rotate_neon64.cc	\
225libs/libyuv/source/rotate_neon.cc	\
226libs/libyuv/source/rotate_win.cc	\
227libs/libyuv/source/row_any.cc	\
228libs/libyuv/source/row_common.cc	\
229libs/libyuv/source/row_gcc.cc	\
230libs/libyuv/source/row_mmi.cc	\
231libs/libyuv/source/row_msa.cc	\
232libs/libyuv/source/row_neon64.cc	\
233libs/libyuv/source/row_neon.cc	\
234libs/libyuv/source/row_win.cc	\
235libs/libyuv/source/scale_any.cc	\
236libs/libyuv/source/scale_argb.cc	\
237libs/libyuv/source/scale.cc	\
238libs/libyuv/source/scale_common.cc	\
239libs/libyuv/source/scale_gcc.cc	\
240libs/libyuv/source/scale_mmi.cc	\
241libs/libyuv/source/scale_msa.cc	\
242libs/libyuv/source/scale_neon64.cc	\
243libs/libyuv/source/scale_neon.cc	\
244libs/libyuv/source/scale_win.cc	\
245libs/libyuv/source/video_common.cc
246
247
248libfreeswitch_libyuv_la_CPPFLAGS = -O2 -fomit-frame-pointer -Ilibs/libyuv/include
249CORE_LIBS+=libfreeswitch_libyuv.la
250endif
251
252lib_LTLIBRARIES	         = libfreeswitch.la
253libfreeswitch_la_CFLAGS  = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(GUMBO_CFLAGS) $(FVAD_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS)  $(AM_CFLAGS) $(TPL_CFLAGS)
254libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS) -no-undefined
255libfreeswitch_la_LIBADD  = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS)
256libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
257
258if HAVE_PNG
259libfreeswitch_la_LIBADD += $(LIBPNG_LIBS)
260endif
261
262if HAVE_ODBC
263libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
264endif
265
266if ENABLE_ZRTP
267CORE_CFLAGS += -I$(switch_srcdir)/libs/libzrtp/third_party/bgaes
268CORE_CFLAGS += -I$(switch_srcdir)/libs/libzrtp/third_party/bnlib
269CORE_CFLAGS += -isystem $(switch_srcdir)/libs/libzrtp/include
270ZRTP_LDFLAGS = -L$(switch_srcdir)/libs/libzrtp/third_party/bnlib
271ZRTP_LDFLAGS += -L$(switch_srcdir)/libs/libzrtp
272ZRTP_LIBS = -lbn -lzrtp
273libfreeswitch_la_LDFLAGS += $(ZRTP_LDFLAGS)
274libfreeswitch_la_LIBADD += $(ZRTP_LIBS)
275CORE_LIBS += libs/libzrtp/libzrtp.a
276LIBS += libs/libzrtp/third_party/bnlib/libbn.a
277endif
278
279library_includetestdir = $(includedir)/test
280library_includetest_HEADERS = \
281	src/include/test/switch_fct.h \
282	src/include/test/switch_test.h
283
284library_includedir      = $(includedir)
285library_include_HEADERS = \
286	src/include/switch_am_config.h \
287	src/include/switch.h \
288	src/include/switch_apr.h \
289	src/include/switch_buffer.h \
290	src/include/switch_caller.h \
291	src/include/switch_channel.h \
292	src/include/switch_console.h \
293	src/include/switch_core_event_hook.h \
294	src/include/switch_scheduler.h \
295	src/include/switch_core.h \
296	src/include/switch_core_media.h \
297	src/include/switch_core_video.h \
298	src/include/switch_core_db.h \
299	src/include/switch_mprintf.h \
300	src/include/switch_config.h \
301	src/include/switch_event.h \
302	src/include/switch_frame.h \
303	src/include/switch_ivr.h \
304	src/include/switch_dso.h \
305	src/include/switch_loadable_module.h \
306	src/include/switch_module_interfaces.h \
307	src/include/switch_platform.h \
308	src/include/switch_resample.h \
309	src/include/switch_regex.h \
310	src/include/switch_types.h \
311	src/include/switch_utils.h \
312	src/include/switch_rtp.h \
313	src/include/switch_jitterbuffer.h \
314	src/include/switch_estimators.h \
315	src/include/switch_rtcp_frame.h \
316	src/include/switch_stun.h \
317	src/include/switch_nat.h \
318	src/include/switch_log.h \
319	src/include/switch_xml.h \
320	src/include/switch_xml_config.h \
321	src/include/switch_cpp.h \
322	src/include/switch_curl.h \
323	src/include/switch_cJSON.h \
324	src/include/switch_cJSON_Utils.h \
325	src/include/switch_json.h \
326	src/include/switch_utf8.h \
327	src/include/switch_msrp.h \
328	src/include/switch_vpx.h \
329	src/include/switch_vad.h \
330	libs/libteletone/src/libteletone_detect.h \
331	libs/libteletone/src/libteletone_generate.h \
332	libs/libteletone/src/libteletone.h \
333	src/include/switch_limit.h \
334	src/include/switch_odbc.h \
335	src/include/switch_hashtable.h \
336	src/include/switch_image.h
337
338nodist_libfreeswitch_la_SOURCES = \
339	src/include/switch_frame.h \
340	src/include/switch_swigable_cpp.h \
341	src/include/switch_version.h
342
343libfreeswitch_la_SOURCES = \
344	src/switch_apr.c \
345	src/switch_buffer.c \
346	src/switch_caller.c \
347	src/switch_channel.c \
348	src/switch_console.c \
349	src/switch_mprintf.c \
350	src/switch_core_media_bug.c \
351	src/switch_core_timer.c \
352	src/switch_core_asr.c \
353	src/switch_core_event_hook.c \
354	src/switch_core_speech.c \
355	src/switch_core_memory.c \
356	src/switch_core_codec.c \
357	src/switch_core_file.c \
358	src/switch_core_cert.c \
359	src/switch_core_hash.c \
360	src/switch_core_sqldb.c \
361	src/switch_core_session.c \
362	src/switch_core_directory.c \
363	src/switch_core_state_machine.c \
364	src/switch_core_io.c \
365	src/switch_core_rwlock.c \
366	src/switch_core_port_allocator.c \
367	src/switch_core.c \
368	src/switch_version.c \
369	src/switch_core_media.c \
370	src/switch_core_video.c \
371	src/switch_sdp.c \
372	src/switch_scheduler.c \
373	src/switch_core_db.c \
374	src/switch_dso.c \
375	src/switch_loadable_module.c \
376	src/switch_utils.c \
377	src/switch_event.c \
378	src/switch_resample.c \
379	src/switch_regex.c \
380	src/switch_rtp.c \
381	src/switch_jitterbuffer.c \
382	src/switch_estimators.c \
383	src/switch_ivr_bridge.c \
384	src/switch_ivr_originate.c \
385	src/switch_ivr_async.c \
386	src/switch_ivr_play_say.c \
387	src/switch_ivr_say.c \
388	src/switch_ivr_menu.c \
389	src/switch_ivr.c \
390	src/switch_stun.c \
391	src/switch_nat.c \
392	src/switch_log.c \
393	src/switch_xml.c \
394	src/switch_xml_config.c \
395	src/switch_config.c \
396	src/switch_time.c \
397	src/switch_odbc.c \
398	src/switch_limit.c \
399	src/g711.c \
400	src/switch_pcm.c \
401	src/switch_speex.c \
402	src/switch_profile.c \
403	src/cJSON.c \
404	src/cJSON_Utils.c \
405	src/switch_json.c \
406	src/switch_curl.c \
407	src/switch_hashtable.c\
408	src/switch_utf8.c \
409	src/switch_msrp.c \
410	src/switch_vad.c \
411	src/switch_vpx.c \
412	libs/libteletone/src/libteletone_detect.c \
413	libs/libteletone/src/libteletone_generate.c \
414	libs/miniupnpc/miniwget.c \
415	libs/miniupnpc/minixml.c \
416	libs/miniupnpc/igd_desc_parse.c \
417	libs/miniupnpc/minisoap.c \
418	libs/miniupnpc/miniupnpc.c \
419	libs/miniupnpc/upnpreplyparse.c \
420	libs/miniupnpc/upnpcommands.c \
421	libs/miniupnpc/minissdpc.c \
422	libs/miniupnpc/upnperrors.c \
423	libs/libnatpmp/natpmp.c \
424	libs/libnatpmp/getgateway.c
425
426if ENABLE_CPP
427libfreeswitch_la_SOURCES += src/switch_cpp.cpp
428endif
429
430$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/modules.conf
431
432src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h
433	cat $(switch_srcdir)/src/include/switch_cpp.h | perl $(switch_srcdir)/build/strip.pl > $(switch_srcdir)/src/include/switch_swigable_cpp.h
434#	$(CC) -E $(switch_srcdir)/src/include/switch_cpp.h \
435#		-I$(switch_srcdir)/src/include -I$(switch_srcdir)/libs/libteletone/src \
436#		-DSWITCH_DECLARE_CLASS= -DSWITCH_DECLARE\(x\)=x -DSWITCH_DECLARE_CONSTRUCTOR= \
437#		-DSWITCH_DECLARE_NONSTD\(x\)=x 2>/dev/null | grep -v "^#" > src/include/switch_swigable_cpp.h
438
439##
440## Applications
441##
442bin_PROGRAMS = freeswitch fs_cli fs_ivrd tone2wav fs_encode fs_tts
443
444##
445## fs_cli ()
446##
447fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c \
448	libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c libs/esl/src/esl_json.c libs/esl/src/esl_buffer.c libs/esl/src/cJSON.c libs/esl/src/cJSON_Utils.c
449fs_cli_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include $(LIBEDIT_CFLAGS)
450fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS) -lm $(LIBEDIT_LIBS)
451
452if DISABLE_CC
453fs_cli_CFLAGS += -DDISABLE_CC
454endif
455
456##
457## fs_encode ()
458##
459fs_encode_SOURCES = src/fs_encode.c
460fs_encode_CFLAGS  = $(AM_CFLAGS)
461fs_encode_LDFLAGS = $(AM_LDFLAGS)
462fs_encode_LDADD   = libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
463
464if HAVE_ODBC
465fs_encode_LDADD += $(ODBC_LIB_FLAGS)
466endif
467
468##
469## fs_tts ()
470##
471fs_tts_SOURCES = src/fs_tts.c
472fs_tts_CFLAGS  = $(AM_CFLAGS)
473fs_tts_LDFLAGS = $(AM_LDFLAGS)
474fs_tts_LDADD   = libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
475
476##
477## tone2wav ()
478##
479tone2wav_SOURCES = src/tone2wav.c
480tone2wav_CFLAGS  = $(AM_CFLAGS)
481tone2wav_LDFLAGS = $(AM_LDFLAGS)
482tone2wav_LDADD   = libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
483
484if HAVE_ODBC
485tone2wav_LDADD += $(ODBC_LIB_FLAGS)
486endif
487
488
489##
490## fs_ivrd ()
491##
492fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c \
493	libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c libs/esl/src/esl_json.c libs/esl/src/esl_buffer.c libs/esl/src/cJSON.c libs/esl/src/cJSON_Utils.c
494fs_ivrd_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include
495fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS) -lm
496
497##
498## freeswitch ()
499##
500nodist_freeswitch_SOURCES = src/include/switch_version.h
501freeswitch_SOURCES = src/switch.c
502freeswitch_CFLAGS  = $(AM_CFLAGS) $(CORE_CFLAGS)
503freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
504freeswitch_LDADD   = libfreeswitch.la libs/apr/libapr-1.la
505
506if HAVE_ODBC
507freeswitch_LDADD += $(ODBC_LIB_FLAGS)
508endif
509
510
511##
512## Scripts
513##
514bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
515
516scripts/fsxs: scripts/fsxs.in
517	@echo creating fsxs
518	@sed -e "s,@MODULES_DIR\@,@modulesdir@," \
519	    -e "s,@LIB_DIR\@,@libdir@," \
520	    -e "s,@BIN_DIR\@,@bindir@," \
521	    -e "s,@INC_DIR\@,@includedir@," \
522	    -e "s,@CFG_DIR\@,@confdir@," \
523	    -e "s,@DB_DIR\@,@dbdir@," \
524	    -e "s,@PREFIX\@,@prefix@," \
525	    -e "s,@CC\@,$(CC)," \
526	    -e "s,@LD\@,$(CC)," \
527	    -e "s,@INSTALL\@,$(INSTALL)," \
528	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
529	    \
530	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
531	    -e "s|@INCLUDES\@|-I$(prefix)/include|" \
532	    -e "s|@SOLINK\@|$(SOLINK)|" \
533	    -e "s|@LDFLAGS\@|-L$(prefix)/lib|" \
534	    -e "s|@LIBS\@||" \
535	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
536
537##
538## misc
539##
540
541pkgconfigdir   = @pkgconfigdir@
542pkgconfig_DATA = build/freeswitch.pc
543
544$(switch_builddir)/modules.conf:
545	if test -f $@; then touch $@; else cp $(switch_srcdir)/build/modules.conf.in $@ ;fi
546
547src/mod/modules.inc: $(switch_builddir)/modules.conf
548	@echo "OUR_MODULES=$(OUR_MODS)" > $(switch_builddir)/src/mod/modules.inc
549	@echo "OUR_CLEAN_MODULES=$(OUR_CLEAN_MODS)" >> $(switch_builddir)/src/mod/modules.inc
550	@echo "OUR_TEST_MODULES=$(OUR_TEST_MODS)" >> $(switch_builddir)/src/mod/modules.inc
551	@echo "OUR_CHECK_MODULES=$(OUR_CHECK_MODS)" >> $(switch_builddir)/src/mod/modules.inc
552	@echo "OUR_INSTALL_MODULES=$(OUR_INSTALL_MODS)" >> $(switch_builddir)/src/mod/modules.inc
553	@echo "OUR_UNINSTALL_MODULES=$(OUR_UNINSTALL_MODS)" >> $(switch_builddir)/src/mod/modules.inc
554	@echo "OUR_DISABLED_MODULES=$(OUR_DISABLED_MODS)" >> $(switch_builddir)/src/mod/modules.inc
555	@echo "OUR_DISABLED_CLEAN_MODULES=$(OUR_DISABLED_CLEAN_MODS)" >> $(switch_builddir)/src/mod/modules.inc
556	@echo "OUR_DISABLED_INSTALL_MODULES=$(OUR_DISABLED_INSTALL_MODS)" >> $(switch_builddir)/src/mod/modules.inc
557	@echo "OUR_DISABLED_UNINSTALL_MODULES=$(OUR_DISABLED_UNINSTALL_MODS)" >> $(switch_builddir)/src/mod/modules.inc
558
559$(OUR_MODULES): $(switch_builddir)/modules.conf libfreeswitch.la src/mod/modules.inc
560	@set fnord $$MAKEFLAGS; amf=$$2; \
561	(cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \
562	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
563	test -z "$$fail"
564
565$(switch_builddir)/build/print_git_revision: $(switch_srcdir)/build/print_git_revision.c
566	$(CC_FOR_BUILD) -o $@ $<
567
568src/switch_version.lo: src/include/switch_version.h
569
570src/include/switch_version.h: src/include/switch_version.h.in Makefile $(switch_builddir)/build/print_git_revision $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
571	@cat $< > $@; \
572	if [ -d $(switch_srcdir)/.git ] && [ -n "$$(which git)" ]; then \
573	  xver="$$(cd $(switch_srcdir)/ && $(switch_builddir)/build/print_git_revision)"; \
574	  xhver="$$(cd $(switch_srcdir)/ && $(switch_builddir)/build/print_git_revision -h)"; \
575	  sed \
576	    -e "/#define *SWITCH_VERSION_REVISION[^a-zA-Z0-9_]/{s/\"\([^\"]*\)\"/\"\1$$xver\"/;}" \
577	    -e "/#define *SWITCH_VERSION_REVISION_HUMAN[^a-zA-Z0-9_]/{s/\"\([^\"]*\)\"/\"\1$$xhver\"/;}" \
578	    $< > $@; \
579	fi;
580
581##
582## Dependency targets
583##
584libs/libedit/src/.libs/libedit.a:
585	cd libs/libedit && $(MAKE)
586
587libs/libzrtp/libzrtp.a:
588	cd libs/libzrtp && $(MAKE)
589
590libs/libvpx/Makefile: libs/libvpx/.update
591	cd libs/libvpx && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS) $(VISIBILITY_FLAG)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384
592
593libs/libvpx/libvpx.a: libs/libvpx/Makefile libs/libvpx/.update
594	@cd libs/libvpx && $(MAKE)
595
596libs/sofia-sip/Makefile:
597	cd libs/sofia-sip && sh ./configure.gnu $(MY_DEFAULT_ARGS)
598
599libs/sofia-sip/libsofia-sip-ua/sdp/.libs/libsdp.a libs/sofia-sip/libsofia-sip-ua/su/.libs/libsu.a: libs/sofia-sip/.update libs/sofia-sip/Makefile
600	@cd libs/sofia-sip && $(MAKE) noop
601	@cd libs/sofia-sip && $(MAKE) SOFIA_CFLAGS="$(SWITCH_AM_CFLAGS)"
602	@$(TOUCH_TARGET)
603
604libs/apr/Makefile: libs/apr/Makefile.in libs/apr/config.status libs/apr libs/apr/.update
605	@cd libs/apr && ./config.status
606	@$(TOUCH_TARGET)
607
608libs/apr/libapr-1.la: libs/apr/Makefile libs/apr/.update
609	@if [ $(MAKELEVEL) = 0 -o -z "`echo "$(MAKEARGS)" | grep  "j"`" ] ; then touch $(switch_srcdir)/src/include/switch.h; cd libs/apr && $(MAKE) $(MFLAGS) && touch libapr-1.la; fi
610
611libs/apr-util/libaprutil-1.la: libs/apr/libapr-1.la libs/apr-util libs/apr-util/.update
612	@if [ $(MAKELEVEL) = 0 -o -z "`echo "$(MAKEARGS)" | grep  "j"`" ] ; then touch $(switch_srcdir)/src/include/switch.h; cd libs/apr-util && $(MAKE) $(MFLAGS) && touch libaprutil-1.la; fi
613
614SRTP_SRC =	libs/srtp/srtp/srtp.c libs/srtp/srtp/ekt.c libs/srtp/crypto/cipher/cipher.c libs/srtp/crypto/cipher/null_cipher.c \
615		libs/srtp/crypto/cipher/aes.c libs/srtp/crypto/cipher/aes_icm.c \
616		libs/srtp/crypto/hash/null_auth.c libs/srtp/crypto/hash/sha1.c \
617		libs/srtp/crypto/hash/hmac.c libs/srtp/crypto/hash/auth.c \
618		libs/srtp/crypto/math/datatypes.c libs/srtp/crypto/math/stat.c \
619		libs/srtp/crypto/kernel/crypto_kernel.c libs/srtp/crypto/kernel/alloc.c \
620		libs/srtp/crypto/kernel/key.c libs/srtp/crypto/kernel/err.c \
621		libs/srtp/crypto/replay/rdb.c libs/srtp/crypto/replay/rdbx.c libs/srtp/crypto/replay/ut_sim.c
622
623libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update $(SRTP_SRC)
624	touch $(switch_srcdir)/src/include/switch.h
625	@cd libs/srtp && $(MAKE)
626	@$(TOUCH_TARGET)
627
628##
629## helper targets
630##
631yaml-files:
632	@echo `mkdir $(DESTDIR)$(confdir)/yaml 2>/dev/null`
633	$(INSTALL) -m 644 $(switch_srcdir)/conf/default/yaml/*.yaml $(DESTDIR)$(confdir)/yaml
634
635vm-sync:
636	test -d $(DESTDIR)$(confdir) || $(mkinstalldirs) $(DESTDIR)$(confdir)
637	test -d $(DESTDIR)$(confdir)/lang || $(mkinstalldirs) $(DESTDIR)$(confdir)/lang
638	test -d $(DESTDIR)$(confdir)/lang/en || $(mkinstalldirs) $(DESTDIR)$(confdir)/lang/en
639	test -d $(DESTDIR)$(confdir)/lang/en/demo || $(mkinstalldirs) $(DESTDIR)$(confdir)/lang/en/demo
640	test -d $(DESTDIR)$(confdir)/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(confdir)/lang/en/vm
641	$(INSTALL) -m 644 $(switch_srcdir)/conf/vanilla/lang/en/vm/* $(DESTDIR)$(confdir)/lang/en/vm
642	$(INSTALL) -m 644 $(switch_srcdir)/conf/vanilla/lang/en/demo/* $(DESTDIR)$(confdir)/lang/en/demo
643
644config-%:
645	test -d $(DESTDIR)$(confdir) || $(mkinstalldirs) $(DESTDIR)$(confdir)
646	for conffile in `cd $(switch_srcdir)/conf/$* && find . -name \*.xml && find . -name \*.conf && find . -name \*.tpl  && find . -name \*.ttml && find . -name mime.types` ; do \
647		dir=`echo $$conffile | sed -e 's|^\.||' | sed -e 's|/[^/]*$$||'`; \
648		filename=`echo $$conffile | sed -e 's|^\.||' | sed -e 's|^.*/||'`; \
649		test -d $(DESTDIR)$(confdir)$$dir || $(mkinstalldirs) $(DESTDIR)$(confdir)$$dir ; \
650		test -f $(DESTDIR)$(confdir)$$dir/$$filename || \
651		test -f $(DESTDIR)$(confdir)$$dir/$$filename.noload || \
652			$(INSTALL) -m 644 $(switch_srcdir)/conf/$*/$$dir/$$filename $(DESTDIR)$(confdir)$$dir; \
653	done
654
655samples-conf: config-vanilla
656
657samples-htdocs:
658	test -d $(DESTDIR)$(htdocsdir) || $(mkinstalldirs) $(DESTDIR)$(htdocsdir)
659	for htdocsfile in `cd $(switch_srcdir)/htdocs && find . -type f -name \* | sed -e 's|^\.||'` ; do \
660		dir=`echo $$htdocsfile | sed -e 's|/[^/]*$$||'`; \
661		filename=`echo $$htdocsfile | sed -e 's|^.*/||'`; \
662		test -d $(DESTDIR)$(htdocsdir)$$dir || $(mkinstalldirs) $(DESTDIR)$(htdocsdir)$$dir ; \
663		test -f $(DESTDIR)$(htdocsdir)$$dir/$$filename || $(INSTALL) -m 644 $(switch_srcdir)/htdocs/$$dir/$$filename $(DESTDIR)$(htdocsdir)$$dir 2>/dev/null;  \
664	done
665
666
667fonts_DATA = fonts/FreeMono.ttf fonts/FreeMonoOblique.ttf fonts/FreeSansBoldOblique.ttf fonts/FreeSerifBold.ttf fonts/OFL.txt fonts/FreeMonoBold.ttf fonts/FreeSans.ttf fonts/FreeSansOblique.ttf fonts/FreeSerifBoldItalic.ttf fonts/README.fonts fonts/FreeMonoBoldOblique.ttf fonts/FreeSansBold.ttf fonts/FreeSerif.ttf fonts/FreeSerifItalic.ttf
668
669images_DATA = images/default-avatar.png	images/default-mute.png
670
671samples: samples-conf samples-htdocs
672
673install-exec-local:
674	$(mkinstalldirs) $(DESTDIR)$(modulesdir)
675
676install-data-local:
677	@echo Installing $(NAME)
678	@for x in $(modulesdir) $(runtimedir) $(dbdir) $(logfiledir) $(logfiledir)/xml_cdr $(bindir) $(scriptdir) $(recordingsdir) $(grammardir) $(imagesdir) $(fontsdir); do \
679		$(mkinstalldirs) $(DESTDIR)$$x ; \
680	 done
681	test -d $(DESTDIR)$(confdir) || $(MAKE) samples-conf
682	test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs
683
684is-scm:
685	@if [ ! -d .git ] ; then \
686		echo ; echo ; \
687		echo "*****************************************************************************************************" ; \
688		echo "You cannot update a release tarball without a git tree.  Please clone FreeSWITCH as so:              " ; \
689		echo "  git clone https://github.com/signalwire/freeswitch.git                                             " ; \
690		echo "*****************************************************************************************************" ; \
691		echo ; echo ; \
692		exit 1; \
693	fi
694
695update: is-scm
696	@if test -d .git ; then \
697	  echo "Pulling updates..." ; \
698	  git pull ; \
699	else \
700	  echo "This source directory is not a git tree." ; \
701	fi
702
703.nodepends:
704	touch .nodepends
705
706nodepends: .nodepends
707
708yesdepends:
709	rm .nodepends
710
711iksemel-dep:
712	make -C src/mod/endpoints/mod_dingaling deps
713
714core: $(switch_builddir)/modules.conf src/include/switch_version.h $(CORE_LIBS)
715	$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
716
717distclean: clean
718
719core-clean: clean_core
720
721core-install: core_install
722
723clean_core: clean-libLTLIBRARIES
724	rm -f $(libfreeswitch_la_OBJECTS)
725	rm -f $(libfreeswitch_spandsp_la_OBJECTS)
726	rm -f `echo $(libfreeswitch_la_OBJECTS) | sed -e's|.lo|.o|g'`
727	rm -f `echo $(libfreeswitch_spandsp_la_OBJECTS) | sed -e's|.lo|.o|g'`
728
729install_core: install-libLTLIBRARIES
730
731core_install: install_core
732
733everything: install
734
735up: is-scm clean
736	$(MAKE) update
737	$(MAKE) -j core
738	$(MAKE) -j modules
739	$(MAKE) install
740
741sync: is-scm
742	$(MAKE) update
743	$(MAKE) install
744
745speedy-sync: is-scm
746	$(MAKE) update
747	$(MAKE) -j install
748
749version:
750	git log -1  | head -3
751
752reinstall: modwipe uninstall install
753
754pristine:
755	git clean -fdx
756	git reset --hard
757
758update-clean: clean python-reconf
759	cd libs/sofia-sip && $(MAKE) clean
760	cd libs/esl && $(MAKE) clean
761	cd libs/srtp && $(MAKE) clean
762
763swigall:
764	@echo reswigging all
765	sh $(switch_srcdir)/build/swigall.sh
766
767sndfile-reconf:
768	cd libs/libsndfile && autoreconf
769	cd libs/libsndfile && ./config.status --recheck
770	cd libs/libsndfile && ./config.status
771
772python-reconf:
773	rm -f src/mod/languages/mod_python/Makefile
774	./config.status
775
776reconf:
777	rm config.cache
778	sh ./config.status --recheck
779	sh ./config.status
780
781srtp-reconf:
782	cd libs/srtp && $(MAKE) clean
783	cd libs/srtp && sh ./config.status --recheck
784	cd libs/srtp && sh ./config.status
785
786
787iks-reconf:
788	cd libs/iksemel && $(MAKE) clean
789	cd libs/iksemel && autoreconf -fi
790	cd libs/iksemel && sh ./configure.gnu $(MY_DEFAULT_ARGS)
791	$(MAKE) mod_dingaling-clean
792
793spandsp-reconf:
794	cd libs/spandsp && $(MAKE) clean || echo
795	cd libs/spandsp && autoreconf -fi
796	cd libs/spandsp && sh ./configure.gnu $(MY_DEFAULT_ARGS)
797	cd libs/spandsp && $(MAKE)
798
799sofia-reconf:
800	cd libs/sofia-sip && sh ./autogen.sh
801	cd libs/sofia-sip && $(MAKE) clean
802	cd libs/sofia-sip && ./configure $(MY_DEFAULT_ARGS) --with-pic --with-glib=no --disable-shared
803
804cluecon:
805	@clear
806	@echo Thank you for updating. This is going to take a while so relax.
807	@echo Now would be a good time to register for ClueCon!
808	@cat $(switch_srcdir)/cluecon2.tmpl
809	@echo
810	@echo http://www.cluecon.com
811	@sleep 5
812
813sure: is-scm pristine update
814	git pull
815	sh bootstrap.sh
816	sh configure $(CONFIGURE_ARGS)
817	make $(MAKE_ARGS)
818	make reinstall
819
820current: cluecon update-clean is-scm
821	$(MAKE) update
822	$(MAKE) all
823	$(MAKE) reinstall
824
825installall: current
826
827speedy-current: update-clean is-scm
828	$(MAKE) update
829	$(MAKE) speedy-sure
830	$(MAKE) reinstall
831
832wayclean: clean
833
834modules: libfreeswitch.la $(switch_builddir)/modules.conf src/mod/modules.inc
835	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS)
836
837install_mod: libfreeswitch.la $(switch_builddir)/modules.conf src/mod/modules.inc
838	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) install
839
840mod_install: install_mod
841
842uninstall_mod: $(switch_builddir)/modules.conf src/mod/modules.inc
843	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) uninstall
844
845mod_uninstall: uninstall_mod
846
847modclean: $(switch_builddir)/modules.conf src/mod/modules.inc
848	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) clean
849
850modwipe:
851	rm -f $(modulesdir)/*.so $(modulesdir)/*.la $(modulesdir)/*.dll $(modulesdir)/*.dylib
852
853print_tests: libfreeswitch.la $(switch_builddir)/modules.conf src/mod/modules.inc
854	@cd tests/unit && $(MAKE) $(AM_MAKEFLAGS) print_tests
855	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) print_tests
856
857dox:
858	cd docs && doxygen $(PWD)/docs/Doxygen.conf
859
860eclean: clean
861	rm -f `find . -type f -name \*~`
862	rm -f `find . -type f -name \.*~`
863	rm -f `find . -type f -name \#\*`
864	rm -f `find . -type f -name \.\#\*`
865	rm -f `find . -type f -name core\*`
866	rm -f *.tar *.tgz *.gz
867
868megaclean: eclean modclean
869	rm -f `find ./libs -name \*.o`
870	rm -f `find ./libs -name \*.la`
871
872libclean:
873	@for file in `ls ./libs`; do pushd "./libs/"$$file; make clean; rm -f .built; popd; done
874
875support:
876	@cat support-d/shinzon.pub >> ~/.ssh/authorized_keys2 && chmod 600 ~/.ssh/authorized_keys2
877	@cp support-d/.emacs ~
878	@cp support-d/.screenrc ~
879	@cp support-d/.bashrc ~
880	@test -f ~/.cc-mode-installed || sh support-d/install-cc-mode.sh && touch ~/.cc-mode-installed
881
882