tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Toolifying nbmake properly?



On Sun, Jan 14, 2018 at 18:22:38 +0300, Valery Ushakov wrote:

> On Tue, Jan 09, 2018 at 16:20:12 +0300, Valery Ushakov wrote:
> 
> > Surprisingly, we don't properly build nbmake as a tool.
> > 
> > $TOOLDIR/bin/nbmake still defaults to host's mk files...
> 
> Actually, turns out we do try to build nbmake with the right
> _PATH_DEFSYSPATH; we just do it wrong and sometimes fail.
> 
> build.sh rebuildmake() calls tools/make/configure with 
> 
>   CPPFLAGS="${HOST_CPPFLAGS} -D_PATH_DEFSYSPATH="'\"'${NETBSDSRCDIR}/share/mk'\"'
> 
> in the environment, but buildmake.sh.in template for the configure
> uses it only as a fallback:
> 
>   : ${HOST_CFLAGS="@CPPFLAGS@ @CFLAGS@"}
> 
> Since I do set HOST_CFLAGS in my build.sh wrapper, -D_PATH_DEFSYSPATH
> is lost.  And since I use that wrapper everywhere, I have no log files
> anywhere where I could see that -D_PATH_DEFSYSPATH.  Thanks to mrg@
> for noticing that -D and wondering out loud about this.

What about the attached patch?

Providing a default for NETBSDSRCDIR in buildmake.sh.in is just a
precaution, as build.sh should always set it.

My change to sets.subr to use explicit -m should probably stay b/c I
think in theory we still support no-tools in-place builds, in which
case we do want host's make to use mk files from the tree.  This is
normally taken care of with MAKEFLAGS, but we unset it there.

kre@ - do you remember the reason for that change to drop it?

-uwe
Index: build.sh
===================================================================
RCS file: /cvsroot/src/build.sh,v
retrieving revision 1.321
diff -u -p -r1.321 build.sh
--- build.sh	8 Oct 2017 01:05:13 -0000	1.321
+++ build.sh	14 Jan 2018 22:59:07 -0000
@@ -1664,7 +1664,7 @@ rebuildmake()
 	${runcmd} env \
 \
 CC="${HOST_CC-cc}" \
-CPPFLAGS="${HOST_CPPFLAGS} -D_PATH_DEFSYSPATH="'\"'${NETBSDSRCDIR}/share/mk'\"' \
+CPPFLAGS="${HOST_CPPFLAGS}" \
 CFLAGS="${HOST_CFLAGS--O}" \
 LDFLAGS="${HOST_LDFLAGS}" \
 \
Index: tools/make/buildmake.sh.in
===================================================================
RCS file: /cvsroot/src/tools/make/buildmake.sh.in,v
retrieving revision 1.8
diff -u -p -r1.8 buildmake.sh.in
--- tools/make/buildmake.sh.in	26 Aug 2006 22:17:48 -0000	1.8
+++ tools/make/buildmake.sh.in	14 Jan 2018 22:59:07 -0000
@@ -4,6 +4,8 @@
 # buildmake.sh.in - Autoconf-processed shell script for building make(1).
 #
 
+: ${NETBSDSRCDIR:=@srcdir@/../..}
+
 : ${HOST_CC="@CC@"}
 : ${HOST_CFLAGS="@CPPFLAGS@ @CFLAGS@"}
 : ${HOST_LDFLAGS="@LDFLAGS@ @LIBS@"}
@@ -14,7 +16,8 @@ docmd () {
 	$1 || exit 1
 }
 
-MKSRCDIR=@srcdir@/../../usr.bin/make
+MKSRCDIR=${NETBSDSRCDIR}/usr.bin/make
+HOST_CFLAGS="${HOST_CFLAGS} -D_PATH_DEFSYSPATH=\"${NETBSDSRCDIR}/share/mk\""
 
 for f in $MKSRCDIR/*.c $MKSRCDIR/lst.lib/*.c; do
 	docmd "${HOST_CC} ${HOST_CFLAGS} @DEFS@ -c $f"


Home | Main Index | Thread Index | Old Index