change the CFLAGS controlled by menuselect to be placed in a header file
authorRussell Bryant <russell@russellbryant.com>
Thu, 11 May 2006 09:50:41 +0000 (09:50 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 11 May 2006 09:50:41 +0000 (09:50 +0000)
instead of being added to the compiler commands.  This header file will be
installed and modules built outside of the main tree will be able to use the
same build options used to build the rest of Asterisk.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26808 65c4cc65-6c06-0410-ace0-fbb531ad65f3

.cleancount
Makefile
build_tools/Makefile
build_tools/cflags.xml
build_tools/make_buildopts_h [new file with mode: 0755]
configure.ac
include/autoconfig.h.in

index 60d3b2f..b6a7d89 100644 (file)
@@ -1 +1 @@
-15
+16
index 3bac7dc..60d836a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -195,7 +195,6 @@ ifneq ($(wildcard makeopts),)
   include makeopts
 endif
 
-ASTCFLAGS+=$(MENUSELECT_CFLAGS)
 TOPDIR_CFLAGS=-include include/autoconfig.h -Iinclude
 MOD_SUBDIR_CFLAGS=-include ../include/autoconfig.h -I../include -I..
 OTHER_SUBDIR_CFLAGS=-include ../include/autoconfig.h -I../include -I..
@@ -432,7 +431,7 @@ _all: all
        @echo " +               make install                +"  
        @echo " +-------------------------------------------+"  
 
-all: config.status menuselect.makeopts cleantest depend asterisk subdirs
+all: cleantest config.status menuselect.makeopts depend asterisk subdirs
 
 config.status: configure
        @CFLAGS="" ./configure
@@ -525,10 +524,17 @@ include/asterisk/version.h:
        fi
        @rm -f $@.tmp
 
+include/asterisk/buildopts.h: menuselect.makeopts
+       @build_tools/make_buildopts_h > $@.tmp
+       @if cmp -s $@.tmp $@ ; then echo; else \
+               mv $@.tmp $@ ; \
+       fi
+       @rm -f $@.tmp
+
 stdtime/libtime.a:
        CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
 
-asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
+asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
        build_tools/make_build_h > include/asterisk/build.h.tmp
        if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
                mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
@@ -567,6 +573,7 @@ dist-clean: clean
        rm -f menuselect.makeopts makeopts makeopts.xml
        rm -f config.log config.status
        rm -f include/autoconfig.h
+       rm -f include/asterisk/buildopts.h
        $(MAKE) -C mxml clean
        $(MAKE) -C build_tools dist-clean
 
@@ -862,7 +869,7 @@ spec:
 
 rpm: __rpm
 
-__rpm: include/asterisk/version.h spec
+__rpm: include/asterisk/version.h include/asterisk/buildopts.h spec
        rm -rf /tmp/asterisk ; \
        mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
        $(MAKE) DESTDIR=/tmp/asterisk install ; \
@@ -911,10 +918,10 @@ dont-optimize: _all
 
 valgrind: dont-optimize
 
-depend: include/asterisk/version.h .depend defaults.h 
+depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h 
        @for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done
 
-.depend: include/asterisk/version.h defaults.h
+.depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
        build_tools/mkdep $(CFLAGS) $(wildcard *.c)
 
 .tags-depend:
@@ -958,7 +965,7 @@ env:
 
 cleantest:
        @if cmp -s .cleancount .lastclean ; then echo ; else \
-               $(MAKE) clean; cp -f .cleancount .lastclean;\
+               $(MAKE) dist-clean; cp -f .cleancount .lastclean;\
        fi
 
 _uninstall:
index d5d5df0..d48017f 100644 (file)
@@ -1,5 +1,5 @@
 MENUSELECT_OBJS=menuselect.o menuselect_curses.o
-MENUSELECT_CFLAGS=-g -c -D_GNU_SOURCE -I../ -I../include/
+MENUSELECT_CFLAGS=-g -c -D_GNU_SOURCE -DMENUSELECT -I../ -I../include/
 MENUSELECT_LIBS=../mxml/libmxml.a
 
 ifeq ($(OSARCH),SunOS)
index af8077f..fc424f6 100644 (file)
@@ -1,20 +1,20 @@
        <category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" force_clean_on_change="yes">
-               <member name="-DDEBUG_SCHEDULER">
+               <member name="DEBUG_SCHEDULER">
                </member>
-               <member name="-DDEBUG_THREADS">
+               <member name="DEBUG_THREADS">
                </member>
-               <member name="-DDETECT_DEADLOCKS">
+               <member name="DETECT_DEADLOCKS">
                </member>
-               <member name="-DDUMP_SCHEDULER">
+               <member name="DUMP_SCHEDULER">
                </member>
-               <member name="-DLOW_MEMORY">
+               <member name="LOW_MEMORY">
                </member>
-               <member name="-DMALLOC_DEBUG">
+               <member name="MALLOC_DEBUG">
                </member>
-               <member name="-DRADIO_RELAX">
+               <member name="RADIO_RELAX">
                </member>
-               <member name="-DTRACE_FRAMES">
+               <member name="TRACE_FRAMES">
                </member>
-               <member name="-DMTX_PROFILE">
+               <member name="MTX_PROFILE">
                </member>
        </category>
diff --git a/build_tools/make_buildopts_h b/build_tools/make_buildopts_h
new file mode 100755 (executable)
index 0000000..9ee20bc
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+cat << END
+/*
+ * buildopts.h 
+ * Automatically generated
+ */
+
+END
+TMP=`grep MENUSELECT_CFLAGS menuselect.makeopts | sed s/MENUSELECT_CFLAGS\=//g`
+for x in ${TMP}; do
+     echo "#define ${x}"
+done
index ba97551..32a37e4 100644 (file)
@@ -111,6 +111,10 @@ AC_SUBST(PBX_OSTYPE)
 AC_GNU_SOURCE
 
 AH_TOP(
+#ifndef MENUSELECT
+#include "asterisk/buildopts.h"
+#endif
+
 #ifndef _REENTRANT
 #define _REENTRANT
 #endif
index 2e71520..082755c 100644 (file)
@@ -1,5 +1,9 @@
 /* include/autoconfig.h.in.  Generated from configure.ac by autoheader.  */
 
+#ifndef MENUSELECT
+#include "asterisk/buildopts.h"
+#endif
+
 #ifndef _REENTRANT
 #define _REENTRANT
 #endif