Table of Contents
Stirmake supports automated cleaning with the options -b and -c. The option -b cleans only files that have been marked distributables (@distrule), whereas the option -c cleans only files that have not been marked distributables. If you want to clean everything, you need to use both and run smka -bc.
It is possible to use "smkt -bc" to clean all files in the current directory, not all files in all directories. Similarly, "smkt -b" and "smkt -c" work to clean only files of the desired type only in the current directory.
By default, stirmake decides what files need removing when cleaned. However, sometimes you may want to add hooks for doing additional actions when cleaning. This is supported by:
@toplevel @strict @cleanhook: @ ["echo", "cleanhook"] @distcleanhook: @ ["echo", "distcleanhook"] @bothcleanhook: @ ["echo", "bothcleanhook"] @phonyrule: 'all': @ ["echo", "all"]
Now if you type "smka -c" the cleanhook is executed. If you type "smka -b", the distcleanhook is executed. If you type "smka -bc", then bothcleanhook is executed. If you type "smka" without anything, then the first ordinary rule, "all", is executed.
There cannot be multiple hooks:
@toplevel @strict @cleanhook: @ ["echo", "cleanhook"] @cleanhook: @ ["echo", "anothercleanhook"] @phonyrule: 'all': @ ["echo", "all"]
...which, when called with "smka" will say the hook already exists. However, each subdirectory may have its own hooks.
If interfacing to a sub-make that supports cleaning object files and all files but not cleaning only binaries, it's possible to add a hook that fails:
@toplevel @strict @cleanhook: @ ["echo", "cleanhook"] @distcleanhook: @ ["false"] @bothcleanhook: @ ["echo", "bothcleanhook"] @phonyrule: 'all': @ ["echo", "all"]
...and now "smka -b" does not work.