We use MetaMake to build AROS - The Amiga Research OS. AROS consists of many different packages which depend on each other like this:
#MM AROS : setup includes kernel workbench appsThis is a metatarget in a makefile (MetaMake looks for #MM as the first thing in a line). It means that AROS depends on setup, includes, etc. as you are used to from Make.
The big point is: MetaMake will consider *all makefiles at once* when it checks a metatarget. So all metatargets "setup" in all makefiles will be build when MetaMake tries to build AROS. MetaMake searches itself for the makefiles, so to add a new package, just create a new makefile in that directory and invoke MetaMake again.
This also allows to build the project from anywhere. You can invoke MetaMake in a subdir or any other directory if you copy the config file to $HOME.
MetaMake can also read a file with Make-style variable definitions. This allows to build the project depending on some variable, for example:
#MM kernel : kernel-$(ARCH)-$(CPU)will build kernel-linux-i386 before kernel on Linux/i386 machines.
MetaMake will calculate $(TOP) (the path to the top of the project) and CURDIR (the path to the current directory relative to $(TOP)) and pass them to make. Also $(TARGET) will contain the current target but this will not be passed to make automatically. If you need the target in the makefile, you can use the maketool option to change this.
For convenience, you can also let MetaMake find the target like this:
#MM kernel : kernel-$(ARCH)-$(CPU)but this is not the same as above. In this case, MetaMake will not try to build kernel-$(ARCH)-$(CPU) but only kernel. This is useful if your metatarget doesn't depend on anything else than local targets in the current makefile.
mmake looks for a config file mmake.config or .mmake.config in the current directory for a file in the environment variable $MMAKE_CONFIG or a file .mmake.config in the directory $HOME. This file can contain the following things:
# This is a comment # Options before the first [name] are defaults. Use them for global # defaults defaultoption value # Special options for the project name. You can build targets for this # project with "mmake name.target" [AROS] # The root dir of the project. This can be accessed as $(TOP) in every # makefile or when you have to specify a path in mmake. The default is # the current directory top /home/digulla/AROS # This is the default name for Makefiles. The default is "Makefile" defaultmakefilename makefile # If you just say "mmake AROS", then mmake will go for this target defaulttarget AROS # mmake allows to generate makefiles with a script. The makefile # will be regenerated if it doesn't exist, if the source file is # newer or if the file specified with genmakefiledeps is newer. # The name of the source file is generated by concatenating # defaultmakefilename and ".src" genmakefilescript gawk -f $(TOP)/scripts/genmf.gawk --assign "TOP=$(TOP)" # If this file is newer than the makefile, the script # genmakefilescript will be executed. genmakefiledeps $(TOP)/scripts/genmf.gawk # mmake will read this file and every variable in this file will # be available everywhere where you can use a variable. globalvarfile $(TOP)/config/host.cfg # Some makefiles must have a different name than # defaultmakefilename. You can add them manually here. #add compiler/include/makefile #add makefileA metatarget look like so: project.target. Example: AROS.setup. If nothing is specified, mmake will make the default target of the first project in the config file. If the project is specified but no target, mmake will make the default target of this project.
If you have comments or suggestions, email me at digulla@aros.fh-konstanz.de. 24. Jul 1999