source: src/router/asterisk/main/Makefile @ 17004

Last change on this file since 17004 was 17004, checked in by BrainSlayer, 2 years ago

update asterisk to 1.8.3.3

File size: 6.6 KB
Line 
1#
2# Asterisk -- A telephony toolkit for Linux.
3#
4# Makefile to build main Asterisk binary
5#
6# Copyright (C) 1999-2006, Digium, Inc.
7#
8# Mark Spencer <markster@digium.com>
9#
10# This program is free software, distributed under the terms of
11# the GNU General Public License
12#
13
14-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps $(ASTTOPDIR)/makeopts.embed_rules $(ASTTOPDIR)/makeopts
15
16all: asterisk
17
18include $(ASTTOPDIR)/Makefile.moddir_rules
19
20# Must include the extra ast_expr2.c, ast_expr2f.c, in case they need to be regenerated (because to force regeneration, we delete them)
21SRC=$(wildcard *.c) ast_expr2.c ast_expr2f.c
22OBJSFILTER=fskmodem_int.o fskmodem_float.o cygload.o buildinfo.o
23OBJS=$(filter-out $(OBJSFILTER),$(SRC:.c=.o))
24
25# we need to link in the objects statically, not as a library, because
26# otherwise modules will not have them available if none of the static
27# objects use it.
28OBJS+=stdtime/localtime.o
29ifneq ($(firstword $(subst :, ,$(WEAKREF))),1)
30OBJS+=../res/res_adsi.o
31endif
32
33AST_LIBS += $(OPENSSL_LIB)
34AST_LIBS += $(BKTR_LIB)
35AST_LIBS += $(LIBXML2_LIB)
36
37ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-gnueabi ),)
38  ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
39  AST_LIBS+=-ldl
40  endif
41  ifneq (x$(CAP_LIB),x)
42    AST_LIBS+=$(CAP_LIB)
43  endif
44  AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv
45else
46  AST_LIBS+=$(EDITLINE_LIB) -lm
47endif
48
49ifneq ($(findstring BETTER_BACKTRACES,$(MENUSELECT_CFLAGS)),)
50  AST_LIBS+=$(BFD_LIB)
51endif
52
53ifneq ($(findstring darwin,$(OSARCH)),)
54  AST_LIBS+=-lresolv
55  ASTLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
56  ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
57    ASTLINK+=/usr/lib/bundle1.o
58  endif
59else
60# These are used for all but Darwin
61  ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
62    ASTLINK+=-Wl,--export-dynamic
63  else
64    ASTLINK+=${GC_LDFLAGS}
65  endif
66  ifneq ($(findstring BSD,$(OSARCH)),)
67    LDFLAGS+=-L/usr/local/lib
68  endif
69endif
70
71ifeq ($(OSARCH),FreeBSD)
72  # -V is understood by BSD Make, not by GNU make.
73  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
74  AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
75  AST_LIBS+=-lcrypto
76endif
77
78ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
79  AST_LIBS+=-lminires -ldl
80  ASTLINK+= -shared -Wl,--out-implib,libasterisk.a
81endif
82ifeq ($(OSARCH),NetBSD)
83  AST_LIBS+=-lpthread -lcrypto -lm -L/usr/pkg/lib $(EDITLINE_LIB)
84endif
85
86ifeq ($(OSARCH),OpenBSD)
87  AST_LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
88endif
89
90ifeq ($(OSARCH),SunOS)
91  AST_LIBS+=-lpthread -ldl -lrt -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib
92  ASTLINK=
93endif
94
95ifneq ($(findstring USE_HOARD_ALLOCATOR,$(MENUSELECT_CFLAGS)),)
96  ifneq ($(HOARD_LIB),)
97    AST_LIBS+=$(HOARD_LIB)
98  endif
99endif
100
101ifeq ($(GNU_LD),1)
102ASTLINK+=-Wl,--version-script,asterisk.exports
103  ifeq ($(HAVE_DYNAMIC_LIST),1)
104  ASTLINK+=-Wl,--dynamic-list,asterisk.dynamics
105  endif
106endif
107
108CHECK_SUBDIR:   # do nothing, just make sure that we recurse in the subdir/
109
110editline/libedit.a: CHECK_SUBDIR
111        cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(_ASTCFLAGS:-Werror=) $(ASTCFLAGS))" LDFLAGS="$(_ASTLDFLAGS) $(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR)
112        $(MAKE) -C editline libedit.a
113
114db1-ast/libdb1.a: CHECK_SUBDIR
115        _ASTCFLAGS="$(_ASTCFLAGS) -Wno-strict-aliasing" ASTCFLAGS="$(ASTCFLAGS)" $(MAKE) -C db1-ast libdb1.a
116
117ifneq ($(findstring REBUILD_PARSERS,$(MENUSELECT_CFLAGS)),)
118ast_expr2.c ast_expr2.h: ast_expr2.y
119else
120ast_expr2.c ast_expr2.h:
121endif
122        $(ECHO_PREFIX) echo "   [BISON] $< -> $@"
123        $(CMD_PREFIX) $(BISON) -o $@ -d --name-prefix=ast_yy ast_expr2.y
124
125ifneq ($(findstring REBUILD_PARSERS,$(MENUSELECT_CFLAGS)),)
126ast_expr2f.c: ast_expr2.fl
127else
128ast_expr2f.c:
129endif
130        $(ECHO_PREFIX) echo "   [FLEX] $< -> $@"
131        $(CMD_PREFIX) $(FLEX) -o $@ ast_expr2.fl
132        $(CMD_PREFIX) sed 's@#if __STDC_VERSION__ >= 199901L@#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L@' $@ > $@.fix
133        $(CMD_PREFIX) echo "#include \"asterisk.h\"" > $@
134        $(CMD_PREFIX) echo >> $@
135        $(CMD_PREFIX) cat $@.fix >> $@
136        $(CMD_PREFIX) rm $@.fix
137
138ast_expr2f.o: _ASTCFLAGS+=-Wno-unused
139
140testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
141        $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
142        $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
143        $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm
144        rm ast_expr2.o ast_expr2f.o
145
146ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
147http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)
148endif
149
150stdtime/localtime.o: _ASTCFLAGS+=$(AST_NO_STRICT_OVERFLOW) -Wno-format-nonliteral
151
152AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
153AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
154AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
155OBJS:=$(sort $(OBJS))
156
157ifneq ($(wildcard ../channels/h323/Makefile.ast),)
158  include ../channels/h323/Makefile.ast
159else
160  H323LDFLAGS=
161  H323LDLIBS=
162endif
163
164ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
165MAIN_TGT:=asterisk.dll
166asterisk: cygload
167        mv cygload.exe asterisk.exe
168
169cygload: asterisk.dll
170else
171MAIN_TGT:=asterisk
172endif
173
174ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
175GMIMELDFLAGS+=$(GMIME_LIB)
176endif
177
178$(OBJS): _ASTCFLAGS+=-DAST_MODULE=\"core\"
179
180$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
181        @$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
182        $(ECHO_PREFIX) echo "   [LD] $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) -> $@"
183ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
184        $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
185else
186        $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
187endif
188
189ifeq ($(GNU_LD),1)
190$(MAIN_TGT): asterisk.exports
191asterisk.exports: asterisk.exports.in
192        $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script asterisk $(LINKER_SYMBOL_PREFIX)
193endif
194
195clean::
196        rm -f asterisk
197        rm -f db1-ast/.*.d
198        rm -f asterisk.exports
199        @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
200        @$(MAKE) -C db1-ast clean
201        @$(MAKE) -C stdtime clean
202        rm -f libresample/src/*.o
Note: See TracBrowser for help on using the repository browser.