aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-16 21:14:34 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-16 21:14:34 +0000
commit97792cbb75b09c9a6cb77133b38f05897c3671e7 (patch)
tree634eecb7c15f2d75c5190c86e0d151846f03ebf8
parent8b5225e1c5dfe48c9521d4b02a73fa405f2c4a2f (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@48525 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--Makefile25
-rw-r--r--Makefile.moddir_rules17
-rw-r--r--Makefile.rules8
-rw-r--r--agi/Makefile17
-rwxr-xr-xbuild_tools/mkdep123
-rw-r--r--main/Makefile1
-rw-r--r--utils/Makefile17
7 files changed, 26 insertions, 182 deletions
diff --git a/Makefile b/Makefile
index c0101a4f7..20625f997 100644
--- a/Makefile
+++ b/Makefile
@@ -239,10 +239,6 @@ OTHER_SUBDIRS:=utils agi
SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
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)
MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
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_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
# a parallel build, since if there are modules selected to be embedded the
@@ -341,19 +337,13 @@ include/asterisk/buildopts.h: menuselect.makeopts
fi
@rm -f $@.tmp
-$(SUBDIRS_CLEAN_DEPEND):
- @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
-
$(SUBDIRS_CLEAN):
@$(MAKE) --no-print-directory -C $(@:-clean=) clean
-clean-depend: $(SUBDIRS_CLEAN_DEPEND)
-
-clean: $(SUBDIRS_CLEAN) clean-depend
+clean: $(SUBDIRS_CLEAN)
rm -f defaults.h
rm -f include/asterisk/build.h
rm -f include/asterisk/version.h
- rm -f .depend
@$(MAKE) -C menuselect clean
cp -f .cleancount .lastclean
@@ -397,7 +387,6 @@ update:
grep ^C update.out | cut -b4- ; \
fi ; \
rm -f update.out; \
- $(MAKE) clean-depend; \
else \
echo "Not under version control"; \
fi
@@ -629,14 +618,6 @@ config:
echo "We could not install init scripts for your operating system."; \
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:
$(MAKE) -C sounds all
@@ -696,4 +677,4 @@ menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(di
@echo "Generating input for menuselect ..."
@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)
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index 6925636b9..c614c2ab5 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -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 .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
-.PHONY: clean clean-depend depend uninstall _all
+.PHONY: clean uninstall _all
ifneq ($(LOADABLE_MODS),)
_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-out %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
-clean-depend::
- rm -f .depend
-
-clean:: clean-depend
+clean::
rm -f *.so *.o *.oo
+ rm -f .*.o.d .*.oo.d
rm -f modules.link
install:: all
@@ -79,11 +77,6 @@ install:: all
uninstall::
-ifneq ($(wildcard .depend),)
- include .depend
+ifneq ($(wildcard .*.d),)
+ include .*.d
endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`
diff --git a/Makefile.rules b/Makefile.rules
index 59ced05ea..591322ef2 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -38,11 +38,19 @@ endif
%.o: %.c
$(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)
+endif
%.oo: %.cc
$(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)
+endif
%.c: %.y
$(ECHO_PREFIX) echo " [BISON] $< -> $@"
diff --git a/agi/Makefile b/agi/Makefile
index 3a3495138..4066cda0b 100644
--- a/agi/Makefile
+++ b/agi/Makefile
@@ -11,7 +11,7 @@
# 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
@@ -37,18 +37,11 @@ install: all
uninstall:
for x in $(AGIS); do rm -f $(DESTDIR)$(AGI_DIR)/$$x ; done
-clean-depend:
- rm -f .depend
-
-clean: clean-depend
+clean:
rm -f *.so *.o look eagi-test eagi-sphinx-test
+ rm -f .*.o.d .*.oo.d
rm -f strcompat.c
-ifneq ($(wildcard .depend),)
- include .depend
+ifneq ($(wildcard .*.d),)
+ include .*.d
endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c`
diff --git a/build_tools/mkdep b/build_tools/mkdep
deleted file mode 100755
index 84f969b1d..000000000
--- a/build_tools/mkdep
+++ /dev/null
@@ -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
diff --git a/main/Makefile b/main/Makefile
index 23e4e22f2..8f203d7d3 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -140,7 +140,6 @@ asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a $(AST_EMBED_LDSCRIPTS)
clean::
rm -f asterisk
- rm -f .depend
@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
@$(MAKE) -C db1-ast clean
@$(MAKE) -C stdtime clean
diff --git a/utils/Makefile b/utils/Makefile
index 747e048f2..7d8d55374 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -11,7 +11,7 @@
# the GNU General Public License
#
-.PHONY: clean clean-depend all depend uninstall
+.PHONY: clean all uninstall
ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted
UTILS:=$(ALL_UTILS)
@@ -51,11 +51,9 @@ install:
uninstall:
for x in $(ALL_UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
-clean-depend:
- rm -f .depend
-
-clean: clean-depend
+clean:
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 aelparse.c aelbison.c
@@ -122,11 +120,6 @@ streamplayer: streamplayer.o
muted: muted.o
muted: LIBS+=$(AUDIO_LIBS)
-ifneq ($(wildcard .depend),)
- include .depend
+ifneq ($(wildcard .*.d),)
+ include .*.d
endif
-
-depend: .depend
-
-.depend:
- ../build_tools/mkdep $(ASTCFLAGS) `ls *.c`