8f05678dd6900d672a8a32b952ae0a00dfbbfef8
[asterisk/asterisk.git] / cdr / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for CDR backends (dynamically loaded)
5 #
6 # Copyright (C) 1999, Mark Spencer
7 #
8 # Mark Spencer <markster@linux-support.net>
9 #
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
12 #
13
14 MODS=cdr_csv.so
15
16 CFLAGS+=-fPIC
17
18 #
19 # MySQL stuff...  Autoconf anyone??
20 #
21 MODS+=$(shell if [ -d /usr/local/mysql/include ] || [ -d /usr/include/mysql ] || [ -d /usr/local/include/mysql ] || [ -d /opt/mysql/include ]; then echo "cdr_mysql.so"; fi)
22 CFLAGS+=$(shell if [ -d /usr/local/mysql/include ]; then echo "-I/usr/local/mysql/include"; fi)
23 CFLAGS+=$(shell if [ -d /usr/include/mysql ]; then echo "-I/usr/include/mysql"; fi)
24 CFLAGS+=$(shell if [ -d /usr/local/include/mysql ]; then echo "-I/usr/local/include/mysql"; fi)
25 CFLAGS+=$(shell if [ -d /opt/mysql/include/mysql ]; then echo "-I/opt/mysql/include/mysql"; fi)
26 MLFLAGS=
27 MLFLAGS+=$(shell if [ -d /usr/lib/mysql ]; then echo "-L/usr/lib/mysql"; fi)
28 MLFLAGS+=$(shell if [ -d /usr/local/mysql/lib ]; then echo "-L/usr/local/mysql/lib"; fi)
29 MLFLAGS+=$(shell if [ -d /usr/local/lib/mysql ]; then echo "-L/usr/local/lib/mysql"; fi)
30 MLFLAGS+=$(shell if [ -d /opt/mysql/lib/mysql ]; then echo "-L/opt/mysql/lib/mysql"; fi)
31
32 all: $(MODS)
33
34 install: all
35         for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
36
37 clean:
38         rm -f *.so *.o
39
40 %.so : %.o
41         $(CC) -shared -Xlinker -x -o $@ $<
42
43 cdr_mysql.so: cdr_mysql.o
44         $(CC) -shared -Xlinker -x -o $@ $< -lmysqlclient -lz $(MLFLAGS)