more Makefile cleanup and consistency stuff
[asterisk/asterisk.git] / channels / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile for channel drivers
5 #
6 # Copyright (C) 1999-2006, Digium, Inc.
7 #
8 # This program is free software, distributed under the terms of
9 # the GNU General Public License
10 #
11
12 ifneq ($(wildcard ../menuselect.makeopts),)
13   include ../menuselect.makeopts
14   include ../menuselect.makedeps
15 endif
16
17 C_MODS:=$(filter-out $(MENUSELECT_CHANNELS),$(patsubst %.c,%,$(wildcard chan_*.c)))
18 CC_MODS:=$(filter-out $(MENUSELECT_CHANNELS),$(patsubst %.cc,%,$(wildcard chan_*.cc)))
19
20 ifeq ($(OSARCH),OpenBSD)
21   PTLIB=-lpt_OpenBSD_x86_r
22   H323LIB=-lh323_OpenBSD_x86_r
23 endif
24
25 ifeq ($(OSARCH),Linux)
26   PTLIB=-lpt_linux_x86_r
27   H323LIB=-lh323_linux_x86_r
28   CHANH323LIB=-ldl
29 endif
30
31 ifeq ($(OSARCH),FreeBSD)
32   PTLIB=-lpt_FreeBSD_x86_r
33   H323LIB=-lh323_FreeBSD_x86_r
34   CHANH323LIB=-pthread
35 endif
36
37 ifeq ($(OSARCH),NetBSD)
38   PTLIB=-lpt_NetBSD_x86_r
39   H323LIB=-lh323_NetBSD_x86_r
40 endif
41
42 ifeq ($(wildcard h323/libchanh323.a),)
43   CC_MODS:=$(filter-out chan_h323,$(CC_MODS))
44 endif
45
46 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/mISDNuser/mISDNlib.h),)
47   C_MODS:=$(filter-out chan_misdn,$(C_MODS))
48 endif
49
50 ifndef OPENH323DIR
51   OPENH323DIR=$(HOME)/openh323
52 endif
53
54 ifndef PWLIBDIR
55   PWLIBDIR=$(HOME)/pwlib
56 endif
57
58 SELECTED_MODS:=$(C_MODS) $(CC_MODS)
59
60 all: _all
61
62 include $(ASTTOPDIR)/Makefile.moddir_rules
63
64 clean::
65         rm -f busy.h ringtone.h gentone
66
67 ifneq ($(wildcard $(PWD)/Makefile.ast),)
68   include $(PWD)/Makefile.ast
69 endif
70
71 $(eval $(call ast_make_final_host,gentone,gentone.c))
72 gentone: LIBS+=-lm
73
74 busy.h: gentone
75         ./gentone busy 480 620
76
77 ringtone.h: gentone
78         ./gentone ringtone 440 480
79
80 chan_oss.o: busy.h ringtone.h
81
82 chan_iax2.so: iax2-parser.o iax2-provision.o
83
84 chan_alsa.o: busy.h ringtone.h
85
86 ifeq ($(OSARCH),Linux)
87 chan_h323.so: chan_h323.o h323/libchanh323.a $(PWD)/Makefile.ast
88         $(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++
89 else
90 chan_h323.so: chan_h323.o h323/libchanh323.a
91         $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
92 endif
93
94 misdn/chan_misdn_lib.a:
95         make -C misdn
96
97 chan_misdn.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\"
98
99 misdn_config.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\"
100
101 chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
102 chan_misdn.so: LIBS+=-lisdnnet -lmISDN