mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
simplify dependency tracking system, using the compiler's built-in method for generating them, and only doing dependency tracking if developer mode is enabled via the configure script
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@48525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
25
Makefile
25
Makefile
@@ -239,10 +239,6 @@ OTHER_SUBDIRS:=utils agi
|
|||||||
SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
|
SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
|
||||||
SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
|
SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
|
||||||
SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
|
SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
|
||||||
SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
|
|
||||||
MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
|
|
||||||
OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
|
|
||||||
SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
|
|
||||||
SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
|
SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
|
||||||
MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
|
MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
|
||||||
MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
|
MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
|
||||||
@@ -306,7 +302,7 @@ makeopts.embed_rules: menuselect.makeopts
|
|||||||
@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
|
@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
|
||||||
@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
|
@$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
|
||||||
|
|
||||||
$(SUBDIRS): depend makeopts.embed_rules
|
$(SUBDIRS): include/asterisk/version.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
|
||||||
|
|
||||||
# ensure that all module subdirectories are processed before 'main' during
|
# ensure that all module subdirectories are processed before 'main' during
|
||||||
# a parallel build, since if there are modules selected to be embedded the
|
# a parallel build, since if there are modules selected to be embedded the
|
||||||
@@ -341,19 +337,13 @@ include/asterisk/buildopts.h: menuselect.makeopts
|
|||||||
fi
|
fi
|
||||||
@rm -f $@.tmp
|
@rm -f $@.tmp
|
||||||
|
|
||||||
$(SUBDIRS_CLEAN_DEPEND):
|
|
||||||
@$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
|
|
||||||
|
|
||||||
$(SUBDIRS_CLEAN):
|
$(SUBDIRS_CLEAN):
|
||||||
@$(MAKE) --no-print-directory -C $(@:-clean=) clean
|
@$(MAKE) --no-print-directory -C $(@:-clean=) clean
|
||||||
|
|
||||||
clean-depend: $(SUBDIRS_CLEAN_DEPEND)
|
clean: $(SUBDIRS_CLEAN)
|
||||||
|
|
||||||
clean: $(SUBDIRS_CLEAN) clean-depend
|
|
||||||
rm -f defaults.h
|
rm -f defaults.h
|
||||||
rm -f include/asterisk/build.h
|
rm -f include/asterisk/build.h
|
||||||
rm -f include/asterisk/version.h
|
rm -f include/asterisk/version.h
|
||||||
rm -f .depend
|
|
||||||
@$(MAKE) -C menuselect clean
|
@$(MAKE) -C menuselect clean
|
||||||
cp -f .cleancount .lastclean
|
cp -f .cleancount .lastclean
|
||||||
|
|
||||||
@@ -397,7 +387,6 @@ update:
|
|||||||
grep ^C update.out | cut -b4- ; \
|
grep ^C update.out | cut -b4- ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
rm -f update.out; \
|
rm -f update.out; \
|
||||||
$(MAKE) clean-depend; \
|
|
||||||
else \
|
else \
|
||||||
echo "Not under version control"; \
|
echo "Not under version control"; \
|
||||||
fi
|
fi
|
||||||
@@ -629,14 +618,6 @@ config:
|
|||||||
echo "We could not install init scripts for your operating system."; \
|
echo "We could not install init scripts for your operating system."; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$(MOD_SUBDIRS_DEPEND):
|
|
||||||
@ASTCFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
|
|
||||||
|
|
||||||
$(OTHER_SUBDIRS_DEPEND):
|
|
||||||
@ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
|
|
||||||
|
|
||||||
depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
|
|
||||||
|
|
||||||
sounds:
|
sounds:
|
||||||
$(MAKE) -C sounds all
|
$(MAKE) -C sounds all
|
||||||
|
|
||||||
@@ -696,4 +677,4 @@ menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(di
|
|||||||
@echo "Generating input for menuselect ..."
|
@echo "Generating input for menuselect ..."
|
||||||
@build_tools/prep_moduledeps > $@
|
@build_tools/prep_moduledeps > $@
|
||||||
|
|
||||||
.PHONY: menuselect main sounds clean clean-depend dist-clean distclean all prereqs depend cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
|
.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
|
||||||
|
@@ -40,7 +40,7 @@ $(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo
|
|||||||
modules.link: $(addsuffix .o,$(filter $(EMBEDDED_MODS),$(C_MODS)))
|
modules.link: $(addsuffix .o,$(filter $(EMBEDDED_MODS),$(C_MODS)))
|
||||||
modules.link: $(addsuffix .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
|
modules.link: $(addsuffix .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
|
||||||
|
|
||||||
.PHONY: clean clean-depend depend uninstall _all
|
.PHONY: clean uninstall _all
|
||||||
|
|
||||||
ifneq ($(LOADABLE_MODS),)
|
ifneq ($(LOADABLE_MODS),)
|
||||||
_all: $(LOADABLE_MODS:%=%.so)
|
_all: $(LOADABLE_MODS:%=%.so)
|
||||||
@@ -67,11 +67,9 @@ modules.link:
|
|||||||
@for file in $(patsubst %,$(SUBDIR)/%,$(filter %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
|
@for file in $(patsubst %,$(SUBDIR)/%,$(filter %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
|
||||||
@for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
|
@for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
|
||||||
|
|
||||||
clean-depend::
|
clean::
|
||||||
rm -f .depend
|
|
||||||
|
|
||||||
clean:: clean-depend
|
|
||||||
rm -f *.so *.o *.oo
|
rm -f *.so *.o *.oo
|
||||||
|
rm -f .*.o.d .*.oo.d
|
||||||
rm -f modules.link
|
rm -f modules.link
|
||||||
|
|
||||||
install:: all
|
install:: all
|
||||||
@@ -79,11 +77,6 @@ install:: all
|
|||||||
|
|
||||||
uninstall::
|
uninstall::
|
||||||
|
|
||||||
ifneq ($(wildcard .depend),)
|
ifneq ($(wildcard .*.d),)
|
||||||
include .depend
|
include .*.d
|
||||||
endif
|
endif
|
||||||
|
|
||||||
depend: .depend
|
|
||||||
|
|
||||||
.depend:
|
|
||||||
../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`
|
|
||||||
|
@@ -38,11 +38,19 @@ endif
|
|||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(ECHO_PREFIX) echo " [CC] $< -> $@"
|
$(ECHO_PREFIX) echo " [CC] $< -> $@"
|
||||||
|
ifeq ($(AST_DEVMODE),yes)
|
||||||
|
$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
|
||||||
|
else
|
||||||
$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS)
|
$(CMD_PREFIX) $(CC) -o $@ -c $< $(ASTCFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
%.oo: %.cc
|
%.oo: %.cc
|
||||||
$(ECHO_PREFIX) echo " [CXX] $< -> $@"
|
$(ECHO_PREFIX) echo " [CXX] $< -> $@"
|
||||||
|
ifeq ($(AST_DEVMODE),yes)
|
||||||
|
$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS) -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
|
||||||
|
else
|
||||||
$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS)
|
$(CMD_PREFIX) $(CXX) -o $@ -c $< $(ASTCFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
%.c: %.y
|
%.c: %.y
|
||||||
$(ECHO_PREFIX) echo " [BISON] $< -> $@"
|
$(ECHO_PREFIX) echo " [BISON] $< -> $@"
|
||||||
|
17
agi/Makefile
17
agi/Makefile
@@ -11,7 +11,7 @@
|
|||||||
# the GNU General Public License
|
# the GNU General Public License
|
||||||
#
|
#
|
||||||
|
|
||||||
.PHONY: clean clean-depend all depend uninstall
|
.PHONY: clean all uninstall
|
||||||
|
|
||||||
AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
|
AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
|
||||||
|
|
||||||
@@ -37,18 +37,11 @@ install: all
|
|||||||
uninstall:
|
uninstall:
|
||||||
for x in $(AGIS); do rm -f $(DESTDIR)$(AGI_DIR)/$$x ; done
|
for x in $(AGIS); do rm -f $(DESTDIR)$(AGI_DIR)/$$x ; done
|
||||||
|
|
||||||
clean-depend:
|
clean:
|
||||||
rm -f .depend
|
|
||||||
|
|
||||||
clean: clean-depend
|
|
||||||
rm -f *.so *.o look eagi-test eagi-sphinx-test
|
rm -f *.so *.o look eagi-test eagi-sphinx-test
|
||||||
|
rm -f .*.o.d .*.oo.d
|
||||||
rm -f strcompat.c
|
rm -f strcompat.c
|
||||||
|
|
||||||
ifneq ($(wildcard .depend),)
|
ifneq ($(wildcard .*.d),)
|
||||||
include .depend
|
include .*.d
|
||||||
endif
|
endif
|
||||||
|
|
||||||
depend: .depend
|
|
||||||
|
|
||||||
.depend:
|
|
||||||
../build_tools/mkdep $(CFLAGS) `ls *.c`
|
|
||||||
|
@@ -1,123 +0,0 @@
|
|||||||
#!/bin/sh -
|
|
||||||
#
|
|
||||||
# $OpenBSD: mkdep.gcc.sh,v 1.8 1998/09/02 06:40:07 deraadt Exp $
|
|
||||||
# $NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $
|
|
||||||
#
|
|
||||||
# Copyright (c) 1991, 1993
|
|
||||||
# The Regents of the University of California. All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# 3. All advertising materials mentioning features or use of this software
|
|
||||||
# must display the following acknowledgement:
|
|
||||||
# This product includes software developed by the University of
|
|
||||||
# California, Berkeley and its contributors.
|
|
||||||
# 4. Neither the name of the University nor the names of its contributors
|
|
||||||
# may be used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
# SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
|
|
||||||
#
|
|
||||||
|
|
||||||
D=.depend # default dependency file is .depend
|
|
||||||
append=0
|
|
||||||
pflag=
|
|
||||||
dflag=
|
|
||||||
|
|
||||||
while :
|
|
||||||
do case "$1" in
|
|
||||||
# -a appends to the depend file
|
|
||||||
-a)
|
|
||||||
append=1
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
# -f allows you to select a makefile name
|
|
||||||
-f)
|
|
||||||
D=$2
|
|
||||||
shift; shift ;;
|
|
||||||
|
|
||||||
# the -p flag produces "program: program.c" style dependencies
|
|
||||||
# so .o's don't get produced
|
|
||||||
-p)
|
|
||||||
pflag=p
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
# the -d flag produces double-colon rules instead of single-colon rules
|
|
||||||
-d)
|
|
||||||
dflag=d
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $# = 0 ] ; then
|
|
||||||
echo 'usage: mkdep [-p] [-d] [-f depend_file] [cc_flags] file ...'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DTMP=/tmp/mkdep$$
|
|
||||||
TMP=$DTMP/mkdep
|
|
||||||
|
|
||||||
um=`umask`
|
|
||||||
umask 022
|
|
||||||
mkdir $DTMP
|
|
||||||
if [ $? != 0 ] ; then
|
|
||||||
echo failed to create tmp dir $DTMP
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
umask $um
|
|
||||||
trap 'rm -rf $DTMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
|
|
||||||
|
|
||||||
if [ x$pflag = xp ]; then
|
|
||||||
${CC:-cc} -M "$@" 2>/dev/null | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
|
|
||||||
elif [ x$dflag = xd ]; then
|
|
||||||
${CC:-cc} -M "$@" 2>/dev/null | sed -e 's;\.o:;\.o::;' -e 's; \./; ;g' > $TMP
|
|
||||||
else
|
|
||||||
${CC:-cc} -M "$@" 2>/dev/null | sed -e 's; \./; ;g' > $TMP
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo 'mkdep: compile failed.'
|
|
||||||
rm -rf $DTMP
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $append = 1 ]; then
|
|
||||||
cat $TMP >> $D
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo 'mkdep: append failed.'
|
|
||||||
rm -rf $DTMP
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
mv $TMP $D
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo 'mkdep: rename failed.'
|
|
||||||
rm -rf $DTMP
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $DTMP
|
|
||||||
exit 0
|
|
@@ -140,7 +140,6 @@ asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
|
|||||||
|
|
||||||
clean::
|
clean::
|
||||||
rm -f asterisk
|
rm -f asterisk
|
||||||
rm -f .depend
|
|
||||||
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
|
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
|
||||||
@$(MAKE) -C db1-ast clean
|
@$(MAKE) -C db1-ast clean
|
||||||
@$(MAKE) -C stdtime clean
|
@$(MAKE) -C stdtime clean
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
# the GNU General Public License
|
# the GNU General Public License
|
||||||
#
|
#
|
||||||
|
|
||||||
.PHONY: clean clean-depend all depend uninstall
|
.PHONY: clean all uninstall
|
||||||
|
|
||||||
ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted
|
ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted
|
||||||
UTILS:=$(ALL_UTILS)
|
UTILS:=$(ALL_UTILS)
|
||||||
@@ -51,11 +51,9 @@ install:
|
|||||||
uninstall:
|
uninstall:
|
||||||
for x in $(ALL_UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
|
for x in $(ALL_UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
|
||||||
|
|
||||||
clean-depend:
|
clean:
|
||||||
rm -f .depend
|
|
||||||
|
|
||||||
clean: clean-depend
|
|
||||||
rm -f *.o $(ALL_UTILS) check_expr
|
rm -f *.o $(ALL_UTILS) check_expr
|
||||||
|
rm -f .*.o.d .*.oo.d
|
||||||
rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c
|
rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c
|
||||||
rm -f aelparse.c aelbison.c
|
rm -f aelparse.c aelbison.c
|
||||||
|
|
||||||
@@ -122,11 +120,6 @@ streamplayer: streamplayer.o
|
|||||||
muted: muted.o
|
muted: muted.o
|
||||||
muted: LIBS+=$(AUDIO_LIBS)
|
muted: LIBS+=$(AUDIO_LIBS)
|
||||||
|
|
||||||
ifneq ($(wildcard .depend),)
|
ifneq ($(wildcard .*.d),)
|
||||||
include .depend
|
include .*.d
|
||||||
endif
|
endif
|
||||||
|
|
||||||
depend: .depend
|
|
||||||
|
|
||||||
.depend:
|
|
||||||
../build_tools/mkdep $(ASTCFLAGS) `ls *.c`
|
|
||||||
|
Reference in New Issue
Block a user