From 59620cdf5e51b69ddb60f977317c7aa9d6dc86d5 Mon Sep 17 00:00:00 2001 From: John Marino Date: Thu, 15 Nov 2012 13:49:05 +0100 Subject: [PATCH] bug 2450: Allow build of RELEASE 3.2 from master's bmake It was not possible to build RELEASE 3.2 once the world was updated to the 3.3 development branch. The makefiles were incompatible with bmake. It was possible to build RELEASE 3.2 with only a change to bsd.cpu.mk, but parallel builds still failed. The remaining changes and the previous cherry-pick were all done to support parallel builds when building this release branch from a system equipped with bmake as the system make. --- share/mk/bsd.cpu.mk | 6 ++++++ share/mk/bsd.dep.mk | 36 ++++++++++++++---------------------- share/mk/bsd.obj.mk | 8 +++++++- share/mk/sys.mk | 14 ++++++++++++-- usr.bin/make/main.c | 5 ++++- 5 files changed, 43 insertions(+), 26 deletions(-) diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 24e2186..0f27140 100644 --- a/share/mk/bsd.cpu.mk +++ b/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. diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 9384cdf..d62278d 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -1,5 +1,4 @@ # $FreeBSD: src/share/mk/bsd.dep.mk,v 1.27.2.3 2002/12/23 16:33:37 ru Exp $ -# $DragonFly: src/share/mk/bsd.dep.mk,v 1.9 2006/02/13 13:27:20 corecode Exp $ # # The include file handles Makefile dependencies. # @@ -19,7 +18,7 @@ # MKDEP Options for ${MKDEPCMD} [not set] # # MKDEPCMD Makefile dependency list program [mkdep] -# +# # SRCS List of source files (c, c++, assembler) # # @@ -68,32 +67,31 @@ tags: ${SRCS} CLEANFILES?= .for _LSRC in ${SRCS:M*.l:N*/*} -.for _LC in ${_LSRC:S/.l/.c/} +.for _LC in ${_LSRC:R}.c ${_LC}: ${_LSRC} ${LEX} -t ${LFLAGS} ${.ALLSRC} > ${.TARGET} SRCS:= ${SRCS:S/${_LSRC}/${_LC}/} -CLEANFILES:= ${CLEANFILES} ${_LC} +CLEANFILES+= ${_LC} .endfor .endfor .for _YSRC in ${SRCS:M*.y:N*/*} -.for _YC in ${_YSRC:S/.y/.c/} +.for _YC in ${_YSRC:R}.c SRCS:= ${SRCS:S/${_YSRC}/${_YC}/} -CLEANFILES:= ${CLEANFILES} ${_YC} +CLEANFILES+= ${_YC} .if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h) .ORDER: ${_YC} y.tab.h ${_YC} y.tab.h: ${_YSRC} ${YACC} ${YFLAGS} ${.ALLSRC} cp y.tab.c ${_YC} -SRCS:= ${SRCS} y.tab.h -CLEANFILES:= ${CLEANFILES} y.tab.c y.tab.h +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} ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC} -SRCS:= ${SRCS} ${_YH} -CLEANFILES:= ${CLEANFILES} ${_YH} +SRCS+= ${_YH} +CLEANFILES+= ${_YH} .endfor .else ${_YC}: ${_YSRC} @@ -107,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. @@ -120,7 +121,6 @@ __FLAGS_FILES:= ${__FLAGS_FILES:N${_FFILE}} .endfor _DEPENDFILES= ${FLAGS_GROUPS:S/^/.depend_/g} -.ORDER: ${_DEPENDFILES} ${DEPENDFILE}: ${_DEPENDFILES} @@ -183,15 +183,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: @@ -235,13 +231,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 diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index 36d21af..ab884bd 100644 --- a/share/mk/bsd.obj.mk +++ b/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 handles creating the 'obj' directory # and cleaning up object files, etc. @@ -45,6 +44,8 @@ ____: .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) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index de8e98b..e13fda5 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -1,6 +1,5 @@ # 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. @@ -137,7 +136,7 @@ YFLAGS ?= -d # prevent buildworld from breaking. # .if !defined(MACHINE_PLATFORM) -MACHINE_PLATFORM=pc32 +MACHINE_PLATFORM!=sysctl -n hw.platform .endif .if ${MACHINE} == "pc32" MACHINE=i386 @@ -317,3 +316,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 diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 5294f03..afaf5e2 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -390,7 +390,7 @@ MainParseArgs(CLI *cli, int argc, char **argv) rearg: optind = 1; /* since we're called more than once */ optreset = 1; -#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:" +#define OPTFLAGS "ABC:D:E:I:J:PSV:Xd:ef:ij:km:nqrstvx:" for (;;) { if ((optind < argc) && strcmp(argv[optind], "--") == 0) { found_dd = true; @@ -416,6 +416,9 @@ rearg: Path_AddDir(&cli->parseIncPath, optarg); MFLAGS_append("-I", optarg); break; + case 'J': + /* Allow make child of bmake parent (No-op) */ + break; case 'V': Lst_AtEnd(&cli->variables, estrdup(optarg)); MFLAGS_append("-V", optarg); -- 1.7.7.2