2 # Asterisk -- A telephony toolkit for Linux.
4 # Makefile to build main Asterisk binary
6 # Copyright (C) 1999-2006, Digium, Inc.
8 # Mark Spencer <markster@digium.com>
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
14 -include $(ASTTOPDIR
)/menuselect.makeopts
$(ASTTOPDIR
)/menuselect.makedeps
$(ASTTOPDIR
)/makeopts.embed_rules
18 include $(ASTTOPDIR
)/Makefile.moddir_rules
20 OBJS
= tcptls.o io.o sched.o logger.o frame.o loader.o config.o channel.o \
21 translate.o file.o pbx.o cli.o md5.o term.o \
22 ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
23 cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
24 dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
25 astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
26 utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
27 netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
28 cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
29 strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
30 astobj2.o hashtab.o global_datastores.o version.o \
31 features.o taskprocessor.o timing.o
33 # we need to link in the objects statically, not as a library, because
34 # otherwise modules will not have them available if none of the static
36 OBJS
+=stdtime
/localtime.o
38 # At the moment say.o is an optional component which can be overridden
42 AST_LIBS
+= $(SSL_LIB
)
43 AST_LIBS
+= $(BKTR_LIB
)
45 ifeq ($(POLL_AVAILABLE
),)
49 ifneq ($(findstring $(OSARCH
), linux-gnu uclinux linux-uclibc linux-gnueabi
),)
50 ifneq ($(findstring LOADABLE_MODULES
,$(MENUSELECT_CFLAGS
)),)
56 AST_LIBS
+=-lpthread
$(EDITLINE_LIB
) -lm
-lresolv
58 AST_LIBS
+=$(EDITLINE_LIB
) -lm
61 ifneq ($(findstring darwin
,$(OSARCH
)),)
63 ifneq ($(findstring LOADABLE_MODULES
,$(MENUSELECT_CFLAGS
)),)
67 # These are used for all but Darwin
68 ifneq ($(findstring LOADABLE_MODULES
,$(MENUSELECT_CFLAGS
)),)
69 ASTLINK
+=-Wl
,--export-dynamic
71 ASTLINK
+=${GC_LDFLAGS}
73 ifneq ($(findstring BSD
,$(OSARCH
)),)
74 LDFLAGS
+=-L
/usr
/local
/lib
78 ifeq ($(OSARCH
),FreeBSD
)
79 # -V is understood by BSD Make, not by GNU make.
80 BSDVERSION
=$(shell make
-V OSVERSION
-f
/usr
/share
/mk
/bsd.port.subdir.mk
)
81 AST_LIBS
+=$(shell if
test $(BSDVERSION
) -lt
502102 ; then echo
"-lc_r"; else echo
"-pthread"; fi
)
85 ifneq ($(findstring $(OSARCH
), mingw32 cygwin
),)
86 AST_LIBS
+=-lminires
-ldl
87 ASTLINK
+= -shared
-Wl
,--out-implib
,libasterisk.a
89 ifeq ($(OSARCH
),NetBSD
)
90 AST_LIBS
+=-lpthread
-lcrypto
-lm
-L
/usr
/pkg
/lib
$(EDITLINE_LIB
)
93 ifeq ($(OSARCH
),OpenBSD
)
94 AST_LIBS
+=-lcrypto
-lpthread
-lm
$(EDITLINE_LIB
)
97 ifeq ($(OSARCH
),SunOS
)
98 AST_LIBS
+=-lpthread
-ldl
-lnsl
-lsocket
-lresolv
-L
/opt
/ssl
/lib
-L
/usr
/local
/ssl
/lib
102 CHECK_SUBDIR
: # do nothing, just make sure that we recurse in the subdir/
104 editline
/libedit.a
: CHECK_SUBDIR
105 cd editline
&& test -f config.h || CFLAGS
="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(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
)
106 $(MAKE
) -C editline libedit.a
108 db1-ast
/libdb1.a
: CHECK_SUBDIR
109 CFLAGS
="$(subst $(ASTTOPDIR),../../,$(ASTCFLAGS))" LDFLAGS
="$(ASTLDFLAGS)" $(MAKE
) -C db1-ast libdb1.a
111 ast_expr2.c ast_expr2.h
:
112 bison
-o
$@
-d
--name-prefix
=ast_yy ast_expr2.y
115 flex
-o
$@
--full ast_expr2.fl
# moved the correction of yyfree into the flex input file itself.
116 sed
's@#if __STDC_VERSION__ >= 199901L@#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L@' ast_expr2f.c
> zz
119 ast_expr2f.o
: ASTCFLAGS
+=-Wno-unused
121 testexpr2
: ast_expr2f.c ast_expr2.c ast_expr2.h
122 $(CC
) -g
-c
-Iinclude
-DSTANDALONE ast_expr2f.c
123 $(CC
) -g
-c
-Iinclude
-DSTANDALONE ast_expr2.c
124 $(CC
) -g
-o testexpr2 ast_expr2f.o ast_expr2.o
-lm
125 rm ast_expr2.o ast_expr2f.o
127 ifneq ($(findstring ENABLE_UPLOADS
,$(MENUSELECT_CFLAGS
)),)
128 http.o
: ASTCFLAGS
+=$(GMIME_INCLUDE
)
131 stdtime
/localtime.o
: ASTCFLAGS
+=$(AST_NO_STRICT_OVERFLOW
)
133 AST_EMBED_LDSCRIPTS
:=$(sort $(EMBED_LDSCRIPTS
))
134 AST_EMBED_LDFLAGS
:=$(foreach dep
,$(EMBED_LDFLAGS
),$(value
$(dep
)))
135 AST_EMBED_LIBS
:=$(foreach dep
,$(EMBED_LIBS
),$(value
$(dep
)))
136 OBJS
:=$(sort $(OBJS
))
138 ifneq ($(wildcard ..
/channels
/h323
/Makefile.ast
),)
139 include ..
/channels
/h323
/Makefile.ast
145 ifneq ($(findstring $(OSARCH
), mingw32 cygwin
),)
146 MAIN_TGT
:=asterisk.dll
148 mv cygload.exe asterisk.exe
150 cygload
: asterisk.dll
155 ifneq ($(findstring ENABLE_UPLOADS
,$(MENUSELECT_CFLAGS
)),)
156 GMIMELDFLAGS
+=$(GMIME_LIB
)
159 $(MAIN_TGT
): $(OBJS
) editline
/libedit.a db1-ast
/libdb1.a
$(AST_EMBED_LDSCRIPTS
)
160 @
$(CC
) -c
-o buildinfo.o
$(ASTCFLAGS
) buildinfo.c
161 $(ECHO_PREFIX
) echo
" [LD] $^ -> $@"
162 ifneq ($(findstring chan_h323
,$(MENUSELECT_CHANNELS
)),)
163 $(CMD_PREFIX
) $(CC
) $(STATIC_BUILD
) -o
$@
$(ASTLINK
) $(AST_EMBED_LDFLAGS
) $(ASTLDFLAGS
) $^ buildinfo.o
$(AST_LIBS
) $(AST_EMBED_LIBS
) $(GMIMELDFLAGS
)
165 $(CMD_PREFIX
) $(CXX
) $(STATIC_BUILD
) -o
$@
$(ASTLINK
) $(AST_EMBED_LDFLAGS
) $(ASTLDFLAGS
) $(H323LDFLAGS
) $^ buildinfo.o
$(AST_LIBS
) $(AST_EMBED_LIBS
) $(H323LDLIBS
) $(GMIMELDFLAGS
)
167 $(CMD_PREFIX
) $(ASTTOPDIR
)/build_tools
/strip_nonapi
$@ ||
rm $@
172 @if
[ -f editline
/Makefile
]; then
$(MAKE
) -C editline
distclean ; fi
173 @
$(MAKE
) -C db1-ast
clean
174 @
$(MAKE
) -C stdtime
clean
175 rm -f libresample
/src
/*.o