Browse files

Replace legacy make with bmake

The proper way to detect which make is building the makefile is to check
for .PARSEDIR.  If present, bmake is processing the makefile.  For the
time being, both make will be supported for bootstrapping purposes, but
in time the check can be removed, say for the DragonFly 3.6 release.

The abundance of .ORDER commands in bsd.dep.mk caused a breakage when
building world in parallel with bmake.  Likely some order constraints
were impossible to achieve, and bmake just stopped while legacy did the
best it could.  In any case, the majority of the .ORDER commands were
replaced by a single .ORDER command which solved the problem.

The legacy make is disconnected in this commit set, but the source files
will be removed soon.
  • Loading branch information...
1 parent b3badcb commit 3da8e88fd44bdb1ff2af162b8fecd7c65d5e533b @jrmarino jrmarino committed Oct 28, 2012
View
6 Makefile
@@ -154,9 +154,15 @@ kernel: buildkernel installkernel
test:
.if defined(notdef)
.undef notdef
+.if defined(.PARSEDIR)
+.if defined(notdef) && ${notdef:tu}
+.endif
+.else
+# LEGACY MAKE - REMOVE FOR DFLY 3.6
.if defined(notdef) && ${notdef:U}
.endif
.endif
+.endif
#
# Upgrade the installed make to the current version using the installed
View
81 Makefile.inc1
@@ -126,8 +126,13 @@ WORLD_BINUTILSVER?= binutils222
# temporary until everybody has converted to x86_64
.if ${MACHINE_ARCH} == "amd64"
MACHINE_ARCH= x86_64
+.if defined(.PARSEDIR)
+.export MACHINE_ARCH
+.else
+# LEGACY MAKE - REMOVE FOR DFLY 3.6
.makeenv MACHINE_ARCH
.endif
+.endif
TARGET_ARCH?= ${MACHINE_ARCH}
.if ${TARGET_ARCH} == ${MACHINE_ARCH}
@@ -211,6 +216,11 @@ STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${
TMPDIR?= /tmp
TMPPID!= echo $$$$
+# Only use the host system make to bootstrap tools, including make itself
+# Use the bootstrap make for the rest of the world
+BTOOLMAKE= ${BTOOLSDEST}/usr/bin/make
+BTOOLCONFIG= ${BTOOLSDEST}/usr/sbin/config
+
#
# Building a world goes through the following stages
#
@@ -296,13 +306,13 @@ WMAKEENV= ${CROSSENV} \
INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${STRICTTMPPATH}
-WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1
+WMAKE= ${WMAKEENV} ${BTOOLMAKE} -f Makefile.inc1
# install stage
#
IMAKEENV= ${CROSSENV} \
PATH=${STRICTTMPPATH}
-IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
+IMAKE= ${IMAKEENV} ${BTOOLMAKE} -f Makefile.inc1
# kernel stage
#
@@ -435,14 +445,14 @@ crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools
#
installcheck:
.if !defined(NO_SENDMAIL)
- @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
- @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1)
+ @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
+ @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
.endif
- @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
- @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1)
- @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1)
+ @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
+ @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
+ @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false)
.if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/"
- @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; exit 1;; esac
+ @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; /usr/bin/false ; esac
.endif
#
# installworld
@@ -539,7 +549,7 @@ bk_tools:
echo "You must buildworld before buildkernel. If you wish"; \
echo "to build a kernel using native tools, config it manually"; \
echo "or use the nativekernel target if you are in a rush"; \
- exit 1; \
+ /usr/bin/false; \
fi
maybe_bk_tools:
@@ -548,7 +558,7 @@ maybe_bk_tools:
if [ ! -f ${WORLDDEST}/.libraries_done ]; then \
echo "The kernel was build using buildworld tools which no" ; \
echo "longer appear to exist, quickkernel failed!" ; \
- exit 1; \
+ /usr/bin/false; \
fi; \
fi
.endfor
@@ -590,7 +600,7 @@ buildkernel: bk_tools bk_build_list bk_kernwarn
.if !defined(NO_KERNELCONFIG)
cd ${KRNLCONFDIR}; \
PATH=${STRICTTMPPATH} \
- config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
+ ${BTOOLCONFIG} ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
${KERNCONFDIR}/${_kernel}
.endif
.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel})
@@ -599,10 +609,10 @@ buildkernel: bk_tools bk_build_list bk_kernwarn
touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run
.if !defined(NO_KERNELDEPEND)
cd ${KRNLOBJDIR}/${_kernel}; \
- ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
+ ${KMAKEENV} ${BTOOLMAKE} KERNEL=${INSTKERNNAME} depend
.endif
cd ${KRNLOBJDIR}/${_kernel}; \
- ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
+ ${KMAKEENV} ${BTOOLMAKE} KERNEL=${INSTKERNNAME} all
@echo "--------------------------------------------------------------"
@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
@echo "--------------------------------------------------------------"
@@ -666,11 +676,11 @@ quickkernel: maybe_bk_tools bk_build_list bk_kernwarn
.if !defined(NO_KERNELCONFIG)
cd ${KRNLCONFDIR}; \
PATH=${STRICTTMPPATH} \
- config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
+ ${BTOOLCONFIG} ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
${KERNCONFDIR}/${_kernel}
.endif
cd ${KRNLOBJDIR}/${_kernel}; \
- ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
+ ${KMAKEENV} ${BTOOLMAKE} KERNEL=${INSTKERNNAME} all
.else
.if !defined(NO_KERNELCONFIG)
cd ${KRNLCONFDIR}; \
@@ -696,7 +706,7 @@ installkernel reinstallkernel:
@echo "--------------------------------------------------------------"
.if exists(${KRNLOBJDIR}/${INSTALLKERNEL}/.buildkernel_run)
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
- ${IMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
+ ${IMAKEENV} ${BTOOLMAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
.else
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
@@ -762,7 +772,7 @@ BSTRAPDIRS= ${_strfile} \
bin/test bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \
bin/hostname bin/kill \
usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \
- usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \
+ usr.bin/m4 usr.bin/rpcgen usr.bin/bmake usr.bin/awk usr.bin/stat \
usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \
usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \
usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \
@@ -880,15 +890,15 @@ libraries:
.if !defined(NO_GCC47)
cd ${.CURDIR}; \
HOST_CCVER=${HOST_CCVER} CCVER=gcc47 \
- ${MAKE} -f Makefile.inc1 _startup_libs47;
+ ${BTOOLMAKE} -f Makefile.inc1 _startup_libs47;
.endif
cd ${.CURDIR}; \
HOST_CCVER=${HOST_CCVER} CCVER=gcc44 \
- ${MAKE} -f Makefile.inc1 _startup_libs44;
+ ${BTOOLMAKE} -f Makefile.inc1 _startup_libs44;
cd ${.CURDIR}; \
- ${MAKE} -f Makefile.inc1 _startup_libs; \
- ${MAKE} -f Makefile.inc1 _prebuild_libs; \
- ${MAKE} -f Makefile.inc1 _generic_libs;
+ ${BTOOLMAKE} -f Makefile.inc1 _startup_libs; \
+ ${BTOOLMAKE} -f Makefile.inc1 _prebuild_libs; \
+ ${BTOOLMAKE} -f Makefile.inc1 _generic_libs;
touch ${WORLDDEST}/.libraries_done
# These dependencies are not automatically generated:
@@ -976,7 +986,7 @@ ${entry}.${__target}__D: .PHONY
edir=${entry}; \
cd ${.CURDIR}/$${edir}; \
fi; \
- ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
+ ${BTOOLMAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
.endfor
par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
.ORDER: ${SUBDIR:S/$/.${__target}__D/}
@@ -987,27 +997,44 @@ par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
# world build environment.
#
wmake:
- @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}'
+ @echo '${WMAKEENV} ${BTOOLMAKE} ${WMAKE_ARGS}'
wmakeenv:
@echo '${WMAKEENV} /bin/sh'
bmake:
- @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}'
+ @echo '${BMAKEENV} ${BTOOLMAKE} ${BMAKE_ARGS}'
bmakeenv:
@echo '${BMAKEENV} /bin/sh'
tmake:
- @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}'
+ @echo '${TMAKEENV} ${BTOOLMAKE} ${TMAKE_ARGS}'
tmakeenv:
@echo '${TMAKEENV} /bin/sh'
xmake:
- @echo '${XMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${XMAKE_ARGS}'
+ @echo '${XMAKEENV} ${BTOOLMAKE} ${XMAKE_ARGS}'
xmakeenv:
@echo '${XMAKEENV} /bin/sh'
+# Take advantage of bmake error response
+#
+MAKE_PRINT_VAR_ON_ERROR= \
+ .CURDIR \
+ .OBJDIR \
+ .MAKE \
+ MAKE_VERSION \
+ LD_LIBRARY_PATH \
+ MACHINE_ARCH \
+ MACHINE \
+ MAKEFILE \
+ .TARGETS \
+ .ERROR_TARGET \
+ .ERROR_META_FILE \
+ .MAKE.LEVEL \
+ .MAKE.MODE
+
.include <bsd.subdir.mk>
View
7 lib/i18n_module/Makefile.inc
@@ -1,13 +1,16 @@
-# $DragonFly: src/lib/i18n_module/Makefile.inc,v 1.3 2008/04/10 10:21:00 hasso Exp $
-
NOPROFILE= 1
.include "../Makefile.shlib"
SHLIB_MAJOR= ${MODULE_SHLIB_MAJOR}
BASENAME= ${.CURDIR:T}
LIB= ${BASENAME}
+.if defined(.PARSEDIR)
+SRCS?= ${SRCPRE:tl}${BASENAME:tl}.c
+.else
+# LEGACY MAKE - REMOVE FOR DFLY 3.6
SRCS?= ${SRCPRE:L}${BASENAME:L}.c
+.endif
TARGET_LIBDIR= /usr/lib/i18n
TARGET_SHLIBDIR= /usr/lib/i18n
View
8 lib/libc/citrus/Makefile.inc
@@ -23,10 +23,18 @@ SRCS+= citrus_prop.c
.PATH: ${.CURDIR}/../libc/citrus/modules
CFLAGS+=-I${.CURDIR}/../libc/citrus
CFLAGS+=-D_I18N_STATIC
+.if defined(.PARSEDIR)
+.for var in ${STATIC_LOCALES}
+SRCS+= citrus_${var:tl}.c
+CFLAGS+=-D_I18N_STATIC_${var}
+.endfor
+.else
+# LEGACY MAKE - REMOVE FOR DFLY 3.6
.for var in ${STATIC_LOCALES}
SRCS+= citrus_${var:L}.c
CFLAGS+=-D_I18N_STATIC_${var}
.endfor
+.endif
# iconv support
SRCS+=citrus_iconv_std.c citrus_mapper_std.c citrus_mapper_none.c citrus_mapper_serial.c citrus_utf1632.c
.endif # STATIC_LOCALES
View
9 nrelease/Makefile
@@ -24,8 +24,13 @@ MAKE_JOBS?= $$(sysctl -n hw.ncpu)
# temporary until everybody has converted to x86_64
.if ${MACHINE_ARCH} == "amd64"
MACHINE_ARCH= x86_64
+.if defined(.PARSEDIR)
+.export MACHINE_ARCH
+.else
+# LEGACY MAKE - REMOVE FOR DFLY 3.6
.makeenv MACHINE_ARCH
.endif
+.endif
# XXX makeshift fix to build the right kernel for the (target) architecture
# We should configure this in the platform files somehow
@@ -209,10 +214,10 @@ check:
@echo "in /usr if you are unfamiliar with pkgsrc."
.endif
.if !exists (${PKGBIN_MKISOFS})
- @exit 1
+ @/usr/bin/false
.endif
.if !defined(PKGSRC_PATH)
- @exit 1
+ @/usr/bin/false
.endif
buildworld1 buildworld2:
View
6 share/mk/bsd.cpu.mk
@@ -52,8 +52,14 @@ CPUTYPE= ${FORCE_CPUTYPE}
# cross compiling from 4.x or older versions of DFly and should not be set
# by the user.
#
+.if defined(.PARSEDIR)
+.export CCVER
+.export HOST_CCVER
+.else
+# LEGACY MAKE - REMOVE FOR DFLY 3.6
.makeenv CCVER
.makeenv HOST_CCVER
+.endif
# We can reassign _CPUCFLAGS and CFLAGS will evaluate properly to the
# new value, we do not have to add the variable to CFLAGS twice.
View
22 share/mk/bsd.dep.mk
@@ -87,8 +87,8 @@ ${_YC} y.tab.h: ${_YSRC}
CLEANFILES+= y.tab.c y.tab.h
.elif !empty(YFLAGS:M-d)
.for _YH in ${_YC:S/.c/.h/}
-.ORDER: ${_YC} ${_YH}
-${_YC} ${_YH}: ${_YSRC}
+${_YH}: ${_YC}
+${_YC}: ${_YSRC}
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
SRCS+= ${_YH}
CLEANFILES+= ${_YH}
@@ -105,6 +105,9 @@ ${_YC}: ${_YSRC}
.if defined(SRCS)
depend: beforedepend _dependincs ${DEPENDFILE} afterdepend
+# Tell bmake not to look for generated files via .PATH
+.NOPATH: ${DEPENDFILE}
+
# Different types of sources are compiled with slightly different flags.
# Split up the sources, and filter out headers and non-applicable flags.
# Separate flag groups out of the sources and treat them differently.
@@ -118,7 +121,6 @@ __FLAGS_FILES:= ${__FLAGS_FILES:N${_FFILE}}
.endfor
_DEPENDFILES= ${FLAGS_GROUPS:S/^/.depend_/g}
-.ORDER: ${_DEPENDFILES}
${DEPENDFILE}: ${_DEPENDFILES}
@@ -174,15 +176,11 @@ _EXTRADEPEND: .USE
${DEPENDFILE}: _EXTRADEPEND
.endif
-.ORDER: ${_DEPENDFILES} ${DEPENDFILE} afterdepend
.else
depend: beforedepend _dependincs afterdepend
.endif
.if !target(beforedepend)
beforedepend:
-.else
-.ORDER: beforedepend ${_DEPENDFILES} ${DEPENDFILE}
-.ORDER: beforedepend afterdepend
.endif
.if !target(afterdepend)
afterdepend:
@@ -226,13 +224,9 @@ checkdpadd:
.endif
.if defined(INCS) && make(depend)
-
-_dependincs: ${INCS} ${SRCS}
-
-.ORDER: _dependincs depend
-
+_dependincs: buildincludes .WAIT installincludes
.else
-
_dependincs:
-
.endif
+
+.ORDER: beforedepend _dependincs ${DEPENDFILE} afterdepend
View
8 share/mk/bsd.obj.mk
@@ -1,5 +1,4 @@
# $FreeBSD: src/share/mk/bsd.obj.mk,v 1.30.2.10 2003/02/15 05:36:25 kris Exp $
-# $DragonFly: src/share/mk/bsd.obj.mk,v 1.5 2005/10/08 11:31:29 corecode Exp $
#
# The include file <bsd.obj.mk> handles creating the 'obj' directory
# and cleaning up object files, etc.
@@ -45,6 +44,8 @@ __<bsd.obj.mk>__:
.if defined(MAKEOBJDIRPREFIX)
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
+.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != ""
+CANONICALOBJDIR:=${MAKEOBJDIR}
.else
CANONICALOBJDIR:=/usr/obj${.CURDIR}
.endif
@@ -120,6 +121,11 @@ cleanobj:
rm -f ${.CURDIR}/obj; \
fi
+# Tell bmake not to look for generated files via .PATH
+.if !empty(CLEANFILES)
+.NOPATH: ${CLEANFILES}
+.endif
+
.if !target(clean)
clean:
.if defined(CLEANFILES) && !empty(CLEANFILES)
View
2 share/mk/bsd.subdir.mk
@@ -76,7 +76,7 @@ _SUBDIR_${__target}: .USE
.endfor
-${SUBDIR}::
+${SUBDIR}: .PHONY
@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
else \
View
14 share/mk/bsd.sys.mk
@@ -75,3 +75,17 @@ CWARNFLAGS += -Werror
# Allow user-specified additional warning flags
CFLAGS += ${CWARNFLAGS}
+
+# Tell bmake not to mistake standard targets for things to be searched for
+# or expect to ever be up-to-date
+PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
+ beforelinking build build-tools buildfiles buildincludes \
+ checkdpadd clean cleandepend cleandir cleanobj configure \
+ depend dependall distclean distribute exe extract fetch \
+ html includes install installfiles installincludes lint \
+ obj objlink objs objwarn patch realall realdepend \
+ realinstall regress subdir-all subdir-depend subdir-install \
+ tags whereobj
+
+.PHONY: ${PHONY_NOTMAIN}
+.NOTMAIN: ${PHONY_NOTMAIN}
View
18 share/mk/sys.mk
@@ -1,9 +1,14 @@
# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94
# $FreeBSD: src/share/mk/sys.mk,v 1.45.2.6 2002/12/23 16:33:37 ru Exp $
-# $DragonFly: src/share/mk/sys.mk,v 1.21 2008/05/19 10:26:02 corecode Exp $
unix ?= We run FreeBSD, not UNIX.
+# Set any local definitions first. Place this early, it needs
+# MACHINE_CPUARCH to be defined
+.if defined(.PARSEDIR)
+.sinclude <local.sys.mk>
+.endif
+
# If the special target .POSIX appears (without prerequisites or
# commands) before the first noncomment line in the makefile, make shall
# process the makefile as specified by the Posix 1003.2 specification.
@@ -317,3 +322,14 @@ __MAKE_CONF?=/etc/make.conf
# XXX hint for bsd.port.mk
OBJFORMAT?= elf
+# Tell bmake to expand -V VAR be default
+.MAKE.EXPAND_VARIABLES= yes
+
+.if !defined(.PARSEDIR)
+# Not using bmake, which is aggressive about search .PATH
+# It is sometimes necessary to curb its enthusiam with .NOPATH
+# The following allows us to quietly ignore .NOPATH when no using bmake.
+.NOTMAIN: .NOPATH
+.NOPATH:
+
+.endif
View
2 usr.bin/Makefile
@@ -20,6 +20,7 @@ SUBDIR= alias \
banner \
basename \
biff \
+ bmake \
brandelf \
btpin \
bzip2 \
@@ -116,7 +117,6 @@ SUBDIR= alias \
lzmainfo \
m4 \
mail \
- make \
mandoc \
mesg \
mkcsmapper \
View
6 usr.sbin/config/mkmakefile.c
@@ -159,9 +159,15 @@ makefile(void)
fprintf(ofp, "MACHINE_PLATFORM=%s\n", platformname);
fprintf(ofp, "MACHINE=%s\n", machinename);
fprintf(ofp, "MACHINE_ARCH=%s\n", machinearchname);
+ fprintf(ofp, ".if defined(.PARSEDIR)\n");
+ fprintf(ofp, ".export MACHINE_PLATFORM\n");
+ fprintf(ofp, ".export MACHINE\n");
+ fprintf(ofp, ".export MACHINE_ARCH\n");
+ fprintf(ofp, ".else\n");
fprintf(ofp, ".makeenv MACHINE_PLATFORM\n");
fprintf(ofp, ".makeenv MACHINE\n");
fprintf(ofp, ".makeenv MACHINE_ARCH\n");
+ fprintf(ofp, ".endif\n");
fprintf(ofp, "IDENT=");
if (profiling) {
/* Don't compile kernel profiling code for vkernel */

0 comments on commit 3da8e88

Please sign in to comment.