Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Oct 2012 15:00:21 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        freebsd-hackers@freebsd.org, "Simon J. Gerraty" <sjg@juniper.net>, freebsd-arch@freebsd.org
Subject:   Installing make as pmake when WITH_BMAKE specified (was Re: [CFT/RFC]: refactor bsd.prog.mk to understand multiple programs instead of a singular program)
Message-ID:  <CAGH67wT8A9bjBH=wsFB6CC5agobS=SOvPZyGEAC8giAQMu8M2A@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Thu, Oct 25, 2012 at 2:32 PM, Garrett Cooper <yanegomi@gmail.com> wrote:

...

> The real issue is that I need to take the patch Simon developed, run
> with it, and in parallel he needs to -- and hopefully already is --
> engage portmgr to get it through a number of exp- runs to make sure
> bmake does what it's supposed to do with his patch. Backwards
> compatibility will need to be maintained for ports because ports has
> to work on multiple versions of FreeBSD [where bmake isn't yet
> available/present], so maybe a fork in the road for bsd.port.mk should
> be devised in order to make everything work.

Here's an updated version of the workaround that works properly in all
cases and installs bmake as make and links make to pmake when
WITH_BMAKE=yes, and installs make as make when WITHOUT_BMAKE is
specified (this works better than the previous patch I sent to Simon).

The point of the patch isn't to discourage bmake use; in fact this
encourages bmake use more because I'm able to use bmake as my system
make, but be able to fall back to pmake as needed.

Thanks!
-Garrett

[-- Attachment #2 --]
Index: sys/conf/kern.post.mk
===================================================================
--- sys/conf/kern.post.mk	(revision 241973)
+++ sys/conf/kern.post.mk	(working copy)
@@ -61,12 +61,21 @@
 	OSVERSION=${OSRELDATE} \
 	WRKDIRPREFIX=${WRKDIRPREFIX}
 
+.if defined(.PARSEFILE)
+# Remove bmake-only supported MAKEFLAGS
+PORTSMAKEFLAGS:= ${MAKEFLAGS:tW:S/-N //:C/ -[JT] [^ ]+ / /g}
+PORTSMODULESENV+= MAKEFLAGS="${PORTSMAKEFLAGS}"
+PMAKE=	pmake
+.else
+PMAKE=	make
+.endif
+
 # The WRKDIR needs to be cleaned before building, and trying to change the target
 # with a :C pattern below results in install -> instclean
 all:
 .for __i in ${PORTS_MODULES}
 	@${ECHO} "===> Ports module ${__i} (all)"
-	cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B clean all
+	cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${PMAKE} -B clean all
 .endfor
 
 .for __target in install reinstall clean
@@ -74,7 +83,7 @@
 ports-${__target}:
 .for __i in ${PORTS_MODULES}
 	@${ECHO} "===> Ports module ${__i} (${__target})"
-	cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/install/deinstall reinstall/:C/reinstall/deinstall reinstall/}
+	cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${PMAKE} -B ${__target:C/install/deinstall reinstall/:C/reinstall/deinstall reinstall/}
 .endfor
 .endfor
 .endif
Index: usr.bin/Makefile
===================================================================
--- usr.bin/Makefile	(revision 241973)
+++ usr.bin/Makefile	(working copy)
@@ -280,10 +280,9 @@
 .if ${MK_MAKE} != "no"
 .if ${MK_BMAKE} != "no"
 SUBDIR+=	bmake
-.else
+.endif
 SUBDIR+=	make
 .endif
-.endif
 
 .if ${MK_MAN_UTILS} != "no"
 SUBDIR+=	catman
Index: usr.bin/make/Makefile
===================================================================
--- usr.bin/make/Makefile	(revision 241973)
+++ usr.bin/make/Makefile	(working copy)
@@ -4,7 +4,17 @@
 
 .include <bsd.own.mk>
 
+.if !defined(PROG)
+.if ${MK_BMAKE} != "no"
 PROG=	make
+LINKS+=	make pmake
+.else
+PROG=	pmake
+pmake.1: make.1
+	cp ${.ALLSRC} ${.TARGET}
+MAN=	pmake.1
+.endif
+.endif
 CFLAGS+=-I${.CURDIR}
 SRCS=	arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c	\
 	lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c	\

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wT8A9bjBH=wsFB6CC5agobS=SOvPZyGEAC8giAQMu8M2A>