move tools used during build into build_tools subdirectory
[asterisk/asterisk.git] / res / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for resource modules
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 MODS=res_adsi.so res_features.so res_crypto.so res_musiconhold.so res_indications.so res_monitor.so \
15      res_agi.so
16 MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi)
17 MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi)
18 MODS+=$(shell if [ -f "$(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h" ]; then echo "res_osp.so"; fi)
19
20 CRYPTO_LIBS=-lssl -lcrypto
21
22 CFLAGS+=
23 CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h ] && echo " -DZAPATA_MOH")
24 CFLAGS+=$(shell [ -f $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h ] && echo " -DZAPATA_MOH")
25 #
26 # Work around buggy RedHat 9.0
27 #
28 CFLAGS+=-DOPENSSL_NO_KRB5 -fPIC
29 OSPLIB=$(CROSS_COMPILE_TARGET)/usr/lib/libosp.a
30
31 all: depend $(MODS)
32
33 install: all
34         rm -f $(DESTDIR)$(ASTHEADERDIR)/parking.h
35         rm -f $(DESTDIR)$(MODULES_DIR)/app_agi.so 
36         rm -f $(DESTDIR)$(MODULES_DIR)/res_parking.so
37         for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
38
39 res_crypto.so: res_crypto.o
40         $(CC) $(SOLINK) -o $@ $< $(CRYPTO_LIBS)
41
42 clean:
43         rm -f *.so *.o .depend
44
45 res_odbc.so: res_odbc.o
46         $(CC) $(SOLINK) -o $@ $< -lodbc
47
48 res_osp.so: res_osp.o $(OSPLIB)
49         $(CC) $(SOLINK) -o $@ $< $(OSPLIB)
50
51 %.so : %.o
52         $(CC) $(SOLINK) -o $@ $<
53
54 ifneq ($(wildcard .depend),)
55 include .depend
56 endif
57
58 depend: .depend
59
60 .depend:
61         @if [ x`which mpg123 2>/dev/null | grep -v '^no'` != x ] ; then \
62           if mpg123 --longhelp 2>&1 | grep -q .59r 2>&1 >/dev/null ; then echo ; else \
63                         echo "*************************************************************";\
64                         echo "*** You have the WRONG version of mpg123... you need .59r ***";\
65                         echo "*** Use 'make mpg123' to get the right verison            ***";\
66                         echo "*************************************************************";\
67           fi ;\
68         else \
69                 echo "*** You don't have mpg123 installed. You're going to need ***";\
70                 echo "***       it if you want MusicOnHold                      ***";\
71         fi
72         ../build_tools/mkdep $(CFLAGS) `ls *.c` 
73
74 env:
75         env