~davewalker/ubuntu/maverick/asterisk/lp_705014

« back to all changes in this revision

Viewing changes to .pc/h323-no-deps-on-asterisk/main/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Steve Beattie
  • Date: 2010-03-02 10:00:03 UTC
  • Revision ID: james.westby@ubuntu.com-20100302100003-qaycyl89gy31bz03
Tags: 1:1.6.2.2-1ubuntu2
debian/{control,rules}: re-enable hardened options to gain PIE build
(Debian bug 542741, LP: #527538)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
15
 
 
16
all: asterisk
 
17
 
 
18
include $(ASTTOPDIR)/Makefile.moddir_rules
 
19
 
 
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 heap.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 astfd.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 datastore.o xml.o xmldoc.o \
 
32
        strings.o bridging.o poll.o ssl.o
 
33
 
 
34
# we need to link in the objects statically, not as a library, because
 
35
# otherwise modules will not have them available if none of the static
 
36
# objects use it.
 
37
OBJS+=stdtime/localtime.o
 
38
 
 
39
# At the moment say.o is an optional component which can be overridden
 
40
# by a module.
 
41
OBJS+=say.o
 
42
 
 
43
AST_LIBS += $(OPENSSL_LIB)
 
44
AST_LIBS += $(BKTR_LIB)
 
45
AST_LIBS += $(LIBXML2_LIB) 
 
46
 
 
47
ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-gnueabi ),)
 
48
  ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
 
49
  AST_LIBS+=-ldl
 
50
  endif
 
51
  ifneq (x$(CAP_LIB),x)
 
52
    AST_LIBS+=$(CAP_LIB)
 
53
  endif
 
54
  AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv
 
55
else
 
56
  AST_LIBS+=$(EDITLINE_LIB) -lm
 
57
endif
 
58
 
 
59
ifneq ($(findstring darwin,$(OSARCH)),)
 
60
  AST_LIBS+=-lresolv
 
61
  ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
 
62
    ASTLINK=-Wl,-dynamic
 
63
  endif
 
64
  ASTLINK+=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
 
65
else
 
66
# These are used for all but Darwin
 
67
  ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
 
68
    ASTLINK+=-Wl,--export-dynamic
 
69
  else
 
70
    ASTLINK+=${GC_LDFLAGS}
 
71
  endif
 
72
  ifneq ($(findstring BSD,$(OSARCH)),)
 
73
    LDFLAGS+=-L/usr/local/lib
 
74
  endif
 
75
endif
 
76
 
 
77
ifeq ($(OSARCH),FreeBSD)
 
78
  # -V is understood by BSD Make, not by GNU make.
 
79
  BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
 
80
  AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
 
81
  AST_LIBS+=-lcrypto
 
82
endif
 
83
 
 
84
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
 
85
  AST_LIBS+=-lminires -ldl
 
86
  ASTLINK+= -shared -Wl,--out-implib,libasterisk.a
 
87
endif
 
88
ifeq ($(OSARCH),NetBSD)
 
89
  AST_LIBS+=-lpthread -lcrypto -lm -L/usr/pkg/lib $(EDITLINE_LIB)
 
90
endif
 
91
 
 
92
ifeq ($(OSARCH),OpenBSD)
 
93
  AST_LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
 
94
endif
 
95
 
 
96
ifeq ($(OSARCH),SunOS)
 
97
  AST_LIBS+=-lpthread -ldl -lrt -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib
 
98
  ASTLINK=
 
99
endif
 
100
 
 
101
ifneq ($(findstring USE_HOARD_ALLOCATOR,$(MENUSELECT_CFLAGS)),)
 
102
  ifneq ($(HOARD_LIB),)
 
103
    AST_LIBS+=$(HOARD_LIB)
 
104
  endif
 
105
endif
 
106
 
 
107
CHECK_SUBDIR:   # do nothing, just make sure that we recurse in the subdir/
 
108
 
 
109
editline/libedit.a: CHECK_SUBDIR
 
110
        cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(_ASTCFLAGS:-Werror=) $(ASTCFLAGS))" 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)
 
111
        $(MAKE) -C editline libedit.a
 
112
 
 
113
db1-ast/libdb1.a: CHECK_SUBDIR
 
114
        _ASTCFLAGS="$(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS) -Wno-strict-aliasing" $(MAKE) -C db1-ast libdb1.a
 
115
 
 
116
ast_expr2.c ast_expr2.h:
 
117
        bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
 
118
 
 
119
ast_expr2f.c:
 
120
        flex -o $@ ast_expr2.fl
 
121
        sed 's@#if __STDC_VERSION__ >= 199901L@#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L@' $@ > $@.fix
 
122
        echo "#include \"asterisk.h\"" > $@
 
123
        echo >> $@
 
124
        cat $@.fix >> $@
 
125
        rm $@.fix
 
126
 
 
127
ast_expr2f.o: _ASTCFLAGS+=-Wno-unused
 
128
 
 
129
testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
 
130
        $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
 
131
        $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
 
132
        $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm
 
133
        rm ast_expr2.o ast_expr2f.o 
 
134
 
 
135
ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
 
136
http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)
 
137
endif
 
138
 
 
139
stdtime/localtime.o: _ASTCFLAGS+=$(AST_NO_STRICT_OVERFLOW) -Wno-format-nonliteral
 
140
 
 
141
AST_EMBED_LDSCRIPTS:=$(sort $(EMBED_LDSCRIPTS))
 
142
AST_EMBED_LDFLAGS:=$(foreach dep,$(EMBED_LDFLAGS),$(value $(dep)))
 
143
AST_EMBED_LIBS:=$(foreach dep,$(EMBED_LIBS),$(value $(dep)))
 
144
OBJS:=$(sort $(OBJS))
 
145
 
 
146
ifneq ($(wildcard ../channels/h323/Makefile.ast),)
 
147
  include ../channels/h323/Makefile.ast
 
148
else
 
149
  H323LDFLAGS=
 
150
  H323LDLIBS=
 
151
endif
 
152
 
 
153
ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
 
154
MAIN_TGT:=asterisk.dll
 
155
asterisk: cygload
 
156
        mv cygload.exe asterisk.exe
 
157
 
 
158
cygload: asterisk.dll
 
159
else
 
160
MAIN_TGT:=asterisk
 
161
endif
 
162
 
 
163
ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
 
164
GMIMELDFLAGS+=$(GMIME_LIB)
 
165
endif
 
166
 
 
167
$(MAIN_TGT): $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
 
168
        @$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)
 
169
        $(ECHO_PREFIX) echo "   [LD] $^ -> $@"
 
170
ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
 
171
        $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS)
 
172
else
 
173
        $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS)
 
174
endif
 
175
        $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/strip_nonapi $@ || rm $@
 
176
 
 
177
clean::
 
178
        rm -f asterisk
 
179
        rm -f db1-ast/.*.d
 
180
        @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
 
181
        @$(MAKE) -C db1-ast clean
 
182
        @$(MAKE) -C stdtime clean
 
183
        rm -f libresample/src/*.o