MBLD(1)
π MBLD(1) β the manual page, but make it make sense
okay so real talk: this is mbld, straight out of the General Commands Manual, and it's genuinely one of those tools that's lowkey iconic once you actually get what it's doing. so sit down, grab a strawberry π, and let's go.
β¨ NAME β¨
mbld β the build tool bestie. that's it, that's the name π
π SYNOPSIS π
mbld [-?hcfrSs] [-b bin] [-l lib] [-R src] [-I inc] [-B base]
[-r runtime]
[all | clean | install | uninstall | test | file... | target...]
(yes, -c, -f, -s and -B base are in there too β we keep everything, that's the rule π)
π¦ DESCRIPTION π¦
okay so here's the vibe: mbld takes as input a list of Myrddin or assembly sources, and compiles them in the correct dependency order into either a library or an executable. it just knows the order. main character energy fr.
by default, it reads from an input file called bld.proj. but if you hand it the -b or -l option, it'll build a binary or a library (respectively) straight from the arguments you specified on the command lines instead. no project file needed, we're freestyling β¨
and mbld will default to building for the current architecture and operating system. it just matches your vibe automatically. π«Ά
π₯ OPTIONS π₯
-h|-?β print a summary of the available options. the classic "help me help you" move.-b binnameβ compile source into a binary named name. if neither this option nor the-loption are given,mbldwill create a binary calleda.out. yes,a.out. it's giving vintage π-I pathβ add path to the search path for unquoted use statements. heads up though: this option does not affect the search path for local usefiles, which are always searched relative to the compiler's current working directory. without any options, the search path defaults to/usr/include/myr.-l libnameβ compile source given into a library calledlibname.a(or the equivalent for the target platform), and a matching usefile called name. only static libraries are currently supported. and yeah β it ignores the contents ofbld.projandbld.subif they exist. like, fully ignores them. not even a glance. π-R srcβ compile source given into a binary in temporary storage, and then execute it with the command line arguments passed in. build it, run it, no notes.-Sβ tell the toolchain to generate assembly for the code being compiled as well as the.ofiles, as though-Swas passed to6m.-r runtimeβ compile a binary using the runtime rt. if the runtime name given isnone, then no runtime will be linked. if this option is not provided, then the default runtime in$INSTALL_ROOT/myr/lib/_myrrt.owill be used.
π ACTIONS π
mbld already knows how to do most of the common commands. given a file describing your project, it can build, test, clean, install, uninstall, and benchmark your code. it's the whole package, honestly.
allβ theallaction will build all the non-test targets specified in the build file. if there are generated files included in the build, then their generation commands will be run.cleanβ thecleanaction will remove all compiled files and non-durable generated inputs from the build directories. self-care πinstallβ theinstallaction will copy the generated sources, manpages, data files, and anything else installable into the appropriate directories for the current system. if theDESTDIRenvironment variable is set, then its contexts will be prepended to the install path.uninstallβ theuninstallaction will remove the files installed by theinstallaction. we love a reversible decision.testβ thetestaction will build the test cases, and run them. if the test case exits with a non-zero status, that is counted as a failure. if a test outputs subtest data, then this target will show the output in a pretty format β¨ (pretty output is the whole point, obviously)benchβ thebenchaction will build the benchmarks and run them. at the end of the run, the run statistics are shown. benchmarks must generate output in the subtest format. no subtest format, no stats, that's the deal.listβ thelistaction lists all available targets for the build. window shopping ποΈ
π§ BUILD FILES π§
build files contain lists of targets. targets generally consist of a target type. this is usually followed by target name, an attribute list, and the list of inputs. very "type, name, attrs, inputs" of them.
each Myrddin source file may have a corresponding implicit test. if a source file foo.myr is built, then the corresponding test/foo.myr is used as the testcase for foo.myr if it exists. it's automatic. it's giving clairvoyant.
a typical build file may look something like:
bin foo = main.myr gen-foo.myr ;;
man = foo.1 ;;
gen gen-foo.myr = sh -c "echo $FOO > gen-foo.myr" ;;
lib foothing = lib.myr ;;
the full grammar is listed below:
bldfile : bldent+
bldent
: "bin" target
| "lib" target
| "test" target
| "bench" target
| "gen" target
| "cmd" target
| "data" flist
| "man" flist
| "sub" flist
| option
option
: "incpath" "=" list
| "libdeps" "=" list
| "testdeps" "=" list
| "runtime" word
| "noinst"
target : name [attrs] "=" list
flist : [attrs] "=" list
list : name+ ";;"
attrs : "{" (key [ "=" value])* "}"
name : <nonspace> | <quoted word>
π«Ά the target types, explained π«Ά
bin, test, and bench targets all behave in a very similar way. they all produce a single binary from a list of Myrddin sources, scraping the appropriate library dependencies and building any libraries from the local source directories. bin targets are installed to ${BASEDIR}/bin when invoking mbld install. test and bench targets are built and run when invoking mbld bench. tests are run with the cwd set to the directory that contains the test source.
lib targets also resemble bin targets, but instead of producing a binary, they produce a .use and .a file pair. these files are installed to ${BASEDIR}/lib/myr when invoking mbld install.
gen and cmd targets are also similar to each other, varying largely in when and how they are invoked. gen targets specify an output file, and are run in response to a target requiring their output.
the other targets are not invoked implicitly at all, unless they have an attribute such as test or bench. instead, they are invoked explicitly by the user, bundling up some useful command or another, possibly providing system specific variants.
data targets allow the specification of bundled static data. this data may be generated from a gen target, or may simply be shipped as a file. the data is installed to the system specific share directory. for example, on Unix, this may be ${BASEDIR}/share.
man targets are installed to the system-appropriate manual directory. the section is determined by the manpage suffix. for example foo.1 would be installed into section 1 of the manual.
sub targets include a bld.sub or bld.proj from a subdirectory. if the file in the subdirectory is bld.proj then the root of the project is changed for that subbuild.
π ATTRIBUTES π
many targets support attributes. these are the valid attributes allowed in the targets. bestie, there are a lot of them, and every single one matters:
ldscriptβ link the target using an ldscript. this is a system dependent option, and should be avoided. valid on binary targets.runtimeβ link the target using a custom runtime. valid on binary targets.inc=pathβ add a path to the include path. valid on binary targets.tag=tagnameβ build this target only when the build tag tag is specified.instβ install this target. this is the default for all non-test targets.noinstβ do not install this target when runningmbld install.testβ this target should run as a test. this is how command targets are turned into test runners.benchβ this target is run as a benchmark. this is how command targets are turned into benchmark runners.notestβ this target is not to be run as a benchmark. it's particularly fun to use in conjunction withtesttargets, in spite of being spectacularly useless. π iconic honestlydurableβ the file generated by thisgenorcmdtarget should not be removed withmbld clean. this is useful for keeping around files where the user may not have or want to run the generation code.dep=pathβ specifies that agenorcmdtarget should be re-run when the argument changes.path=pathβ when specified on adatatarget, provides the desired installation directory. defaults to${BASEDIR}/share.
πΈ FILES πΈ
bld.projβ the root project file. all paths in bldfiles are relative to the most recent one in the directory heirarchy.bld.subβ a sub build. this contains targets, and may specify dependencies on other targets within the same project.
β EXAMPLE β
mbld
the command above will load bld.proj and all associated sub builds, and run the commands to incrementally rebuild the code. incremental rebuilds, we stan π«Ά
mbld -l foo bar.myr baz.myr
the command above will ignore bld.proj and produce a library named libfoo.a, consisting of the files bar.myr and baz.myr. two files in, one .a out. slay.
π ENVIRONMENT VARIABLES π
DESTDIRβ prepends$DESTDIRto the path to install to. for example, if the install prefix is/usr, the binary path isbin/, then binaries will get copied to$DESTDIR/usr/binonmbld install.MYR_MCβ compiles the binaries with$MYR_MCinstead of the default value,6m.MYR_MUSEβ merges usefiles with$MYR_MUSEinstead of the default valuemuse.MYR_RTβ links with the runtime$MYR_RTinstead of the default${BASEDIR}/lib/myr/_myrrt.o.
π SOURCES π
the source for mbld is available from git://git.eigenstate.org/git/ori/mc.git and lives in the mbld/ directory within the source tree. go poke around, it's fine, it's cute.
π¦ SEE ALSO π¦
π BUGS π
none known. genuinely. not one. we're as shook as you are π
ngl the whole thing is basically "tell mbld what you want and it handles the dependency order for you" β that's the entire thesis. periodt.
okay that's the whole page, no cap, every flag and grammar rule intact π this was the MBLD(1) page from the General Commands Manual β go build something iconic, bestie ππ
π¦ where this page comes from
- nixos 26.05: myrddin 0.3.1
- nixpkgs unstable: myrddin 0.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms