remove redundant CFLAGS for BSD which are already set in the main Makefile (issue...
[asterisk/asterisk.git] / apps / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for PBX applications
5 #
6 # Copyright (C) 1999-2005, Digium
7 #
8 # Mark Spencer <markster@digium.com>
9 #
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
12 #
13
14 APPS=app_adsiprog.so app_alarmreceiver.so app_authenticate.so app_cdr.so       \
15      app_chanisavail.so app_chanspy.so app_controlplayback.so app_db.so        \
16      app_dial.so app_dictate.so app_directed_pickup.so app_directory.so        \
17      app_disa.so app_dumpchan.so app_echo.so app_exec.so app_externalivr.so    \
18      app_festival.so app_forkcdr.so app_getcpeid.so app_hasnewvoicemail.so     \
19      app_ices.so app_image.so app_lookupblacklist.so app_lookupcidname.so      \
20      app_macro.so app_milliwatt.so app_mixmonitor.so app_mp3.so app_nbscat.so  \
21      app_parkandannounce.so app_playback.so app_privacy.so app_queue.so        \
22      app_random.so app_read.so app_readfile.so app_realtime.so app_record.so   \
23      app_sayunixtime.so app_senddtmf.so app_sendtext.so app_setcallerid.so     \
24      app_setcdruserfield.so app_settransfercapability.so app_softhangup.so     \
25      app_stack.so app_system.so app_talkdetect.so app_test.so app_transfer.so  \
26      app_userevent.so app_url.so app_verbose.so app_voicemail.so               \
27      app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so   \
28      app_morsecode.so
29      
30 #
31 # Obsolete things...
32 #
33 #APPS+=app_sql_postgres.so
34 #APPS+=app_sql_odbc.so
35
36 #
37 # Experimental things
38 #
39 #APPS+=app_ivrdemo.so
40 #APPS+=app_skel.so
41 #APPS+=app_rpt.so
42
43 ifndef WITHOUT_ZAPTEL
44 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h),)
45   APPS+=app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so app_page.so
46 endif
47 endif # WITHOUT_ZAPTEL
48
49 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/osp/osp.h $(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h),)
50 APPS+=app_osplookup.so
51 endif
52
53 CURLLIBS=$(shell $(CROSS_COMPILE_BIN)curl-config --libs)
54 ifneq ($(shell if [[ 0x`$(CROSS_COMPILE_BIN)curl-config --vernum` -ge 0x70907 ]]; then echo "OK" ; fi),)
55   ifneq (${CURLLIBS},)
56     APPS+=app_curl.so
57   endif 
58 endif
59
60 ifeq (${OSARCH},CYGWIN)
61 CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
62 CYGSOLIB=-L.. -L. -L../res -lasterisk.dll -lres_features.so -lres_adsi.so -lres_monitor.so
63 else
64 CFLAGS+=-fPIC
65 APPS+=app_sms.so
66 endif
67
68 #
69 # If you have UnixODBC you can use ODBC voicemail
70 # storage
71 #
72 # Uncomment to use ODBC storage
73 #CFLAGS+=-DUSE_ODBC_STORAGE
74 # Uncomment for extended ODBC voicemail storage
75 #CFLAGS+=-DEXTENDED_ODBC_STORAGE
76 # See doc/README.odbcstorage for more information
77
78 all: $(APPS)
79
80 clean:
81         rm -f *.so *.o look .depend
82
83 %.so : %.o
84         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
85
86 app_rpt.so : app_rpt.o
87         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -ltonezone
88
89 install: all
90         for x in $(APPS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
91         rm -f $(DESTDIR)$(MODULES_DIR)/app_cut.so
92         rm -f $(DESTDIR)$(MODULES_DIR)/app_datetime.so
93         rm -f $(DESTDIR)$(MODULES_DIR)/app_qcall.so
94
95 app_curl.so: app_curl.o
96         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
97
98 app_sql_postgres.o: app_sql_postgres.c
99         $(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
100
101 app_sql_postgres.so: app_sql_postgres.o
102         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
103
104 app_sql_odbc.so: app_sql_odbc.o
105         $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
106
107 look:   look.c
108         $(CC) -pipe -O6 -g look.c -o look -lncurses
109
110 ifeq (SunOS,$(shell uname))
111 app_chanspy.so: app_chanspy.o
112         $(CC) $(SOLINK) -o $@ $< -lrt
113 endif
114
115
116 ifneq ($(wildcard .depend),)
117  include .depend
118 endif
119
120 depend: .depend
121
122 .depend:
123         ../build_tools/mkdep $(CFLAGS) `ls *.c`
124
125 env:
126         env