minor simplification of a conditional statement
[asterisk/asterisk.git] / cdr / Makefile
old mode 100755 (executable)
new mode 100644 (file)
index 4aeac02..dc765cc
 #
 # Asterisk -- A telephony toolkit for Linux.
 # 
-# Makefile for CDR backends (dynamically loaded)
+# Makefile for CDR backends
 #
-# Copyright (C) 1999-2005, Digium
-#
-# Mark Spencer <markster@digium.com>
+# Copyright (C) 1999-2006, Digium, Inc.
 #
 # This program is free software, distributed under the terms of
 # the GNU General Public License
 #
 
-MODS=cdr_csv.so cdr_manager.so cdr_custom.so
-
-CFLAGS+=-fPIC
-
-ifeq ($(findstring BSD,${OSARCH}),BSD)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
-endif
+-include ../menuselect.makeopts ../menuselect.makedeps
 
-#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
-#This works for even old (2.96) versions of gcc and provides a small boost either way.
-#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it.
-#So we go lowest common available by gcc and go a step down, still a step up from
-#the default as we now have a better instruction set to work with. - Belgarath
-ifeq ($(PROC),sparc64)
- PROC=ultrasparc
-  CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
-endif
+C_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.c,%,$(wildcard cdr_*.c)))
+CC_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.cc,%,$(wildcard cdr_*.cc)))
 
-#
-# unixODBC stuff...
-#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)
-  MODS+=cdr_odbc.so
-endif
-
-#
-# FreeTDS stuff...
-#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h),)
-  MODS+=cdr_tds.so
-endif
-
-#
-# PGSQL stuff...  Autoconf anyone??
-#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
-  MODS+=cdr_pgsql.so
-endif
-
-MLFLAGS=
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/pgsql/lib
-endif
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/pgsql
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib/pgsql
-endif
+LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
 
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include/pgsql
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib/pgsql
+ifneq ($(findstring cdr,$(MENUSELECT_EMBED)),)
+  EMBEDDED_MODS:=$(LOADABLE_MODS)
+  LOADABLE_MODS:=
 endif
 
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/opt/pgsql/include
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET) /opt/pgsql/lib
-endif
-
-ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql),)
-  CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/include/postgresql
-endif
-
-ifneq ($(wilcard $(CROSS_COMPILE_TARGET)/usr/lib/libpq.so),)
-  MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib
-endif
-
-#
-# SQLite stuff...
-#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sqlite.h),)
-  MODS+=cdr_sqlite.so
-endif
-
-all: depend $(MODS)
-
-install: all
-       for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
-
-clean:
-       rm -f *.so *.o .depend
-
-%.so : %.o
-       $(CC) $(SOLINK) -o $@ $<
-
-ifneq ($(wildcard .depend),)
-  include .depend
-endif
-
-cdr_odbc.so: cdr_odbc.o
-       $(CC) $(SOLINK) -o $@ $< -lodbc $(MLFLAGS)
-
-cdr_tds.so: cdr_tds.o
-       $(CC) $(SOLINK) -o $@ $< -ltds $(MLFLAGS)
-
-cdr_pgsql.so: cdr_pgsql.o
-       $(CC) $(SOLINK) -o $@ $< -lpq -lz $(MLFLAGS)
-
-cdr_sqlite.so: cdr_sqlite.o
-       $(CC) $(SOLINK) -o $@ $< -lsqlite $(MLFLAGS)
-
-depend: .depend
+all: _all
 
-.depend:
-       ../build_tools/mkdep $(CFLAGS) `ls *.c`
+include $(ASTTOPDIR)/Makefile.moddir_rules