54bc2c20b6
revision changed, every module that used the version was getting rebuilt after every svn update. This severly annoyed me pretty quickly, so I have improved the situation. Now, instead of generating version.h, main/version.c is generated. version.c includes the version information, as well as a couple of API calls for modules to retrieve the version. So now, only version.c will get rebuilt, and the main asterisk binary relinked, which is must faster than rebuilding http.c, manager.c, asterisk.c, relinking the asterisk binary, chan_sip.c, func_version.c, res_agi ... The only minor change in behavior here is that the version information reported by chan_sip, for example, is the version of the Asterisk core, and not necessarily the Asterisk version that the chan_sip module came from. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
175 lines
5.4 KiB
Makefile
175 lines
5.4 KiB
Makefile
#
|
|
# 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
|
|
#
|
|
|
|
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps $(ASTTOPDIR)/makeopts.embed_rules
|
|
|
|
all: asterisk
|
|
|
|
include $(ASTTOPDIR)/Makefile.moddir_rules
|
|
|
|
RESAMPLE_OBJS:=libresample/src/resample.o libresample/src/resamplesubs.o libresample/src/filterkit.o
|
|
|
|
OBJS= io.o sched.o logger.o frame.o loader.o config.o channel.o \
|
|
translate.o file.o pbx.o cli.o md5.o term.o \
|
|
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
|
|
cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
|
|
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
|
|
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
|
|
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
|
|
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
|
|
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
|
|
strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
|
|
astobj2.o hashtab.o global_datastores.o $(RESAMPLE_OBJS) version.o
|
|
|
|
# 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
|
|
|
|
# At the moment say.o is an optional component which can be overridden
|
|
# by a module.
|
|
OBJS+=say.o
|
|
|
|
AST_LIBS += $(SSL_LIB)
|
|
AST_LIBS += $(BKTR_LIB)
|
|
|
|
ifeq ($(POLL_AVAILABLE),)
|
|
OBJS+=poll.o
|
|
endif
|
|
|
|
ifeq ($(wildcard /usr/include/dlfcn.h),)
|
|
OBJS+=dlfcn.o
|
|
endif
|
|
|
|
ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc ),)
|
|
ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
|
|
AST_LIBS+=-ldl
|
|
endif
|
|
ifneq (x$(CAP_LIB),x)
|
|
AST_LIBS+=$(CAP_LIB)
|
|
endif
|
|
AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv
|
|
else
|
|
AST_LIBS+=$(EDITLINE_LIB) -lm
|
|
endif
|
|
|
|
ifneq ($(findstring darwin,$(OSARCH)),)
|
|
AST_LIBS+=-lresolv
|
|
ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
|
|
ASTLINK=-Wl,-dynamic
|
|
endif
|
|
else
|
|
# These are used for all but Darwin
|
|
ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
|
|
ASTLINK+=-Wl,--export-dynamic
|
|
else
|
|
ASTLINK+=${GC_LDFLAGS}
|
|
endif
|
|
ifneq ($(findstring BSD,$(OSARCH)),)
|
|
LDFLAGS+=-L/usr/local/lib
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(OSARCH),FreeBSD)
|
|
# -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)
|
|
AST_LIBS+=-lcrypto
|
|
endif
|
|
|
|
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
|
|
AST_LIBS+=-lminires -ldl
|
|
ASTLINK+= -shared -Wl,--out-implib,libasterisk.a
|
|
endif
|
|
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)
|
|
AST_LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib
|
|
ASTLINK=
|
|
endif
|
|
|
|
CHECK_SUBDIR: # do nothing, just make sure that we recurse in the subdir/
|
|
|
|
editline/libedit.a: CHECK_SUBDIR
|
|
cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(ASTCFLAGS:-Werror=)" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR)
|
|
$(MAKE) -C editline libedit.a
|
|
|
|
db1-ast/libdb1.a: CHECK_SUBDIR
|
|
CFLAGS="$(ASTCFLAGS)" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
|
|
|
|
ast_expr2.c ast_expr2.h:
|
|
bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
|
|
|
|
ast_expr2f.c:
|
|
flex -o $@ --full ast_expr2.fl
|
|
sed 's@free( (char \*) ptr );@if(ptr) free( (char *) ptr );@' ast_expr2f.c > zz
|
|
mv zz ast_expr2f.c
|
|
|
|
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
|
|
$(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm
|
|
rm ast_expr2.o ast_expr2f.o
|
|
|
|
channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)
|
|
|
|
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))
|
|
|
|
ifneq ($(wildcard ../channels/h323/Makefile.ast),)
|
|
include ../channels/h323/Makefile.ast
|
|
else
|
|
H323LDFLAGS=
|
|
H323LDLIBS=
|
|
endif
|
|
|
|
minimime/libmmime.a: CHECK_SUBDIR
|
|
@cd minimime && $(MAKE) libmmime.a
|
|
|
|
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
|
|
MAIN_TGT:=asterisk.dll
|
|
asterisk: cygload
|
|
mv cygload.exe asterisk.exe
|
|
|
|
cygload: asterisk.dll
|
|
else
|
|
MAIN_TGT:=asterisk
|
|
endif
|
|
|
|
$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS)
|
|
@$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
|
|
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
|
|
ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
|
|
$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS)
|
|
else
|
|
$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
|
|
endif
|
|
@$(ASTTOPDIR)/build_tools/strip_nonapi $@
|
|
|
|
clean::
|
|
rm -f asterisk
|
|
rm -f db1-ast/.*.d
|
|
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
|
|
@$(MAKE) -C db1-ast clean
|
|
@$(MAKE) -C stdtime clean
|
|
@$(MAKE) -C minimime clean
|
|
rm -f libresample/src/*.o
|