-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support true parallel builds #225
Conversation
This also adds --output-sync=target to the MFLAGS, so the output doesn't look like vomit if there are errors (although it sure makes it look less fast). This isn't supported by (you guessed it) Apple's ancient version of make. So for now, this requires macOS users to `brew install make` and `alias make=gmake`.
I’m confident in this now. I haven’t been able to get it to complain about passing |
When using --output-sync, build commands are given a normal file descriptor as their stdout/stderr, rather than the stdout/stderr of the tty. This means they don’t see a tty when they do `isatty(stderr)` and therefore don’t give colored output or any other fancy stuff. This forces that by using -fcolor-diganostics.
What does this implement/fix? Explain your changes.
Enables true parallel builds, either when specifying the
-j
flag, and by default using as many logical cores (e.g. 8 on a Core i7, 4 on a Core i5, 2 on an iPhone 6s).We just need to passWithout the flag, sub-makes revert to working serially:$(MFLAGS)
to sub-make calls, so that the job server flag is included (so sub-makes can communicate with the parent and each other, ensuring they only use the specified number of threads at a time).Does this close any currently open issues?
No
Any other comments?
Usually make is meant to inject the jobserver flags when it seesI was Doing It Wrong™.$(MAKE)
being used, but that wasn’t working for me, even when adding a+
at the start of the line as the warning suggests. However, there is$(MFLAGS)
, which is ”for historical compatibility,” but does exactly what we want.$(MAKEFLAGS)
is a set of flags implicitly passed down to sub-makes via the environment; it doesn’t have to be passed in manually.This also adds
--output-sync=target
to the MAKEFLAGS, so the output doesn't look like vomit if there are errors (although it sure makes it look less fast). This isn't supported by (you guessed it) Apple's ancient version of make.So for now, this requires macOS users to:As such parallelism isn’t supported on macOS unless make is updated to the latest via:At the moment there are still some cases where it might output:Fixed.I want to make parallelism completely implicit if at all possible. As long as the user hasn’t passed aDone.-j
flag of their own on the command line, Theos should automatically determine the appropriate number of jobs to run at once, and then re-run make with the same command line plus, eg,-j 4
for a 4-thread CPU.Where has this been tested?