8.12

4 Zuo and the Racket Build System🔗ℹ

Racket builds with many options, and the build needs to work in a variety of environments. That variability is difficult to manage through a traditional makefile. The Racket build is mostly driven instead with Zuo, which is a tiny, Racket-like scripting language with facilities inspired by make and Shake. When you build Racket with make, the makefile target ensures that zuo is built, and then it bounces the build request to a "main.zuo" script.

Racket makefiles build zuo using the CC_FOR_BUILD makefile variable plus CFLAGS_FOR_BUILD. The CC_FOR_BUILD variable defaults to using the CC makefile variable plus -O2, while CC normally defaults to cc. If you need to specify a C compiler or options for building Zuo, supply CC=compiler, CC_FOR_BUILD=compiler, and/or CFLAGS_FOR_BUILD=flags to make.

In you have zuo installed, you can generally substitute zuo . in place of make when building Racket components. You can even use just zuo in place of make if you’re not providing additional target or variable arguments to make, but otherwise . is needed after zuo to select the main.zuo script in the current directory. In most cases, it doesn’t matter whether you use make or zuo ., but if you move deep enough into the Racket build tree, there are only Zuo scripts. To install Zuo, you can use the usual configure && make && make install in "racket/src/zuo".

Even when you run zuo directly, configuration information is frequently read from "Makefile" or "Mf-config". The latter name is used when the makefile exists only for recording a configuration and does not provide targets. When you run a configure script, configuration choices are recorded in a generated "Makefile" or "Mf-config".

By convention, a source file "build.zuo" is analogous to "Makefile.in": it is meant to be instantiated in a build directory as "main.zuo". Instead of copying and updating, as typically happens to convert "Makefile.in" to "Makefile", a "main.zuo" is typically instantiated as a small module, possibly by copying a "buildmain.zuo" file to "main.zuo". That "main.zuo" reaches "build.zuo" using a source directory that is recorded in an accompanying "Makefile" or "Mf-config".