Hard Build System: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
(→‎See Also: Add a link to the GNU Make manual (including PDF))
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(7 intermediate revisions by 4 users not shown)
Line 3:
Build systems for operating systems implement a complex task and tend to be highly customizable. It's crucial to pick good abstractions to manage this complexity. A source code tree has many aspects of configuration, such as the target processor architecture, what optimizations and warnings are used, where the code is installed, which compiler is used, and so on. No solution fits all.
 
It's tempting to fall in the trap of providing an easy build system. The user merely runs a script with administrator access, causing system-wide changes to occur, source code to be built, programs installed, and a somehow an operating system image appear on the other end. No effort, just waiting. This approach is too simple and ends up being too complex.
 
== Example ==
Line 20:
** Decision: Where to install the programs.
* Prepare a [[System Root]] containing the standard library headers (needed to make a [[Hosted GCC Cross-Compiler]]).
** Decision: Where is the system root is located.
** Decision: What processor architecture is used.
* Build and install a cross toolchain:
Line 96:
 
An Easy Build System is responsible for as much as possible, avoiding any user effort. Degrees of this exist, of course. The ultimate easy build system is when the user blindly pipes an URL into an administrative shell:
<sourcesyntaxhighlight lang="bash">
download-to-stdout http://example.com/myos.sh | sudo sh
</syntaxhighlight>
</source>
 
It'll attempt to do as much work as possible to reliably understand the local operating system. It'll figure out what software needs to be installed, detect the distro and install the correct packages, download and compile source code if needed, might make global changes if needed, and generally try to pick sensible defaults. The script will be very complex because the systems out there are very different. The user can merely hope it works and doesn't screw up the local system too much.
Line 134:
=== Articles ===
* [[Meaty Skeleton]] - A minimal operating system template with a hard build system.
* [[Makefile]] - A makefile tutorial
 
=== External Links ===
* [http://www.gnu.org/software/make/manual/make.html GNU Make manual] ([http://www.gnu.org/software/make/manual/make.pdf PDF] is [https://www.gnu.org/copyleft/fdl.html freely] available as well)
* [https://sortix.org/man/man7/cross-development.7.html Sortix Cross Development Guide] — a guide on how to build one of the hobby OSes
 
* [http://aegis.sourceforge.net/auug97.pdf Recursive Make Considered Harmful] — A white paper by Peter Miller on the hazards of using a recursive make build and a suggested alternative
=== Hobby Operating Systems ===
Note: While the purpose of Peter Miller's paper is sound, the dependency configuration outlined in section 5.4 is considered inferior to the dependency configuration outlined in [[Makefile]].
* [https://cs.au.dk/~sortie/sortix/release/current/doc/cross-development Sortix Cross Development Guide]
 
[[Category:FAQ]]