clarify the fact that voicemail IMAP storage cannot be built against a distro's binar...
[asterisk-bristuff.git] / main / Makefile
blobb8def5541fcb9bbd9fe1878c84248bd9d0c39951
2 # Asterisk -- A telephony toolkit for Linux.
3 #
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
16 all: asterisk
18 include $(ASTTOPDIR)/Makefile.moddir_rules
20 OBJS= 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
31 # we need to link in the objects statically, not as a library, because
32 # otherwise modules will not have them available if none of the static
33 # objects use it.
34 OBJS+=stdtime/localtime.o
36 # At the moment say.o is an optional component which can be overridden
37 # by a module.
38 OBJS+=say.o
40 ifneq ($(findstring darwin,$(OSARCH)),)
41 OBJS+=poll.o
42 ASTCFLAGS+=-DPOLLCOMPAT
43 else
44 ifeq ($(wildcard /usr/include/sys/poll.h),)
45 OBJS+=poll.o
46 ASTCFLAGS+=-DPOLLCOMPAT
47 endif
48 endif
50 ifeq ($(wildcard /usr/include/dlfcn.h),)
51 OBJS+=dlfcn.o
52 endif
54 ifneq ($(findstring $(OSARCH), linux-gnu uclinux ),)
55 ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
56 AST_LIBS+=-ldl
57 endif
58 AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv
59 else
60 AST_LIBS+=$(EDITLINE_LIB) -lm
61 endif
63 ifneq ($(findstring darwin,$(OSARCH)),)
64 AST_LIBS+=-lresolv
65 ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
66 ASTLINK=-Wl,-dynamic
67 endif
68 else
69 # These are used for all but Darwin
70 ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
71 ASTLINK+=-Wl,--export-dynamic
72 else
73 ASTLINK+=${GC_LDFLAGS}
74 endif
75 ifneq ($(findstring BSD,$(OSARCH)),)
76 LDFLAGS+=-L/usr/local/lib
77 endif
78 endif
80 ifeq ($(OSARCH),FreeBSD)
81 AST_LIBS+=-lcrypto
82 endif
84 ifeq ($(OSARCH),NetBSD)
85 AST_LIBS+=-lpthread -lcrypto -lm -L/usr/pkg/lib $(EDITLINE_LIB)
86 endif
88 ifeq ($(OSARCH),OpenBSD)
89 AST_LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
90 endif
92 ifeq ($(OSARCH),SunOS)
93 AST_LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib
94 ASTLINK=
95 endif
97 editline/libedit.a:
98 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)
99 $(MAKE) -C editline libedit.a
101 db1-ast/libdb1.a:
102 CFLAGS="$(ASTCFLAGS)" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
104 ast_expr2.c ast_expr2.h:
105 bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
107 ast_expr2f.c:
108 flex -o $@ --full ast_expr2.fl
110 testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
111 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
112 $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
113 $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
114 rm ast_expr2.o ast_expr2f.o
116 channel.o: ASTCFLAGS+=$(ZAPTEL_INCLUDE)
118 AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
119 AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
120 AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
121 OBJS:=$(sort $(OBJS))
123 ifneq ($(wildcard ../channels/h323/Makefile.ast),)
124 include ../channels/h323/Makefile.ast
125 else
126 H323LDFLAGS=
127 H323LDLIBS=
128 endif
130 asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
131 @$(ASTTOPDIR)/build_tools/make_build_h > $(ASTTOPDIR)/include/asterisk/build.h.tmp
132 @if cmp -s $(ASTTOPDIR)/include/asterisk/build.h.tmp $(ASTTOPDIR)/include/asterisk/build.h ; then echo ; else \
133 mv $(ASTTOPDIR)/include/asterisk/build.h.tmp $(ASTTOPDIR)/include/asterisk/build.h ; \
135 @rm -f $(ASTTOPDIR)/include/asterisk/build.h.tmp
136 @$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
137 $(ECHO_PREFIX) echo " [LD] $^ -> $@"
138 $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
139 @$(ASTTOPDIR)/build_tools/strip_nonapi $@
141 clean::
142 rm -f asterisk
143 rm -f db1-ast/.*.d
144 @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
145 @$(MAKE) -C db1-ast clean
146 @$(MAKE) -C stdtime clean