From: Peter Avalos Date: Sun, 15 Jul 2012 07:50:18 +0000 (-0700) Subject: sh: Work with make a little better: X-Git-Tag: v3.2.0~587 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/d4cbceabb29d9260ddd7f3ea00646cc8c8969ba9 sh: Work with make a little better: 1. Avoid a cd back into ${.CURDIR} to run mkbuiltins when we know make will first cd into ${.OBJDIR}. Keep the cwd to what make sets it to. 2. Don't tell mkbuiltins where to write to (= ${.OBJDIR}), but where to get sources from (= ${.CURDIR}). This to compensate for point 1. This fixes a problem with bmake's mk files that optimize ${.OBJDIR} to expand to "." after changing cwd, not taking into account that the target is pretty much undoing that and not getting the full path to the object tree anymore. Obtained-from: FreeBSD 235927 --- diff --git a/bin/sh/Makefile b/bin/sh/Makefile index 21c858a877..88b39ba7f6 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -1,5 +1,5 @@ # @(#)Makefile 8.4 (Berkeley) 5/5/95 -# $FreeBSD: src/bin/sh/Makefile,v 1.56 2011/02/08 23:18:06 jilles Exp $ +# $FreeBSD: src/bin/sh/Makefile,v 1.57 2012/05/24 19:48:15 marcel Exp $ PROG= sh INSTALLFLAGS= -S @@ -40,7 +40,7 @@ build-tools: mkinit.nx mknodes.nx mksyntax.nx .ORDER: builtins.c builtins.h builtins.c builtins.h: mkbuiltins builtins.def - cd ${.CURDIR}; sh mkbuiltins ${.OBJDIR} + sh ${.CURDIR}/mkbuiltins ${.CURDIR} init.c: mkinit.nx alias.c eval.c exec.c input.c jobs.c options.c parser.c \ redir.c trap.c var.c diff --git a/bin/sh/mkbuiltins b/bin/sh/mkbuiltins index c907b07004..d340ad31f3 100644 --- a/bin/sh/mkbuiltins +++ b/bin/sh/mkbuiltins @@ -36,20 +36,20 @@ # SUCH DAMAGE. # # @(#)mkbuiltins 8.2 (Berkeley) 5/4/95 -# $FreeBSD: src/bin/sh/mkbuiltins,v 1.18 2011/06/13 21:03:27 jilles Exp $ +# $FreeBSD: src/bin/sh/mkbuiltins,v 1.19 2012/05/24 19:48:15 marcel Exp $ temp=`/usr/bin/mktemp -t ka` -havejobs=0 -if grep '^#define[ ]*JOBS[ ]*1' shell.h > /dev/null -then havejobs=1 -fi havehist=1 if [ "X$1" = "X-h" ]; then havehist=0 shift fi -objdir=$1 -exec > ${objdir}/builtins.c +srcdir=$1 +havejobs=0 +if grep '^#define[ ]*JOBS[ ]*1' $srcdir/shell.h > /dev/null +then havejobs=1 +fi +exec > builtins.c cat <<\! /* * This file was generated by the mkbuiltins program. @@ -61,7 +61,7 @@ cat <<\! ! awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \ - print $0}' builtins.def | sed 's/-[hj]//' > $temp + print $0}' $srcdir/builtins.def | sed 's/-[hj]//' > $temp echo 'int (*const builtinfunc[])(int, char *[]) = {' awk '/^[^#]/ { printf "\t%s,\n", $1}' $temp echo '}; @@ -78,7 +78,7 @@ awk '{ for (i = 2 ; i <= NF ; i++) { echo ' { NULL, 0, 0 } };' -exec > ${objdir}/builtins.h +exec > builtins.h cat <<\! /* * This file was generated by the mkbuiltins program.