dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 93180 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r93180 | kpfleming | 2007-12-16 22:44:51 -0800 (Sun, 16 Dec 2007) | 23 lines

In http://lists.digium.com/pipermail/asterisk-dev/2007-December/031145.html,
rizzo brought up some issues related to the way that the metadata required
for menuselect and the rest of the build system is extracted from the source
files. Since I had a few hours to kill on an airplane today, I decided to
improve this situation... so now the system caches the extracted metadata
and uses it to build the menuselect 'tree' as much as it can. The result
of this is that when a single source file is changed, only the metadata for
that file needs to be extracted again, and the rest is used from the cache
files. I also reduced the number of forked processes required to do the
metadata extraction; it was actually possible to do most of what we needed
in the Makefiles themselves without using any shell scripts at all! On my
laptop, these changes resulted in an 80% decrease in the time required
for the 'menuselect.makeopts' automatic check to occur after editing a single
source file.

While doing this work I also cleaned up a few minor things in the Makefiles,
adding a check for 'awk' to the configure script and changed all remaining
places we use 'grep' or 'awk' to use the ones found by the configure script,
and changed the 'prep_tarball' script to build the menuselect metadata so
that tarballs of Asterisk will include it and won't require the user to
wait while it is extracted after unpacking.


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@93184 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
kpfleming 2007-12-17 07:25:35 +00:00
parent d1afe77d7d
commit d4e966efcc
18 changed files with 3387 additions and 9060 deletions

View File

