diff --git a/Makefile.inc1 b/Makefile.inc1 index 4c60536dc413..7d0238f599a8 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -296,6 +296,10 @@ CROSSENV+= MAKEOBJDIRPREFIX=${OBJTREE} \ MACHINE_ARCH=${TARGET_ARCH} \ MACHINE=${TARGET} \ CPUTYPE=${TARGET_CPUTYPE} +.if ${MK_META_MODE} != "no" +# Don't rebuild build-tools targets during normal build. +CROSSENV+= BUILD_TOOLS_META=.NOMETA_CMP +.endif .if ${MK_GROFF} != "no" CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ diff --git a/Makefile.libcompat b/Makefile.libcompat index 2c15a9bbd3cd..560a50c42573 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -88,6 +88,10 @@ LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \ LIBDIR=/usr/lib${libcompat} \ SHLIBDIR=/usr/lib${libcompat} \ DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}" +.if ${MK_META_MODE} != "no" +# Don't rebuild build-tools targets during normal build. +LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA_CMP +.endif LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \ CXX="${XCXX} ${LIBCOMPATCFLAGS} ${LIBCOMPATCXXFLAGS}" \ DESTDIR=${LIBCOMPATTMP} \ diff --git a/bin/csh/Makefile b/bin/csh/Makefile index 2c9ae220db91..f55f24196f30 100644 --- a/bin/csh/Makefile +++ b/bin/csh/Makefile @@ -109,7 +109,7 @@ csh.1: tcsh.man build-tools: gethost -gethost: gethost.c sh.err.h tc.const.h sh.h +gethost: gethost.c sh.err.h tc.const.h sh.h ${BUILD_TOOLS_META} @rm -f ${.TARGET} ${CC} -o gethost ${LDFLAGS} ${CFLAGS:C/-DHAVE_ICONV//} \ ${TCSHDIR}/gethost.c diff --git a/bin/sh/Makefile b/bin/sh/Makefile index 3f28a1231fd3..e6d1d83a887a 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -44,10 +44,10 @@ builtins.c builtins.h: mkbuiltins builtins.def # XXX this is just to stop the default .c rule being used, so that the # intermediate object has a fixed name. # XXX we have a default .c rule, but no default .o rule. -.o: +mknodes.o mksyntax.o: ${BUILD_TOOLS_META} ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} -mknodes: mknodes.o -mksyntax: mksyntax.o +mknodes: mknodes.o ${BUILD_TOOLS_META} +mksyntax: mksyntax.o ${BUILD_TOOLS_META} .ORDER: nodes.c nodes.h nodes.c nodes.h: mknodes nodetypes nodes.c.pat diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index 2add1d3c27b5..6baacc8ac034 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -39,7 +39,7 @@ magic.mgc: mkmagic magic CLEANFILES+= mkmagic build-tools: mkmagic -mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c +mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${BUILD_TOOLS_META} ${CC} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} \ ${LDADD} diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index fc55bfedb875..f5405e867aee 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -389,10 +389,10 @@ keys.list: MKkeys_list.sh Caps # Build tools build-tools: make_hash make_keys -make_keys: make_keys.c names.c ncurses_def.h ${HEADERS} +make_keys: make_keys.c names.c ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META} ${CC} -o $@ ${CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c -make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS} +make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META} ${CC} -o $@ ${CFLAGS} -DMAIN_PROGRAM \ ${NCURSES_DIR}/ncurses/tinfo/make_hash.c diff --git a/share/syscons/scrnmaps/Makefile b/share/syscons/scrnmaps/Makefile index 1c5dc88382a1..1e14e5052738 100644 --- a/share/syscons/scrnmaps/Makefile +++ b/share/syscons/scrnmaps/Makefile @@ -19,7 +19,7 @@ ${SCRMAPS}: ${.TARGET:R}.mk uuencode ${.TARGET:R}.tmp ${.TARGET:R} > ${.TARGET} rm -f ${.TARGET:R}.tmp -${SCRMAPS_MK}: ${.TARGET:R} mkscrfil.c +${SCRMAPS_MK}: ${.TARGET:R} mkscrfil.c ${BUILD_TOOLS_META} ${CC} ${CFLAGS} -I${.CURDIR} -DFIL=\"${.TARGET:R}\" ${LDFLAGS} \ -o ${.TARGET} ${.CURDIR}/mkscrfil.c diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 80ca5dbdb9cd..e2e2758131c1 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -24,6 +24,6 @@ proctab.c: maketab ./maketab > proctab.c build-tools: maketab -maketab: ytab.h ${AWKSRC}/maketab.c +maketab: ytab.h ${AWKSRC}/maketab.c ${BUILD_TOOLS_META} .include diff --git a/usr.bin/mkcsmapper_static/Makefile b/usr.bin/mkcsmapper_static/Makefile index 21014e930b63..a416b20645db 100644 --- a/usr.bin/mkcsmapper_static/Makefile +++ b/usr.bin/mkcsmapper_static/Makefile @@ -13,3 +13,5 @@ build-tools: mkcsmapper_static .include "${.CURDIR}/../mkcsmapper/Makefile.inc" .include + +${PROG}: ${BUILD_TOOLS_META} diff --git a/usr.bin/mkesdb_static/Makefile b/usr.bin/mkesdb_static/Makefile index 2696a23700d5..9ce020920808 100644 --- a/usr.bin/mkesdb_static/Makefile +++ b/usr.bin/mkesdb_static/Makefile @@ -13,3 +13,5 @@ build-tools: mkesdb_static .include "${.CURDIR}/../mkesdb/Makefile.inc" .include + +${PROG}: ${BUILD_TOOLS_META} diff --git a/usr.bin/vi/catalog/Makefile b/usr.bin/vi/catalog/Makefile index e2ca579ba57c..d2c349a13426 100644 --- a/usr.bin/vi/catalog/Makefile +++ b/usr.bin/vi/catalog/Makefile @@ -100,7 +100,7 @@ english.base: dump ${SCAN} #Makefile sort -nu > $@ -dump: dump.c +dump: dump.c ${BUILD_TOOLS_META} ${CC} -o ${.TARGET} ${.ALLSRC} CLEANFILES+= dump ${CAT} english.base *.check __ck1 __ck2