CVS commit: src/tools/host-mkdep
Module Name:src Committed By: dholland Date: Sun Jan 27 05:16:10 UTC 2019 Modified Files: src/tools/host-mkdep: Makefile Log Message: fix duplicated chunk from merge To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tools/host-mkdep/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/Makefile diff -u src/tools/host-mkdep/Makefile:1.14 src/tools/host-mkdep/Makefile:1.15 --- src/tools/host-mkdep/Makefile:1.14 Sun Jan 27 02:08:50 2019 +++ src/tools/host-mkdep/Makefile Sun Jan 27 05:16:10 2019 @@ -1,6 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2019/01/27 02:08:50 pgoyette Exp $ - -.include +# $NetBSD: Makefile,v 1.15 2019/01/27 05:16:10 dholland Exp $ .include
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Tue May 12 00:04:34 UTC 2015 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Like the non-host mkdep don't print ./foo.h as a dependency, but simplify it to foo.h. This was causing problems with: .y.h: ${.TARGET:.h=.c} where .h was ./cgram.h and the source became ./cgram.c confusing for example /usr/src/tools/lint1 because make had both cgram.c and ./cgram.c in the list of sources, trying to build both of them in parallel thinking that they were different files. Since the regular mkdep does not produce such dependencies, the regular build does not suffer from this issue. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.30 src/tools/host-mkdep/host-mkdep.in:1.31 --- src/tools/host-mkdep/host-mkdep.in:1.30 Mon Sep 2 04:37:11 2013 +++ src/tools/host-mkdep/host-mkdep.in Mon May 11 20:04:34 2015 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.30 2013/09/02 08:37:11 joerg Exp $ +# $NetBSD: host-mkdep.in,v 1.31 2015/05/12 00:04:34 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -243,6 +243,7 @@ else sub(/^#(pragma).*/, "") sub(/^<.*/, "") sub(/\".*$/, "") +sub(/^\.\//, "") sub(/ [ 0-9]*$/, "") if ($0 in seenfiles) next
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: joerg Date: Mon Sep 2 08:37:12 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Preserve -std=* options as they may change the dependency list. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.29 src/tools/host-mkdep/host-mkdep.in:1.30 --- src/tools/host-mkdep/host-mkdep.in:1.29 Wed Mar 27 01:03:39 2013 +++ src/tools/host-mkdep/host-mkdep.in Mon Sep 2 08:37:11 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.29 2013/03/27 01:03:39 uwe Exp $ +# $NetBSD: host-mkdep.in,v 1.30 2013/09/02 08:37:11 joerg Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -162,6 +162,11 @@ else shift 2 cppargs=${cppargs%xx} ;; + -std=*) +set -- "$@" "$1" +shift +cppargs=${cppargs%x} +;; -no-cpp-precomp) # This is a Darwin-specific option. set -- "$@" "$1"
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: uwe Date: Wed Mar 27 01:03:40 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Some shells have ((expr)) syntax for arithmetic. Add space between parens of nested (compound-list)s to unconfuse them. Fixes PR toolchain/47695 To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.28 src/tools/host-mkdep/host-mkdep.in:1.29 --- src/tools/host-mkdep/host-mkdep.in:1.28 Sat Mar 16 02:51:56 2013 +++ src/tools/host-mkdep/host-mkdep.in Wed Mar 27 01:03:39 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.28 2013/03/16 02:51:56 christos Exp $ +# $NetBSD: host-mkdep.in,v 1.29 2013/03/27 01:03:39 uwe Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -231,7 +231,7 @@ else file=${file%.*} set_objlist $file - ((@CPP@ "$@" $f; echo $? >&3) | @AWK@ ' + ( (@CPP@ "$@" $f; echo $? >&3) | @AWK@ ' /^#/ { # Be as tolerant as possible. sub(/^#(line)? [ 0-9]*\"?/, "")
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Sat Mar 16 02:51:56 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Put back error checking in a simpler form thanks to uwe To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.27 src/tools/host-mkdep/host-mkdep.in:1.28 --- src/tools/host-mkdep/host-mkdep.in:1.27 Thu Mar 14 10:55:35 2013 +++ src/tools/host-mkdep/host-mkdep.in Fri Mar 15 22:51:56 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.27 2013/03/14 14:55:35 joerg Exp $ +# $NetBSD: host-mkdep.in,v 1.28 2013/03/16 02:51:56 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -231,7 +231,7 @@ else file=${file%.*} set_objlist $file - @CPP@ "$@" $f | @AWK@ ' + ((@CPP@ "$@" $f; echo $? >&3) | @AWK@ ' /^#/ { # Be as tolerant as possible. sub(/^#(line)? [ 0-9]*\"?/, "") @@ -247,7 +247,7 @@ else print "'"$objlist"'" ": " $0 '"$AWK_OPTIONAL"' } - ' >> $TMP + ' >> $TMP) 3>&1 | (read a; exit $a) done fi
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: joerg Date: Thu Mar 14 14:55:36 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Revert 1.25 and 1.26: Breaks build on !NetBSD To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.26 src/tools/host-mkdep/host-mkdep.in:1.27 --- src/tools/host-mkdep/host-mkdep.in:1.26 Tue Mar 12 01:55:33 2013 +++ src/tools/host-mkdep/host-mkdep.in Thu Mar 14 14:55:35 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.26 2013/03/12 01:55:33 christos Exp $ +# $NetBSD: host-mkdep.in,v 1.27 2013/03/14 14:55:35 joerg Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -69,12 +69,6 @@ set_objlist() fi } -# Send the command output to 4, and a command to set the exit code to 5 -run_cmd() { - "$@" 1>&4 4>&- - echo rv=$? 1>&5 5>&- -} - # A getopt compatible command line parser in shell comands. # (don't trust the shell builtin getopts to be in a known state on error) while [ $# -gt 0 ]; do @@ -232,13 +226,12 @@ if $MERGE; then done <$f done >$TMP else - exec 5>&1 for f in $SRCS; do file=${f##*/} file=${file%.*} set_objlist $file - eval $( (run_cmd @CPP@ "$@" $f 4>&1 | @AWK@ ' + @CPP@ "$@" $f | @AWK@ ' /^#/ { # Be as tolerant as possible. sub(/^#(line)? [ 0-9]*\"?/, "") @@ -254,11 +247,7 @@ else print "'"$objlist"'" ": " $0 '"$AWK_OPTIONAL"' } - ' >> $TMP) 5>&1) - case "$rv" in - 0);; - *) exit $rv;; - esac + ' >> $TMP done fi
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Tue Mar 12 01:55:33 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: re-directing once is good enough. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.25 src/tools/host-mkdep/host-mkdep.in:1.26 --- src/tools/host-mkdep/host-mkdep.in:1.25 Mon Mar 11 21:52:20 2013 +++ src/tools/host-mkdep/host-mkdep.in Mon Mar 11 21:55:33 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.25 2013/03/12 01:52:20 christos Exp $ +# $NetBSD: host-mkdep.in,v 1.26 2013/03/12 01:55:33 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -70,7 +70,6 @@ set_objlist() } # Send the command output to 4, and a command to set the exit code to 5 -exec 5>&1 run_cmd() { "$@" 1>&4 4>&- echo rv=$? 1>&5 5>&-
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Tue Mar 12 01:52:20 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Perform shell fd gymnastics to capture the error in the pipeline and exit. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.24 src/tools/host-mkdep/host-mkdep.in:1.25 --- src/tools/host-mkdep/host-mkdep.in:1.24 Mon Mar 4 22:06:21 2013 +++ src/tools/host-mkdep/host-mkdep.in Mon Mar 11 21:52:20 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.24 2013/03/05 03:06:21 christos Exp $ +# $NetBSD: host-mkdep.in,v 1.25 2013/03/12 01:52:20 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -69,6 +69,13 @@ set_objlist() fi } +# Send the command output to 4, and a command to set the exit code to 5 +exec 5>&1 +run_cmd() { + "$@" 1>&4 4>&- + echo rv=$? 1>&5 5>&- +} + # A getopt compatible command line parser in shell comands. # (don't trust the shell builtin getopts to be in a known state on error) while [ $# -gt 0 ]; do @@ -226,12 +233,13 @@ if $MERGE; then done <$f done >$TMP else + exec 5>&1 for f in $SRCS; do file=${f##*/} file=${file%.*} set_objlist $file - @CPP@ "$@" $f | @AWK@ ' + eval $( (run_cmd @CPP@ "$@" $f 4>&1 | @AWK@ ' /^#/ { # Be as tolerant as possible. sub(/^#(line)? [ 0-9]*\"?/, "") @@ -247,7 +255,11 @@ else print "'"$objlist"'" ": " $0 '"$AWK_OPTIONAL"' } - ' >> $TMP + ' >> $TMP) 5>&1) + case "$rv" in + 0);; + *) exit $rv;; + esac done fi
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Tue Mar 5 03:06:21 UTC 2013 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: account for -vi To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.23 src/tools/host-mkdep/host-mkdep.in:1.24 --- src/tools/host-mkdep/host-mkdep.in:1.23 Sun Dec 9 18:53:39 2012 +++ src/tools/host-mkdep/host-mkdep.in Mon Mar 4 22:06:21 2013 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.23 2012/12/09 23:53:39 christos Exp $ +# $NetBSD: host-mkdep.in,v 1.24 2013/03/05 03:06:21 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -84,6 +84,7 @@ while [ $# -gt 0 ]; do -o) OPTIONAL=true; AWK_OPTIONAL='print ".OPTIONAL:" $0';; -p) NEWEXT=;; -q) QUIET=true;; + -[iv]) ;; -[fPs]) # Options with arguments [ -z "$optarg" ] && { @@ -180,7 +181,9 @@ else --sysroot*) shift ;; - + -[iv]) +shift +;; -*) echo "$0: Unknown option: $1" 1>&2 # all other -options exit 1
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Sun Dec 9 23:53:39 UTC 2012 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: forgetting to shift turns this into a cpu burner. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.22 src/tools/host-mkdep/host-mkdep.in:1.23 --- src/tools/host-mkdep/host-mkdep.in:1.22 Sun Dec 9 18:42:16 2012 +++ src/tools/host-mkdep/host-mkdep.in Sun Dec 9 18:53:39 2012 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.22 2012/12/09 23:42:16 christos Exp $ +# $NetBSD: host-mkdep.in,v 1.23 2012/12/09 23:53:39 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -178,6 +178,7 @@ else cppargs=${cppargs%x} ;; --sysroot*) +shift ;; -*)
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Sun Dec 9 23:42:16 UTC 2012 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: ignore --sysroot=/ To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.21 src/tools/host-mkdep/host-mkdep.in:1.22 --- src/tools/host-mkdep/host-mkdep.in:1.21 Sun Aug 26 18:37:19 2012 +++ src/tools/host-mkdep/host-mkdep.in Sun Dec 9 18:42:16 2012 @@ -1,6 +1,6 @@ #!@BSHELL@ - # -# $NetBSD: host-mkdep.in,v 1.21 2012/08/26 22:37:19 jmmv Exp $ +# $NetBSD: host-mkdep.in,v 1.22 2012/12/09 23:42:16 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -177,6 +177,8 @@ else shift cppargs=${cppargs%x} ;; + --sysroot*) +;; -*) echo "$0: Unknown option: $1" 1>&2 # all other -options
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: apb Date: Sun Dec 2 12:44:07 UTC 2012 Modified Files: src/tools/host-mkdep: Makefile Log Message: Now that tools/Makefile builds tools/binstall before installing tools/host-mkdep, we can use the newly-built install program to install host-mkdep. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tools/host-mkdep/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/Makefile diff -u src/tools/host-mkdep/Makefile:1.11 src/tools/host-mkdep/Makefile:1.12 --- src/tools/host-mkdep/Makefile:1.11 Sun Dec 2 12:21:51 2012 +++ src/tools/host-mkdep/Makefile Sun Dec 2 12:44:06 2012 @@ -1,6 +1,11 @@ -# $NetBSD: Makefile,v 1.11 2012/12/02 12:21:51 apb Exp $ +# $NetBSD: Makefile,v 1.12 2012/12/02 12:44:06 apb Exp $ -TIMESTAMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep +HOSTPROG= host-mkdep +HOSTPROGNAME= ${_TOOL_PREFIX}host-mkdep +HOST_BINDIR= ${TOOLDIR}/bin + +NOMAN= # defined +SRCS= # empty CLEANFILES+= config.cache config.log config.status host-mkdep @@ -20,12 +25,24 @@ host-mkdep: configure host-mkdep.in ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache chmod +x $@ -# This is the only program that comes before binstall. -install: ${TIMESTAMP} -${TIMESTAMP}: host-mkdep - mkdir -p ${TOOLDIR}/bin - cp host-mkdep $@ - chmod +x $@ +# Use uninstalled copy of the install program +INSTALL_OBJ!= cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR} +INSTALL= ${INSTALL_OBJ}/xinstall + +# Install rule, copied from src/tools/Makefile.host. +# We can't include Makefile.host because there is no HOST_SRCDIR +# corresponding to host-mkdep. +# +realinstall: install.host +install.host: ${HOST_BINDIR}/${HOSTPROGNAME} +${HOST_BINDIR}/${HOSTPROGNAME}:: ${HOSTPROG} + ${_MKTARGET_INSTALL} + mkdir -p ${HOST_BINDIR} + ${HOST_INSTALL_FILE} -m ${BINMODE} ${HOSTPROG}${HOSTEXEEXT} ${.TARGET} + +.if ${MKUPDATE} == "no" +.PHONY: ${HOST_BINDIR}/${HOSTPROGNAME} +.endif # Run by hand, then "configure" script committed: regen:
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: apb Date: Sun Dec 2 12:21:51 UTC 2012 Modified Files: src/tools/host-mkdep: Makefile Log Message: Use a CONFIGURE_ENV variable instead of in-line code for passing environment variables to the confifure script for host-mkdep. Also reword the comment about why TOOL_AWK can't be included. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tools/host-mkdep/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/Makefile diff -u src/tools/host-mkdep/Makefile:1.10 src/tools/host-mkdep/Makefile:1.11 --- src/tools/host-mkdep/Makefile:1.10 Sun Oct 19 22:05:23 2008 +++ src/tools/host-mkdep/Makefile Sun Dec 2 12:21:51 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2008/10/19 22:05:23 apb Exp $ +# $NetBSD: Makefile,v 1.11 2012/12/02 12:21:51 apb Exp $ TIMESTAMP= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep @@ -6,14 +6,18 @@ CLEANFILES+= config.cache config.log con .include -# When host-mkdep is built, TOOL_AWK is not yet available, so we do not -# pass AWK=${TOOL_AWK:Q} to configure; we allow configure to find awk -# for itself (or complain if it can't find awk). +# XXX: The configure script needs to use awk, but we can't pass +# AWK=${TOOL_AWK:Q} in CONFIGURE_ENV, because TOOL_AWK is not yet +# available at the time that host-mkdep is built. The configure script +# will try to find some other version of awk. +# +CONFIGURE_ENV= CC=${HOST_CC:Q} realall: host-mkdep host-mkdep: configure host-mkdep.in -rm -f $@ - CC=${HOST_CC:Q} ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache + ${CONFIGURE_ENV} \ + ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache chmod +x $@ # This is the only program that comes before binstall.
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: christos Date: Sun Nov 14 15:18:24 UTC 2010 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: recognize isysroot To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.18 src/tools/host-mkdep/host-mkdep.in:1.19 --- src/tools/host-mkdep/host-mkdep.in:1.18 Sat Feb 20 10:04:03 2010 +++ src/tools/host-mkdep/host-mkdep.in Sun Nov 14 10:18:24 2010 @@ -1,6 +1,6 @@ #...@bshell@ - # -# $NetBSD: host-mkdep.in,v 1.18 2010/02/20 15:04:03 joerg Exp $ +# $NetBSD: host-mkdep.in,v 1.19 2010/11/14 15:18:24 christos Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -148,7 +148,7 @@ cppargs=${cppargs%x} ;; - -[IDU]|-include|-isystem) + -[IDU]|-include|-isystem|-isysroot) set -- "$@" "$1" "$2" shift 2 cppargs=${cppargs%xx}
CVS commit: src/tools/host-mkdep
Module Name:src Committed By: joerg Date: Sat Feb 20 15:04:04 UTC 2010 Modified Files: src/tools/host-mkdep: host-mkdep.in Log Message: Rewrite argument processing to deal with spaces and other meta characters in options. This was exposed by the "NetBSD 5.99" argument of mandoc. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tools/host-mkdep/host-mkdep.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/host-mkdep/host-mkdep.in diff -u src/tools/host-mkdep/host-mkdep.in:1.17 src/tools/host-mkdep/host-mkdep.in:1.18 --- src/tools/host-mkdep/host-mkdep.in:1.17 Mon Jul 9 15:27:10 2007 +++ src/tools/host-mkdep/host-mkdep.in Sat Feb 20 15:04:03 2010 @@ -1,6 +1,6 @@ #...@bshell@ - # -# $NetBSD: host-mkdep.in,v 1.17 2007/07/09 15:27:10 jmmv Exp $ +# $NetBSD: host-mkdep.in,v 1.18 2010/02/20 15:04:03 joerg Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -117,43 +117,63 @@ if $MERGE; then SRCS="$*" else - while [ $# -gt 0 ]; do + # + # Process argument list. + # This is tricky, because arguments may contain spaces and other + # escapes characters. The argument list is used like a tail queue. + # $cppargs has one x for each unprocessed argument, so when an + # argument is processed, it is shifted and the corresponding number + # of x's is removed. The advantage to counting is that suffix removal + # works without fork. + # + cppargs= + for arg; do + cppargs="x$cppargs" + done + while [ -n "$cppargs" ]; do case "$1" in -L) # takes an arg, but ignored shift 2 +cppargs=${cppargs%xx} ;; -c|-[lLMOW]*) # takes no extra args shift +cppargs=${cppargs%x} ;; -[IDU]*) -CPPFLAGS="$CPPFLAGS $1" +set -- "$@" "$1" shift +cppargs=${cppargs%x} ;; -[IDU]|-include|-isystem) -CPPFLAGS="$CPPFLAGS $1 $2" +set -- "$@" "$1" "$2" shift 2 +cppargs=${cppargs%xx} ;; -isystem-cxx|-cxx-isystem) -CPPFLAGS="$CPPFLAGS -isystem $2" +set -- "$@" "-isystem" "$2" shift 2 +cppargs=${cppargs%xx} ;; -no-cpp-precomp) # This is a Darwin-specific option. -CPPFLAGS="$CPPFLAGS $1" +set -- "$@" "$1" shift +cppargs=${cppargs%x} ;; -nostdinc*) # This is a gcc/g++ ism; ignore if not gcc/g++ case "@CFLAGS@" in *-O2*) # Autoconf puts -O2 when gcc only - CPPFLAGS="$CPPFLAGS $1" + set -- "$@" "$1" ;; esac shift +cppargs=${cppargs%x} ;; -*) @@ -164,6 +184,7 @@ *) SRCS="$SRCS $1" # source file shift +cppargs=${cppargs%x} ;; esac done @@ -202,7 +223,7 @@ file=${file%.*} set_objlist $file - @CPP@ $CPPFLAGS $f | @AWK@ ' + @CPP@ "$@" $f | @AWK@ ' /^#/ { # Be as tolerant as possible. sub(/^#(line)? [ 0-9]*\"?/, "")