Re: Detecting parallel builds

2011-04-09 Thread David Boyce
On Fri, Apr 8, 2011 at 7:58 PM, Philip Prindeville
phil...@redfish-solutions.com wrote:
 Didn't hear back, so I assume there is no easy way to detect (currently) a 
 parallel build.

There was a response by Edward Welbourne - didn't you see it? It's not
a documented/supported solution but I believe if you find any of -j,
--jobs, or --jobserver-fds in $(MAKEFLAGS) the build is parallel.
Since the latter two both match --jobs%, this should boil down to two
nested findstring function calls on the MAKEFLAGS value.

David Boyce

___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #33034] Makefile:23: *** mixed implicit and normal rules. Stop. for Linux kernel out of source builds

2011-04-09 Thread Paul D. Smith
Update of bug #33034 (project make):

  Status:None = Not A Bug  
 Open/Closed:Open = Closed 

___

Follow-up Comment #3:

This is an intentional change.  See the GNU make NEWS file:


* WARNING: Backward-incompatibility!
  In previous versions of make it was acceptable to list one or more explicit
  targets followed by one or more pattern targets in the same rule and it
  worked as expected.  However, this was not documented as acceptable and
if
  you listed any explicit targets AFTER the pattern targets, the entire rule
  would be mis-parsed.  This release removes this ability completely: make
  will generate an error message if you mix explicit and pattern targets in
  the same rule.


You must split these rules into two rules: one for the pattern and one for the
explicit targets.  The Linux kernel source has already been modified in this
way (in newer kernels).

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?33034

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #33034] Makefile:23: *** mixed implicit and normal rules. Stop. for Linux kernel out of source builds

2011-04-09 Thread Henry Nestler
Follow-up Comment #2, bug #33034 (project make):

As workaround for coLinux can change the template scripts/mkmakefile.

*** old:

%/: all
@:


*** new:


$(all) %/: all
ifneq ($(all),)
$(all): all
   @:


See also the attached patch.


