Opened 10 years ago
Last modified 10 years ago
#45274 new enhancement
Run portbuild::build_main once for each build.target
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 2.3.99 |
Keywords: | Cc: | cooljeanius (Eric Gallager), larryv (Lawrence Velázquez) | |
Port: |
Description
With parallel building, there is the potential for a problem when a port sets build.target
to multiple values, as was experienced for example with the faust-devel port in #45241.
One solution would be to run portbuild::build_main
once for each build.target
, rather than running it just a single time and passing it the entire build.target
all at once.
Change History (7)
comment:1 Changed 10 years ago by larryv (Lawrence Velázquez)
comment:2 follow-up: 3 Changed 10 years ago by larryv (Lawrence Velázquez)
Admittedly, the part of the documentation describing parallel execution is not clear on this.
comment:3 follow-up: 4 Changed 10 years ago by larryv (Lawrence Velázquez)
Sorry for the noise. Turns out that the documentation doesn’t describe the behavior very well: Specifying the goals on the command line simply adds them (in order) to the list of targets to be run, so parallel building behavior applies to them as usual.
% >test.makefile <<EOF heredoc> .PHONY: foo bar baz heredoc> heredoc> foo: heredoc> @echo foo start! heredoc> @sleep 10 heredoc> @echo foo end! heredoc> heredoc> bar: heredoc> @echo bar start! heredoc> @sleep 5 heredoc> @echo bar end! heredoc> heredoc> baz: heredoc> @echo baz start! heredoc> @sleep 2 heredoc> @echo baz end! heredoc> EOF % make -f test.makefile foo bar baz foo start! foo end! bar start! bar end! baz start! baz end! % make -f test.makefile -j 8 foo bar baz foo start! bar start! baz start! baz end! bar end! foo end! %
comment:4 follow-up: 6 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to larryv@…:
Specifying the goals on the command line simply adds them (in order) to the list of targets to be run, so parallel building behavior applies to them as usual.
That's what I observed too.
So it may be that in the build failure that prompted me to file this ticket, the makefile's dependencies really are wrong. However, this may be a case where we can make a single small change to base which would have little or no effect on existing working ports but fix problems in a bunch of other ports and/or make portfile writing easier. I liken it to the small change we made to base some years ago to not run the destroot phase in parallel anymore—that should have worked too, but for many ports, it didn't, because makefile dependencies were wrong.
comment:6 Changed 10 years ago by larryv (Lawrence Velázquez)
Strictly speaking, this change would penalize ports with correctly-written makefiles that would otherwise benefit from having their command-line goals executed in parallel, but the number of ports satisfying this condition might be insignificant. And in such cases it would be trivial to patch in a new phony target, dependent on the required targets, and use that as ${build.target}
.
So this seems like a good idea to me.
Just repeating what I said on #45241:
The GNU Make documentation explicitly says that it processes each command-line goal in order:
Thus,
satisfies target “A”, then “B”, and then “C”. I don’t know whether other Make variants behave similarly, but it’s easy enough to force GNU Make if necessary.