Let's have build.h created a bit earlier so that func_version can use it and not...
[asterisk/asterisk.git] / main / Makefile
index 037a10a..4a47104 100644 (file)
@@ -39,6 +39,7 @@ OBJS+=say.o
 
 ifeq ($(wildcard /usr/include/sys/poll.h),)
   OBJS+=poll.o
+  ASTCFLAGS+=-DPOLLCOMPAT
 endif
 
 ifeq ($(wildcard /usr/include/dlfcn.h),)
@@ -49,6 +50,9 @@ ifneq ($(findstring $(OSARCH), linux-gnu uclinux ),)
   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
@@ -59,11 +63,6 @@ ifneq ($(findstring darwin,$(OSARCH)),)
   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
     ASTLINK=-Wl,-dynamic
   endif
-  # Mac on Intel CoreDuo does not need poll compatibility layer
-  ifneq ($(PROC),i386)
-    OBJS+=poll.o
-    ASTCFLAGS+=-DPOLLCOMPAT
-  endif
 else
 # These are used for all but Darwin
   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
@@ -94,11 +93,11 @@ ifeq ($(OSARCH),SunOS)
 endif
 
 editline/libedit.a:
-       cd editline && unset CFLAGS AST_LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)
+       cd editline && test -f config.h ||  CFLAGS="$(ASTCFLAGS:-Werror=)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)
        $(MAKE) -C editline libedit.a
 
 db1-ast/libdb1.a:
-       CFLAGS="$(ASTCFLAGS)" $(MAKE) -C db1-ast libdb1.a
+       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
@@ -112,22 +111,25 @@ testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
        $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
        rm ast_expr2.o ast_expr2f.o 
 
-channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
+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
+
 asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
-       @$(ASTTOPDIR)/build_tools/make_build_h > $(ASTTOPDIR)/include/asterisk/build.h.tmp
-       @if cmp -s $(ASTTOPDIR)/include/asterisk/build.h.tmp $(ASTTOPDIR)/include/asterisk/build.h ; then echo ; else \
-               mv $(ASTTOPDIR)/include/asterisk/build.h.tmp $(ASTTOPDIR)/include/asterisk/build.h ; \
-       fi
-       @rm -f $(ASTTOPDIR)/include/asterisk/build.h.tmp
-       @$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
+       @$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
        $(ECHO_PREFIX) echo "   [LD] $^ -> $@"
-       $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o asterisk $(ASTLINK) $(AST_EMBED_LDFLAGS) $(LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS)
+       $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
+       @$(ASTTOPDIR)/build_tools/strip_nonapi $@
 
 clean::
        rm -f asterisk