tech-toolchain archive

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

Re: Toolifying nbmake properly?



On Tue, Jan 09, 2018 at 16:20:12 +0300, Valery Ushakov wrote:

> distrib/sets/sets.subr has arch_to_cpu() function that uses make to
> get MACHINE_CPU.  Slighly reformatted for clarity:
> 
>     MAKEFLAGS= MAKEVERBOSE= MACHINE_ARCH=${1} \
>     ${MAKE} -B -f- all <<EOMAKE
> .include <bsd.own.mk>
> all:
> 	@echo \${MACHINE_CPU}
> EOMAKE

How about attached patch that adds the appropriate -m?  

The old code probably predates make -V, so I've also changed the code
to use it.

-uwe
Index: sets.subr
===================================================================
RCS file: /cvsroot/src/distrib/sets/sets.subr,v
retrieving revision 1.181
diff -u -p -u -p -r1.181 sets.subr
--- sets.subr	22 Nov 2017 23:14:01 -0000	1.181
+++ sets.subr	9 Jan 2018 22:47:29 -0000
@@ -605,11 +605,10 @@ print_set_lists()
 #
 arch_to_cpu()
 {
-	MAKEFLAGS= MAKEVERBOSE= MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE
-.include <bsd.own.mk>
-all:
-	@echo \${MACHINE_CPU}
-EOMAKE
+	MACHINE_ARCH=${1} MAKEFLAGS= \
+	${MAKE} -m ${NETBSDSRCDIR}/share/mk \
+		-f ${NETBSDSRCDIR}/share/mk/bsd.own.mk \
+		-V '${MACHINE_CPU}'
 }
 
 # arch_to_endian mach
@@ -619,11 +618,10 @@ EOMAKE
 #
 arch_to_endian()
 {
-	MAKEFLAGS= MAKEVERBOSE= MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE
-.include <bsd.endian.mk>
-all:
-	@echo \${TARGET_ENDIANNESS}
-EOMAKE
+	MACHINE_ARCH=${1} MAKEFLAGS= \
+	${MAKE} -m ${NETBSDSRCDIR}/share/mk \
+		-f ${NETBSDSRCDIR}/share/mk/bsd.endian.mk \
+		-V '${TARGET_ENDIANNESS}'
 }
 
 #####


Home | Main Index | Thread Index | Old Index