Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. #ADD cdr_pgsql.so to MODS= to include PostgreSQL support: REQUIRES PostgreSQL libs
  14. MODS=cdr_csv.so cdr_manager.so
  15. CFLAGS+=-fPIC
  16. PROC=$(shell uname -m)
  17. OSARCH=$(shell uname -s)
  18. ifeq (${OSARCH},FreeBSD)
  19. SOLINK+=-L/usr/local/lib
  20. endif
  21. #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
  22. #This works for even old (2.96) versions of gcc and provides a small boost either way.
  23. #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it.
  24. #So we go lowest common available by gcc and go a step down, still a step up from
  25. #the default as we now have a better instruction set to work with. - Belgarath
  26. ifeq ($(PROC),sparc64)
  27. PROC=ultrasparc
  28. CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
  29. endif
  30. #
  31. # unixODBC stuff...
  32. #
  33. MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi)
  34. MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi)
  35. #
  36. # FreeTDS stuff...
  37. #
  38. MODS+=$(shell if [ -f "/usr/include/tds.h" ]; then echo "cdr_tds.so"; fi)
  39. MODS+=$(shell if [ -f "/usr/local/include/tds.h" ]; then echo "cdr_tds.so"; fi)
  40. #
  41. # PGSQL stuff... Autoconf anyone??
  42. #
  43. 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)
  44. CFLAGS+=$(shell if [ -d /usr/local/pgsql/include ]; then echo "-I/usr/local/pgsql/include"; fi)
  45. CFLAGS+=$(shell if [ -d /usr/include/pgsql ]; then echo "-I/usr/include/pgsql"; fi)
  46. CFLAGS+=$(shell if [ -d /usr/include/postgresql ]; then echo "-I/usr/include/postgresql"; fi)
  47. CFLAGS+=$(shell if [ -d /usr/local/include/pgsql ]; then echo "-I/usr/local/include/pgsql"; fi)
  48. CFLAGS+=$(shell if [ -d /opt/pgsql/include ]; then echo "-I/opt/pgsql/include"; fi)
  49. #CFLAGS+=$(shell if [ -f /usr/include/libpq-fe.h ]; then echo "-I/usr/include"; fi)
  50. MLFLAGS=
  51. MLFLAGS+=$(shell if [ -d /usr/lib/pgsql ]; then echo "-L/usr/lib/pgsql"; fi)
  52. MLFLAGS+=$(shell if [ -d /usr/local/pgsql/lib ]; then echo "-L/usr/local/pgsql/lib"; fi)
  53. MLFLAGS+=$(shell if [ -d /usr/local/lib/pgsql ]; then echo "-L/usr/local/lib/pgsql"; fi)
  54. MLFLAGS+=$(shell if [ -d /opt/pgsql/lib ]; then echo "-L/opt/pgsql/lib"; fi)
  55. MLFLAGS+=$(shell if [ -f /usr/lib/libpq.so ]; then echo "-L/usr/lib"; fi)
  56. #
  57. # SQLIte stuff...
  58. #
  59. MODS+=$(shell if [ -f "/usr/include/sqlite.h" ]; then echo "cdr_sqlite.so"; fi)
  60. all: depend $(MODS)
  61. install: all
  62. for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
  63. clean:
  64. rm -f *.so *.o .depend
  65. %.so : %.o
  66. $(CC) $(SOLINK) -o $@ $<
  67. ifneq ($(wildcard .depend),)
  68. include .depend
  69. endif
  70. cdr_odbc.so: cdr_odbc.o
  71. $(CC) $(SOLINK) -o $@ $< -lodbc $(MLFLAGS)
  72. cdr_tds.so: cdr_tds.o
  73. $(CC) $(SOLINK) -o $@ $< -ltds $(MLFLAGS)
  74. cdr_pgsql.so: cdr_pgsql.o
  75. $(CC) $(SOLINK) -o $@ $< -lpq -lz $(MLFLAGS)
  76. cdr_sqlite.so: cdr_sqlite.o
  77. $(CC) $(SOLINK) -o $@ $< -lsqlite $(MLFLAGS)
  78. depend: .depend
  79. .depend:
  80. ../mkdep $(CFLAGS) `ls *.c`