Add PGSQL support
[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/pgsql/include ] || [ -d /usr/include/pgsql ] || [ -d /usr/local/include/pgsql ] || [ -d /opt/pgsql/include ] || [ -f /usr/include/libpq-fe.h ] ; then echo "cdr_pgsql.so"; fi)
22 CFLAGS+=$(shell if [ -d /usr/local/pgsql/include ]; then echo "-I/usr/local/pgsql/include"; fi)
23 CFLAGS+=$(shell if [ -d /usr/include/pgsql ]; then echo "-I/usr/include/pgsql"; fi)
24 CFLAGS+=$(shell if [ -d /usr/local/include/pgsql ]; then echo "-I/usr/local/include/pgsql"; fi)
25 CFLAGS+=$(shell if [ -d /opt/pgsql/include ]; then echo "-I/opt/pgsql/include"; fi)
26 CFLAGS+=$(shell if [ -f /usr/include/libpq-fe.h ]; then echo "-I/usr/include"; fi)
27 MLFLAGS=
28 MLFLAGS+=$(shell if [ -d /usr/lib/pgsql ]; then echo "-L/usr/lib/pgsql"; fi)
29 MLFLAGS+=$(shell if [ -d /usr/local/pgsql/lib ]; then echo "-L/usr/local/pgsql/lib"; fi)
30 MLFLAGS+=$(shell if [ -d /usr/local/lib/pgsql ]; then echo "-L/usr/local/lib/pgsql"; fi)
31 MLFLAGS+=$(shell if [ -d /opt/pgsql/lib ]; then echo "-L/opt/pgsql/lib"; fi)
32 MLFLAGS+=$(shell if [ -f /usr/lib/libpq.so ]; then echo "-L/usr/lib"; fi)
33
34 all: depend $(MODS)
35
36 install: all
37         for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done
38
39 clean:
40         rm -f *.so *.o .depend
41
42 %.so : %.o
43         $(CC) -shared -Xlinker -x -o $@ $<
44
45 ifneq ($(wildcard .depend),)
46 include .depend
47 endif
48
49 cdr_pgsql.so: cdr_pgsql.o
50         $(CC) -shared -Xlinker -x -o $@ $< -lpq -lz $(MLFLAGS)
51
52 depend: .depend
53
54 .depend:
55         ../mkdep $(CFLAGS) `ls *.c`