@ -79,6 +79,7 @@ export HOST_CC
export INSTALL
export STRIP
export DOWNLOAD
export AWK
export GREP
export ID
@ -250,10 +251,10 @@ ifeq ($(OSARCH),SunOS)
ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
endif
ASTERISKVERSION:=$(shell build_tools/make_version .)
ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
ifneq ($(wildcard .version),)
ASTERISKVERSIONNUM:=$(shell awk -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
RPMVERSION:=$(shell sed 's/[-\/:]/_/g' .version)
else
RPMVERSION=unknown
@ -279,6 +280,7 @@ SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
MOD_SUBDIRS_MENUSELECT_TREE:=$(MOD_SUBDIRS:%=%-menuselect-tree)
ifneq ($(findstring darwin,$(OSARCH)),)
ASTCFLAGS+=-D__Darwin__
@ -295,6 +297,11 @@ ifeq ($(OSARCH),SunOS)
SOLINK=-shared -fpic -L/usr/local/ssl/lib
endif
# comment to print directories during submakes
PRINT_DIR?= --no-print-directory
SUBMAKE=$(MAKE) --quiet $(PRINT_DIR)
# This is used when generating the doxygen documentation
ifneq ($(DOT),:)
HAVEDOT=yes
@ -311,9 +318,6 @@ else
mK=" make"
endif
# comment to print directories during submakes
PRINT_DIR?= --no-print-directory
all: _all
@echo " +--------- Asterisk Build Complete ---------+"
@echo " + Asterisk has successfully been built, and +"
@ -335,13 +339,17 @@ menuselect.makeopts: menuselect/menuselect menuselect-tree
menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
$(MOD_SUBDIRS_EMBED_LDSCRIPT):
@echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet $(PRINT_DIR) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
@echo "EMBED_LDSCRIPTS+="`$(SUBMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
$(MOD_SUBDIRS_EMBED_LDFLAGS):
@echo "EMBED_LDFLAGS+="`$(MAKE) --quiet $(PRINT_DIR) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
@echo "EMBED_LDFLAGS+="`$(SUBMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
$(MOD_SUBDIRS_EMBED_LIBS):
@echo "EMBED_LIBS+="`$(MAKE) --quiet $(PRINT_DIR) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
@echo "EMBED_LIBS+="`$(SUBMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
$(MOD_SUBDIRS_MENUSELECT_TREE):
@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
makeopts.embed_rules: menuselect.makeopts
@echo "Generating embedded module rules ..."
@ -782,7 +790,15 @@ menuselect/makeopts:
menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml configure
@echo "Generating input for menuselect ..."
@build_tools/prep_moduledeps > $@
@echo "<?xml version=\"1.0\"?>" > $@
@echo >> $@
@echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
@for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
@cat build_tools/cflags.xml >> $@
@cat build_tools/embed_modules.xml >> $@
@cat sounds/sounds.xml >> $@
@echo "</menu>" >> $@
pdf: asterisk.pdf
asterisk.pdf:

View File

@ -41,33 +41,19 @@ include $(ASTTOPDIR)/Makefile.rules
# Use MODULE_EXCLUDE to specify additional modules to exclude.
ifneq ($(MODULE_PREFIX),)
# Compute the lowercase and uppercase directory name. The former
# is used as a key in MENUSELECT_EMBED, the latter is part of
# the name of the MENUSELECT_* variable containing the exclude list
# generated by menuselect.
A:=$(notdir $(CURDIR))
B:=$(shell echo $A | tr "[a-z]" "[A-Z]")
# MENUSELECT_$(L) contains the list of modules excluded by menuselect.
# MODULE_EXCLUDE contains the locally generated exclude list
L:=$(MENUSELECT_$(B)) $(MODULE_EXCLUDE)
# construct the list of C and CC modules from the content of the directory
C_MODS:=
CC_MODS:=
C_MODS+=$(foreach pre,$(MODULE_PREFIX),$(filter-out $(L),$(patsubst %.c,%,$(wildcard $(pre)*.c))))
CC_MODS+=$(foreach pre,$(MODULE_PREFIX),$(filter-out $(L),$(patsubst %.cc,%,$(wildcard $(pre)*.cc))))
ALL_C_MODS:=$(patsubst %.c,%,$(wildcard $(MODULE_PREFIX)_*.c))
ALL_CC_MODS:=$(patsubst %.cc,%,$(wildcard $(MODULE_PREFIX)_*.cc))
C_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_C_MODS))
CC_MODS:=$(filter-out $(MENUSELECT_$(MENUSELECT_CATEGORY)),$(ALL_CC_MODS))
# and store in the list of embedded or loadable modules
ifneq ($(findstring $(A),$(MENUSELECT_EMBED)),)
ifneq ($(findstring $(MENUSELECT_CATEGORY),$(MENUSELECT_EMBED)),)
EMBEDDED_MODS:=$(C_MODS) $(CC_MODS)
else
LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
endif
endif
# debugging
# x:=$(shell echo 'in $(B)' >&2)
# x:=$(shell echo 'filtered out $(L)' >&2)
# x:=$(shell echo 'C_MODS= $(C_MODS)' >&2)
# x:=$(shell sleep 2)
# Both C++ and C++ sources need their module name in AST_MODULE
# We also pass whatever _INCLUDE list is generated by menuselect
@ -92,7 +78,7 @@ $(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo
modules.link: $(addsuffix .eo,$(filter $(EMBEDDED_MODS),$(C_MODS)))
.PHONY: clean uninstall _all
.PHONY: clean uninstall _all moduleinfo makeopts
ifneq ($(LOADABLE_MODS),)
_all: $(LOADABLE_MODS:%=%.so)
@ -137,6 +123,40 @@ install:: all
uninstall::
dist-clean::
rm -f .*.moduleinfo .moduleinfo
rm -f .*.makeopts .makeopts
.%.moduleinfo: %.c
@echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.o $(SUBDIR)/$*.so\">" > $@
$(AWK) -f $(ASTTOPDIR)/build_tools/get_moduleinfo $< >> $@
echo "</member>" >> $@
.%.moduleinfo: %.cc
@echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.oo $(SUBDIR)/$*.so\">" > $@
$(AWK) -f $(ASTTOPDIR)/build_tools/get_moduleinfo $< >> $@
echo "</member>" >> $@
.moduleinfo:: $(addsuffix .moduleinfo,$(addprefix .,$(ALL_C_MODS) $(ALL_CC_MODS)))
@echo "<category name=\"MENUSELECT_$(MENUSELECT_CATEGORY)\" displayname=\"$(MENUSELECT_DESCRIPTION)\" remove_on_change=\"$(SUBDIR)/modules.link\">" > $@
@cat $^ >> $@
@echo "</category>" >> $@
moduleinfo: .moduleinfo
@cat $<
.%.makeopts: %.c
@$(AWK) -f $(ASTTOPDIR)/build_tools/get_makeopts $< > $@
.%.makeopts: %.cc
@$(AWK) -f $(ASTTOPDIR)/build_tools/get_makeopts $< > $@
.makeopts:: $(addsuffix .makeopts,$(addprefix .,$(ALL_C_MODS) $(ALL_CC_MODS)))
@cat $^ > $@
makeopts: .makeopts
@cat $<
ifneq ($(wildcard .*.d),)
include .*.d
endif

View File

@ -11,10 +11,10 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
#interesting files in this directory start with app_
MODULE_PREFIX=app_
MODULE_PREFIX=app
MENUSELECT_CATEGORY=APPS
MENUSELECT_DESCRIPTION=Applications
# create extra MENUSELECT_DEPENDS entries.
MENUSELECT_OPTS_app_directory:=$(MENUSELECT_OPTS_app_voicemail)
ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)

View File

@ -1,26 +1,26 @@
<category name="MENUSELECT_EMBED" displayname="Module Embedding" positive_output="yes" remove_on_change="main/asterisk">
<member name="apps" displayname="Applications" remove_on_change="apps/*.o">
<member name="APPS" displayname="Applications" remove_on_change="apps/*.o">
<depend>gnu_ld</depend>
</member>
<member name="cdr" displayname="Call Detail Recording" remove_on_change="cdr/*.o">
<member name="CDR" displayname="Call Detail Recording" remove_on_change="cdr/*.o">
<depend>gnu_ld</depend>
</member>
<member name="channels" displayname="Channels" remove_on_change="channels/*.o channels/misdn/*.o">
<member name="CHANNELS" displayname="Channels" remove_on_change="channels/*.o channels/misdn/*.o">
<depend>gnu_ld</depend>
</member>
<member name="codecs" displayname="Coders/Decoders" remove_on_change="codecs/*.o codecs/gsm/src/*.o codecs/ilbc/*.o codecs/lpc10/*.o codecs/gsm/lib/libgsm.a codecs/lpc10/liblpc10.a codecs/ilbc/libilbc.a codecs/g722/libg722.a">
<member name="CODECS" displayname="Coders/Decoders" remove_on_change="codecs/*.o codecs/gsm/src/*.o codecs/ilbc/*.o codecs/lpc10/*.o codecs/gsm/lib/libgsm.a codecs/lpc10/liblpc10.a codecs/ilbc/libilbc.a codecs/g722/libg722.a">
<depend>gnu_ld</depend>
</member>
<member name="formats" displayname="File Formats" remove_on_change="formats/*.o">
<member name="FORMATS" displayname="File Formats" remove_on_change="formats/*.o">
<depend>gnu_ld</depend>
</member>
<member name="funcs" displayname="Dialplan Functions" remove_on_change="funcs/*.o">
<member name="FUNCS" displayname="Dialplan Functions" remove_on_change="funcs/*.o">
<depend>gnu_ld</depend>
</member>
<member name="pbx" displayname="PBX Functionality" remove_on_change="pbx/*.o pbx/ael/*.o">
<member name="PBX" displayname="PBX Functionality" remove_on_change="pbx/*.o pbx/ael/*.o">
<depend>gnu_ld</depend>
</member>
<member name="res" displayname="Resource Modules" remove_on_change="res/*.o res/snmp/*.o">
<member name="RES" displayname="Resource Modules" remove_on_change="res/*.o res/snmp/*.o">
<depend>gnu_ld</depend>
</member>
</category>

View File

@ -3,7 +3,7 @@
if [ -f ${1}/.version ]; then
cat ${1}/.version
elif [ -d .svn ]; then
PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e 's:^.*/svn/asterisk/::' | sed -e 's:/: :g'`
PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/asterisk/::' | sed -e 's:/: :g'`
BRANCH=0
TEAM=0
TAG=0

View File

@ -1,48 +0,0 @@
#!/bin/sh
get_description() {
TDESC=`${GREP} -e AST_MODULE_INFO ${1} | head -n 1 | cut -d '"' -f 2`
}
process_dir() {
dir=${1}
prefix=${2}_
catsuffix=${3}
displayname=${4}
printf "\t<category name=\"MENUSELECT_${catsuffix}\" displayname=\"${displayname}\" remove_on_change=\"${dir}/modules.link\">\n"
for file in `ls ${dir}/${prefix}*.c ${dir}/${prefix}*.cc 2> /dev/null | sort`
do
if [ ! -f ${file} ]; then
continue
fi
fname=`basename ${file} .c`
fname=`basename ${fname} .cc`
get_description ${file}
desc=${TDESC}
printf "\t\t<member name=\"${fname}\" displayname=\"${desc}\" remove_on_change=\"${dir}/${fname}.o ${dir}/${fname}.oo ${dir}/${fname}.so\">\n"
awk -f build_tools/get_moduleinfo ${file}
printf "\t\t</member>\n"
awk -f build_tools/get_makeopts ${file} >> .makeoptstmp
done
printf "\t</category>\n"
}
echo "<?xml version=\"1.0\"?>"
echo
echo "<menu name=\"Asterisk Module Selection\">"
rm -f .makeoptstmp
process_dir apps app APPS Applications
process_dir cdr cdr CDR "Call Detail Recording"
process_dir channels chan CHANNELS "Channel Drivers"
process_dir codecs codec CODECS "Codec Translators"
process_dir formats format FORMATS "Format Interpreters"
process_dir funcs func FUNCS "Dialplan Functions"
process_dir pbx pbx PBX "PBX Modules"
process_dir res res RES "Resource Modules"
cat .makeoptstmp
cat build_tools/cflags.xml
cat build_tools/embed_modules.xml
cat sounds/sounds.xml
rm -f .makeoptstmp
echo "</menu>"

View File

@ -5,7 +5,8 @@
#
# It will be executed from the top-level directory of the project.
make -C sounds all MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-FREEPLAY-WAV WGET=wget DOWNLOAD=wget
make -C sounds MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-FREEPLAY-WAV WGET=wget DOWNLOAD=wget all
make AWK=awk GREP=grep menuselect-tree
VERSION=`cat .version`
sed -i -e "s/ASTERISKVERSION/${VERSION}/" doc/tex/asterisk.tex

View File

@ -11,7 +11,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=cdr_
MODULE_PREFIX=cdr
MENUSELECT_CATEGORY=CDR
MENUSELECT_DESCRIPTION=Call Detail Recording
all: _all

View File

@ -11,7 +11,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=chan_
MODULE_PREFIX=chan
MENUSELECT_CATEGORY=CHANNELS
MENUSELECT_DESCRIPTION=Channel Drivers
ifeq ($(OSARCH),OpenBSD)
PTLIB=-lpt_OpenBSD_x86_r

View File

@ -13,7 +13,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=codec_
MODULE_PREFIX=codec
MENUSELECT_CATEGORY=CODECS
MENUSELECT_DESCRIPTION=Codec Translators
LIBILBC:=ilbc/libilbc.a
LIBLPC10:=lpc10/liblpc10.a

12237
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -8,11 +8,7 @@
AC_PREREQ(2.60)
m4_define([PBX_VERSION],
m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),
[\([0-9.]*\)\(\w\|\W\)*],
[\1]))
AC_INIT(asterisk, PBX_VERSION, www.asterisk.org)
AC_INIT(asterisk, 1.4, www.asterisk.org)
# cross-compile macros
AC_CANONICAL_BUILD
@ -143,6 +139,7 @@ if test "x$with_gnu_ld" = "xyes" ; then
fi
AC_SUBST(GNU_LD)
AC_PATH_PROG([AWK], [awk], :)
AC_PATH_PROG([GREP], [grep], :)
AC_PATH_PROG([FIND], [find], :)
AC_PATH_PROG([COMPRESS], [compress], :)

View File

@ -11,7 +11,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=format_
MODULE_PREFIX=format
MENUSELECT_CATEGORY=FORMATS
MENUSELECT_DESCRIPTION=Format Interpreters
all: _all

View File

@ -11,7 +11,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=func_
MODULE_PREFIX=func
MENUSELECT_CATEGORY=FUNCS
MENUSELECT_DESCRIPTION=Dialplan Functions
all: _all

View File

@ -1131,6 +1131,9 @@
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Define like PROTOTYPES; this can be used by system headers. */
#undef __PROTOTYPES

View File

@ -7,6 +7,7 @@ HOST_CC=cc
CXX=@CXX@
INSTALL=@INSTALL@
AWK=@AWK@
GREP=@GREP@
AR=@AR@
RANLIB=@RANLIB@

View File

@ -11,7 +11,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=pbx_
MODULE_PREFIX=pbx
MENUSELECT_CATEGORY=PBX
MENUSELECT_DESCRIPTION=PBX Modules
all: _all

View File

@ -11,7 +11,9 @@
-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
MODULE_PREFIX=res_
MODULE_PREFIX=res
MENUSELECT_CATEGORY=RES
MENUSELECT_DESCRIPTION=Resource Modules
all: _all