diff --git a/.cleancount b/.cleancount index 60d3b2f4a4..b6a7d89c68 100644 --- a/.cleancount +++ b/.cleancount @@ -1 +1 @@ -15 +16 diff --git a/Makefile b/Makefile index 3bac7dc42a..60d836a780 100644 --- 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: diff --git a/build_tools/Makefile b/build_tools/Makefile index d5d5df043e..d48017fc26 100644 --- a/build_tools/Makefile +++ b/build_tools/Makefile @@ -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) diff --git a/build_tools/cflags.xml b/build_tools/cflags.xml index af8077ff19..fc424f60be 100644 --- a/build_tools/cflags.xml +++ b/build_tools/cflags.xml @@ -1,20 +1,20 @@ - + - + - + - + - + - + - + - + - + diff --git a/build_tools/make_buildopts_h b/build_tools/make_buildopts_h new file mode 100755 index 0000000000..9ee20bc5ae --- /dev/null +++ b/build_tools/make_buildopts_h @@ -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 diff --git a/configure.ac b/configure.ac index ba97551106..32a37e4aae 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/include/autoconfig.h.in b/include/autoconfig.h.in index 2e71520e27..082755c287 100644 --- a/include/autoconfig.h.in +++ b/include/autoconfig.h.in @@ -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