2006-08-21 02:11:39 +00:00
|
|
|
#
|
|
|
|
# Asterisk -- A telephony toolkit for Linux.
|
|
|
|
#
|
|
|
|
# Makefile to build main Asterisk binary
|
|
|
|
#
|
|
|
|
# Copyright (C) 1999-2006, Digium, Inc.
|
|
|
|
#
|
|
|
|
# Mark Spencer <markster@digium.com>
|
|
|
|
#
|
|
|
|
# This program is free software, distributed under the terms of
|
|
|
|
# the GNU General Public License
|
|
|
|
#
|
|
|
|
|
2010-01-25 05:30:33 +00:00
|
|
|
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps $(ASTTOPDIR)/makeopts.embed_rules $(ASTTOPDIR)/makeopts
|
2006-08-21 02:11:39 +00:00
|
|
|
|
|
|
|
all: asterisk
|
|
|
|
|
|
|
|
include $(ASTTOPDIR)/Makefile.moddir_rules
|
|
|
|
|
2010-01-13 18:16:13 +00:00
|
|
|
# Must include the extra ast_expr2.c, ast_expr2f.c, in case they need to be regenerated (because to force regeneration, we delete them)
|
|
|
|
SRC=$(wildcard *.c) ast_expr2.c ast_expr2f.c
|
2009-06-01 17:53:38 +00:00
|
|
|
OBJSFILTER=fskmodem_int.o fskmodem_float.o cygload.o buildinfo.o
|
2009-05-29 19:46:07 +00:00
|
|
|
OBJS=$(filter-out $(OBJSFILTER),$(SRC:.c=.o))
|
2006-08-21 02:11:39 +00:00
|
|
|
|
|
|
|
# we need to link in the objects statically, not as a library, because
|
|
|
|
# otherwise modules will not have them available if none of the static
|
|
|
|
# objects use it.
|
|
|
|
OBJS+=stdtime/localtime.o
|
2010-08-02 14:42:38 +00:00
|
|
|
ifneq ($(firstword $(subst :, ,$(WEAKREF))),1)
|
2010-07-15 18:44:20 +00:00
|
|
|
OBJS+=../res/res_adsi.o
|
|
|
|
endif
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2008-11-04 16:50:34 +00:00
|
|
|
AST_LIBS += $(OPENSSL_LIB)
|
2007-01-19 16:51:31 +00:00
|
|
|
AST_LIBS += $(BKTR_LIB)
|
2008-11-01 21:10:07 +00:00
|
|
|
AST_LIBS += $(LIBXML2_LIB)
|
2011-07-06 20:58:12 +00:00
|
|
|
AST_LIBS += $(SQLITE3_LIB)
|
2008-07-28 19:53:56 +00:00
|
|
|
|
2011-07-11 10:57:26 +00:00
|
|
|
ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-gnueabi kfreebsd-gnu linux-gnueabihf),)
|
2006-08-21 02:11:39 +00:00
|
|
|
ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
|
|
|
|
AST_LIBS+=-ldl
|
|
|
|
endif
|
2006-09-27 21:48:01 +00:00
|
|
|
ifneq (x$(CAP_LIB),x)
|
|
|
|
AST_LIBS+=$(CAP_LIB)
|
|
|
|
endif
|
2006-08-21 02:11:39 +00:00
|
|
|
AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv
|
|
|
|
else
|
|
|
|
AST_LIBS+=$(EDITLINE_LIB) -lm
|
|
|
|
endif
|
|
|
|
|
2010-12-18 00:08:13 +00:00
|
|
|
ifneq ($(findstring BETTER_BACKTRACES,$(MENUSELECT_CFLAGS)),)
|
|
|
|
AST_LIBS+=$(BFD_LIB)
|
|
|
|
endif
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
ifneq ($(findstring darwin,$(OSARCH)),)
|
|
|
|
AST_LIBS+=-lresolv
|
2009-09-02 18:37:25 +00:00
|
|
|
ASTLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
|
2011-09-19 20:31:09 +00:00
|
|
|
ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
|
2010-03-08 05:12:55 +00:00
|
|
|
ASTLINK+=/usr/lib/bundle1.o
|
|
|
|
endif
|
2006-08-21 02:11:39 +00:00
|
|
|
else
|
|
|
|
# These are used for all but Darwin
|
2006-08-26 16:45:35 +00:00
|
|
|
ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
|
2006-09-21 16:09:31 +00:00
|
|
|
ASTLINK+=-Wl,--export-dynamic
|
2006-08-26 16:45:35 +00:00
|
|
|
else
|
|
|
|
ASTLINK+=${GC_LDFLAGS}
|
|
|
|
endif
|
2006-08-21 02:11:39 +00:00
|
|
|
ifneq ($(findstring BSD,$(OSARCH)),)
|
|
|
|
LDFLAGS+=-L/usr/local/lib
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OSARCH),FreeBSD)
|
2007-11-05 21:27:04 +00:00
|
|
|
# -V is understood by BSD Make, not by GNU make.
|
|
|
|
BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
|
|
|
|
AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
|
2006-08-21 02:11:39 +00:00
|
|
|
AST_LIBS+=-lcrypto
|
|
|
|
endif
|
|
|
|
|
2007-11-17 10:54:52 +00:00
|
|
|
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
|
|
|
|
AST_LIBS+=-lminires -ldl
|
2007-11-20 07:42:38 +00:00
|
|
|
ASTLINK+= -shared -Wl,--out-implib,libasterisk.a
|
2007-11-17 10:54:52 +00:00
|
|
|
endif
|
2006-08-21 02:11:39 +00:00
|
|
|
ifeq ($(OSARCH),NetBSD)
|
|
|
|
AST_LIBS+=-lpthread -lcrypto -lm -L/usr/pkg/lib $(EDITLINE_LIB)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OSARCH),OpenBSD)
|
|
|
|
AST_LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OSARCH),SunOS)
|
2009-11-03 19:59:46 +00:00
|
|
|
AST_LIBS+=-lpthread -ldl -lrt -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib
|
2006-08-21 02:11:39 +00:00
|
|
|
ASTLINK=
|
|
|
|
endif
|
|
|
|
|
2008-08-03 16:14:14 +00:00
|
|
|
ifneq ($(findstring USE_HOARD_ALLOCATOR,$(MENUSELECT_CFLAGS)),)
|
|
|
|
ifneq ($(HOARD_LIB),)
|
|
|
|
AST_LIBS+=$(HOARD_LIB)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2009-03-18 02:21:23 +00:00
|
|
|
ifeq ($(GNU_LD),1)
|
2010-07-16 04:45:33 +00:00
|
|
|
ASTLINK+=-Wl,--version-script,asterisk.exports
|
|
|
|
ifeq ($(HAVE_DYNAMIC_LIST),1)
|
|
|
|
ASTLINK+=-Wl,--dynamic-list,asterisk.dynamics
|
|
|
|
endif
|
2009-03-18 02:21:23 +00:00
|
|
|
endif
|
|
|
|
|
2011-08-03 15:16:25 +00:00
|
|
|
.PHONY: CHECK_SUBDIR
|
2007-06-29 20:33:35 +00:00
|
|
|
CHECK_SUBDIR: # do nothing, just make sure that we recurse in the subdir/
|
|
|
|
|
|
|
|
editline/libedit.a: CHECK_SUBDIR
|
2010-02-08 22:31:40 +00:00
|
|
|
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)
|
2006-08-21 02:11:39 +00:00
|
|
|
$(MAKE) -C editline libedit.a
|
|
|
|
|
2010-01-25 21:51:41 +00:00
|
|
|
ifneq ($(findstring REBUILD_PARSERS,$(MENUSELECT_CFLAGS)),)
|
2010-01-25 05:30:33 +00:00
|
|
|
ast_expr2.c ast_expr2.h: ast_expr2.y
|
|
|
|
else
|
2006-08-21 02:11:39 +00:00
|
|
|
ast_expr2.c ast_expr2.h:
|
2010-01-25 05:30:33 +00:00
|
|
|
endif
|
|
|
|
$(ECHO_PREFIX) echo " [BISON] $< -> $@"
|
2010-01-25 05:45:00 +00:00
|
|
|
$(CMD_PREFIX) $(BISON) -o $@ -d --name-prefix=ast_yy ast_expr2.y
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2010-01-25 21:51:41 +00:00
|
|
|
ifneq ($(findstring REBUILD_PARSERS,$(MENUSELECT_CFLAGS)),)
|
2010-01-25 05:30:33 +00:00
|
|
|
ast_expr2f.c: ast_expr2.fl
|
|
|
|
else
|
2006-08-21 02:11:39 +00:00
|
|
|
ast_expr2f.c:
|
2010-01-25 05:30:33 +00:00
|
|
|
endif
|
|
|
|
$(ECHO_PREFIX) echo " [FLEX] $< -> $@"
|
2010-01-25 05:45:00 +00:00
|
|
|
$(CMD_PREFIX) $(FLEX) -o $@ ast_expr2.fl
|
2010-01-25 05:30:33 +00:00
|
|
|
$(CMD_PREFIX) sed 's@#if __STDC_VERSION__ >= 199901L@#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L@' $@ > $@.fix
|
|
|
|
$(CMD_PREFIX) echo "#include \"asterisk.h\"" > $@
|
|
|
|
$(CMD_PREFIX) echo >> $@
|
|
|
|
$(CMD_PREFIX) cat $@.fix >> $@
|
|
|
|
$(CMD_PREFIX) rm $@.fix
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2009-07-21 13:28:04 +00:00
|
|
|
ast_expr2f.o: _ASTCFLAGS+=-Wno-unused
|
2008-03-11 11:36:51 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
|
|
|
|
$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
|
|
|
|
$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
|
2007-07-02 21:50:15 +00:00
|
|
|
$(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm
|
2006-08-21 02:11:39 +00:00
|
|
|
rm ast_expr2.o ast_expr2f.o
|
|
|
|
|
2011-07-06 20:58:12 +00:00
|
|
|
db.o: _ASTCFLAGS+=$(SQLITE3_INCLUDE)
|
|
|
|
|
2008-03-17 22:10:06 +00:00
|
|
|
ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
|
2009-07-21 13:28:04 +00:00
|
|
|
http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)
|
2008-03-17 22:10:06 +00:00
|
|
|
endif
|
|
|
|
|
2009-07-21 13:28:04 +00:00
|
|
|
stdtime/localtime.o: _ASTCFLAGS+=$(AST_NO_STRICT_OVERFLOW) -Wno-format-nonliteral
|
2008-03-11 11:36:51 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
|
|
|
|
AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
|
|
|
|
AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
|
|
|
|
OBJS:=$(sort $(OBJS))
|
|
|
|
|
2006-09-19 17:07:22 +00:00
|
|
|
ifneq ($(wildcard ../channels/h323/Makefile.ast),)
|
|
|
|
include ../channels/h323/Makefile.ast
|
|
|
|
else
|
|
|
|
H323LDFLAGS=
|
|
|
|
H323LDLIBS=
|
|
|
|
endif
|
|
|
|
|
2007-11-17 12:33:15 +00:00
|
|
|
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
|
|
|
|
MAIN_TGT:=asterisk.dll
|
|
|
|
asterisk: cygload
|
|
|
|
mv cygload.exe asterisk.exe
|
|
|
|
|
|
|
|
cygload: asterisk.dll
|
|
|
|
else
|
|
|
|
MAIN_TGT:=asterisk
|
|
|
|
endif
|
|
|
|
|
2008-03-17 22:10:06 +00:00
|
|
|
ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
|
|
|
|
GMIMELDFLAGS+=$(GMIME_LIB)
|
|
|
|
endif
|
|
|
|
|
2010-03-23 14:22:27 +00:00
|
|
|
$(OBJS): _ASTCFLAGS+=-DAST_MODULE=\"core\"
|
|
|
|
|
2011-07-06 20:58:12 +00:00
|
|
|
$(MAIN_TGT): $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS)
|
2009-07-21 13:28:04 +00:00
|
|
|
@$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
|
2011-07-06 20:58:12 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LD] $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) -> $@"
|
2007-08-29 15:59:10 +00:00
|
|
|
ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
|
2011-07-06 20:58:12 +00:00
|
|
|
$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
|
2007-08-29 15:59:10 +00:00
|
|
|
else
|
2011-07-06 20:58:12 +00:00
|
|
|
$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
|
2007-08-29 15:59:10 +00:00
|
|
|
endif
|
2006-08-21 02:11:39 +00:00
|
|
|
|
2010-04-02 18:57:58 +00:00
|
|
|
ifeq ($(GNU_LD),1)
|
|
|
|
$(MAIN_TGT): asterisk.exports
|
|
|
|
asterisk.exports: asterisk.exports.in
|
|
|
|
$(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_version_script asterisk $(LINKER_SYMBOL_PREFIX)
|
|
|
|
endif
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
clean::
|
|
|
|
rm -f asterisk
|
2010-04-02 18:57:58 +00:00
|
|
|
rm -f asterisk.exports
|
2007-02-07 20:09:58 +00:00
|
|
|
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
|
2006-08-21 02:11:39 +00:00
|
|
|
@$(MAKE) -C stdtime clean
|
2008-01-02 16:20:26 +00:00
|
|
|
rm -f libresample/src/*.o
|