(file #23162)
___

Additional Item Attachment:

File name: make-3.82-mkmakefile.patch Size:0 KB


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?33034

___
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #33034] Makefile:23: *** mixed implicit and normal rules. Stop. for Linux kernel out of source builds

2011-04-09 Thread Henry Nestler
Follow-up Comment #1, bug #33034 (project make):

Sorry. forgotten to login while creating this bug.

The bug was original reported by a coLinux user:
http://article.gmane.org/gmane.linux.colinux.general/5230

Make 3.81 works.


___

Reply to this item at:

  http://savannah.gnu.org/bugs/?33034

___
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #33034] Makefile:23: *** mixed implicit and normal rules. Stop. for Linux kernel out of source builds

2011-04-09 Thread anonymous
URL:
  http://savannah.gnu.org/bugs/?33034

 Summary: Makefile:23: *** mixed implicit and normal rules.
Stop. for Linux kernel out of source builds
 Project: make
Submitted by: None
Submitted on: Sa 09 Apr 2011 10:42:24 UTC
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 3.82
Operating System: POSIX-Based
   Fixed Release: None
   Triage Status: None

___

Details:

A build of Linux kernel out of source got this error, if target name was give
on command line. It gots this error:

Makefile:23: *** mixed implicit and normal rules.  Stop.

The relevant lines in Makefile:
16: all := $(filter-out all Makefile,$(MAKECMDGOALS))
23: $(all) %/: all

Full example:
cd /tmp
wget
http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.33/linux-2.6.33.9.tar.bz2
tar xjf linux-2.6.33.9.tar.bz2
mkdir linux-2.6.33.9-build
cd linux-2.6.33.9
make O=../linux-2.6.33.9-build defconfig
cd ../linux-2.6.33.9-build
make vmlinux

If replacing the command make vmlinux with make, then it works. But it is
no workaround, because I need to call make modules_install later.




___

File Attachments:


---
Date: Sa 09 Apr 2011 10:42:25 UTC  Name: Makefile  Size: 523B   By: None
Linux kernel Makefile from make defconfig in build directory
http://savannah.gnu.org/bugs/download.php?file_id=23155

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?33034

___
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: Detecting parallel builds

2011-04-09 Thread Philip Prindeville
On 4/9/11 5:44 AM, David Boyce wrote:
 On Fri, Apr 8, 2011 at 7:58 PM, Philip Prindeville 
 phil...@redfish-solutions.com wrote:
 Didn't hear back, so I assume there is no easy way to detect (currently) a 
 parallel build.
 
 There was a response by Edward Welbourne - didn't you see it? It's not
 a documented/supported solution but I believe if you find any of -j,
 --jobs, or --jobserver-fds in $(MAKEFLAGS) the build is parallel.
 Since the latter two both match --jobs%, this should boil down to two
 nested findstring function calls on the MAKEFLAGS value.
 
 David Boyce

I didn't see it, but I might not have been in copy.

I just tried that:

[philipp@builder ~/openwrt2]$ cat /tmp/Makefile
$(info MAKEFLAGS=$(MAKEFLAGS))
$(info MFLAGS=$(MFLAGS))
$(info MAKE=$(MAKE))

PBUILD:=$(if $(filter --jobs% -j%,$(MAKEFLAGS)),y,)

all:
@echo PBUILD=$(PBUILD)
@$(MAKE) -f /tmp/Makefile stop

stop:

[philipp@builder ~/openwrt2]$ make -j5 -f /tmp/Makefile
MAKEFLAGS=
MFLAGS=
MAKE=make
PBUILD=
MAKEFLAGS=w
MFLAGS=-w
MAKE=make
make[1]: Entering directory `/home/philipp/openwrt2'
make[1]: Nothing to be done for `stop'.
make[1]: Leaving directory `/home/philipp/openwrt2'
[philipp@builder ~/openwrt2]$

Not sure what I'm missing...



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: Detecting parallel builds

2011-04-09 Thread Philip Prindeville
On 4/9/11 5:48 PM, David Boyce wrote:
 On Sat, Apr 9, 2011 at 2:32 PM, Philip Prindeville
 phil...@redfish-solutions.com wrote:
 [philipp@builder ~/openwrt2]$ make -j5 -f /tmp/Makefile
 MAKEFLAGS=
 MFLAGS=
 MAKE=make
 PBUILD=
 MAKEFLAGS=w
 MFLAGS=-w
 MAKE=make
 make[1]: Entering directory `/home/philipp/openwrt2'
 make[1]: Nothing to be done for `stop'.
 make[1]: Leaving directory `/home/philipp/openwrt2'
 [philipp@builder ~/openwrt2]$

 Not sure what I'm missing...
 
 Unfortunately it appears that MAKEFLAGS is composed on the fly when
 forking a command (aka job). See the following makefile:
 
 % cat /tmp/Makefile
 $(info MAKEFLAGS='$(MAKEFLAGS)')
 
 .PHONY: all
 all:
 @echo MAKEFLAGS='$(MAKEFLAGS)' (recipe)
 
 % make -f /tmp/Makefile -j2
 MAKEFLAGS=''
 MAKEFLAGS=' --jobserver-fds=3,4 -j' (recipe)
 
 So it's not available to $(info) and other functions outside of a
 recipe. There's probably a way to trick make into doing a simple
 recursion to harvest the data. Or if you're dealing with an
 automated/nightly build you could set MAKEFLAGS yourself to turn on
 parallelism:
 
 MAKEFLAGS=-j8 make ...
 
 but at that point you might as well just take control yourself
 
 PARALLEL=YES make -j8 ...
 
 Here's a hack which will work by calling make recursively once, but
 note that it will only work when no explicit target is mentioned:
 
 % cat Makefile
 .PHONY: all
 all:
 
 ifndef PARALLEL
 .PHONY: _is_parallel
 .DEFAULT_GOAL := _is_parallel
 _is_parallel:
 +@PARALLEL=`PARALLEL=tbd $(MAKE) -s -f $(MAKEFILE_LIST)
 _is_parallel2` \
 PARALLEL=$$PARALLEL $(MAKE) --no-print-directory -f
 $(MAKEFILE_LIST) $(MAKECMDGOALS)
 else
 .PHONY: _is_parallel2
 _is_parallel2: ; @echo $(if $(findstring -j,$(MAKEFLAGS)),YES,NO)
 endif
 
 all:
 @echo We $(if $(findstring YES,$(PARALLEL)),ARE,ARE NOT)
 building in parallel
 
 
 David Boyce


Ok, so how about adding a builtin variable that contains the value of -j and 
making it globally available?

-Philip

___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make