From b051cccb89e92eaa48de260b6a2145a07c6855ad Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" <kpfleming@digium.com> Date: Thu, 19 May 2005 15:20:06 +0000 Subject: [PATCH] more Makefile tweaks ensure mkdep can handle creating rules for files that are using double-colon rules git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5738 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- Makefile | 41 +++++++++++++++++++++-------------------- mkdep | 17 +++++++++++++---- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 5777b59917..c959baf2bb 100755 --- a/Makefile +++ b/Makefile @@ -342,7 +342,6 @@ ast_expr: vercomp ifeq ($(MAKECMDGOALS),ast_expr.a) FLEXVER_GT_2_5_31=$(shell ./vercomp flex \>= 2.5.31) -BISONVER=$(shell bison --version | grep \^bison | sed 's/.* \([0-9]\+\.[-0-9.]\+[a-z]\?\)/\1/' ) BISONVER_GE_1_85=$(shell ./vercomp bison \>= 1.85 ) endif @@ -352,36 +351,37 @@ else FLEXOBJS=ast_expr.o endif -ast_expr.a: $(FLEXOBJS) - @rm -f $@ - ar r $@ $(FLEXOBJS) - ranlib $@ +ast_expr.o:: ast_expr.c + @echo "=================================================================================" + @echo "NOTE: Using older version of expression parser. To use the newer version," + @echo "NOTE: upgrade to flex 2.5.31 or higher, which can be found at" + @echo "NOTE: http://sourceforge.net/project/showfiles.php?group_id=72099" + @echo "=================================================================================" + +ast_expr.o:: ast_expr.c ifeq ($(BISONVER_GE_1_85),false) .y.c: - @echo "=================================================================================" ;\ - echo "NOTE: You may have trouble if you do not have bison-1.85 or higher installed!" ;\ - echo "NOTE: You can pick up a copy at: http://ftp.gnu.org/ or its mirrors" ;\ - echo "NOTE: You have: $(BISONVER)" ;\ - echo "================================================================================" ;\ + @echo "=================================================================================" + @echo "NOTE: You may have trouble if you do not have bison-1.85 or higher installed!" + @echo "NOTE: You can pick up a copy at: http://ftp.gnu.org or its mirrors" + @echo "NOTE: You have:" + @bison --version + @echo "================================================================================" bison -v -d --name-prefix=ast_yy $< -o $@ else .y.c: bison -v -d --name-prefix=ast_yy $< -o $@ endif -ast_expr.o:: ast_expr.c - @echo "=================================================================================" ;\ - echo "NOTE: Using older version of expression parser. To use the newer version," ;\ - echo "NOTE: upgrade to flex 2.5.31 or higher, which can be found at" ;\ - echo "NOTE: http://sourceforge.net/project/showfiles.php?group_id=72099" ;\ - echo "=================================================================================" ;\ - -ast_expr.o:: ast_expr.c - ast_expr2f.c: ast_expr2.fl flex ast_expr2.fl +ast_expr.a: $(FLEXOBJS) + @rm -f $@ + ar r $@ $(FLEXOBJS) + ranlib $@ + cli.o: cli.c build.h asterisk.o: asterisk.c build.h @@ -762,7 +762,8 @@ depend: .depend for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done .depend: - ./mkdep ${CFLAGS} `ls *.c` + ./mkdep ${CFLAGS} $(filter-out ast_expr.c,$(wildcard *.c)) + ./mkdep -a -d ${CFLAGS} ast_expr.c .tags-depend: @echo -n ".tags-depend: " > $@ diff --git a/mkdep b/mkdep index 9d15f1e758..84f969b1d6 100755 --- a/mkdep +++ b/mkdep @@ -40,6 +40,7 @@ D=.depend # default dependency file is .depend append=0 pflag= +dflag= while : do case "$1" in @@ -58,13 +59,19 @@ while : -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] [-f depend_file] [cc_flags] file ...' + echo 'usage: mkdep [-p] [-d] [-f depend_file] [cc_flags] file ...' exit 1 fi @@ -82,10 +89,12 @@ fi umask $um trap 'rm -rf $DTMP ; trap 2 ; kill -2 $$' 1 2 3 13 15 -if [ x$pflag = x ]; then - ${CC:-cc} -M "$@" 2>/dev/null | sed -e 's; \./; ;g' > $TMP -else +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 -- GitLab