Alter(or mess with) sun4i target flags a bit
[AROS.git] / tools / MetaMake / mmake.txt
blobd7b6d2040aa3d2c01070d96b8c4160a0b77de7c6
1 \chapter{MetaMake}
3 MetaMake is a version of make which allows to recursively build targets
4 in the various directories of a project or even another project.
6 \shell{Usage: mmake [<options>] [<metatargets>]}
8 To build mmake, just compile \filename{mmake.c}. It doesn't need any
9 other files.
11 mmake looks for a config file \filename{mmake.config} or
12 \filename{.mmake.config} in the current directory for a file in the
13 environment variable \shell{$MMAKE_CONFIG} or a file \filename{.mmake.config}
14 in the directory \shell{$HOME}.
15 This file can contain the following things:
17 \begin{description}
18 \item{#} This must be the first character in a line and begins a comment.
19 Comments are completely ignored my mmake (as are empty lines).
21 \item{[name]} This begins a config section for the project \shell{name}.
22 You can build targets for this project by saying \shell{name.target}.
24 \item{maketool} Specifies the name of the tool to build a target. The
25 default is \shell{make "TOP=$(TOP)" "CURDIR=$(CURDIR)"}
27 \item{top <dir>} Specifies the root directory for a project. You
28 will later find this config option in the variable \shell{$(TOP)}.
29 The default is the current directory.
31 \item{defaultmakefilename <filename>} Specifies the basename for
32 makefiles in your project. Basename means that mmake will consider
33 other files which have this stem and an extension, too. See the
34 items to generate makefiles for details. The default
35 is \filename{Makefile}
37 \item{defaulttarget <target>} The name of the default target which
38 mmake will try to make if you call it with the name of the
39 project alone. The default is \shell{all}.
41 \item{genmakefilescript <cmdline>} mmake will check for files
42 with the basename as specified in \shell{defaultmakefilename}
43 with the extension \shell{.src}. If such a file is found, the
44 following conditions are checked: Whether this file is newer
45 than the makefile, whether the makefile doesn't exist and
46 whether the file \shell{genmakefiledeps} is newer than the
47 makefile. If any of these is true, mmake will call this script
48 the the name of the source file as an extra option and the
49 stdout of this script will be redirected to \shell{defaultmakefilename}.
50 If this is missing, mmake will not try to regenerate makefiles.
52 \item{genmakefiledeps <path>} This is the name of a file which is
53 considered when mmake tries to decide whether a makefile must
54 be regenerated. Currently, only one such file can be specified.
56 \item{globalvarfile <path>} This is a file which contains more
57 variables in the normal make(1) syntax. mmake doesn't
58 know about any special things like line continuation, so
59 be careful not to use such variables later (but they
60 don't do any harm if they exist in the file. You should
61 just not use them anywhere in mmake).
63 \item{add <path>} Adds a nonstandard makefile to the list of
64 makefiles for this project. mmake will apply the standard
65 rules to it as if the \shell{defaultmakefilename} was
66 like this filename.
68 \item{ignoredir <path>} Will tell mmake to ignore directories
69 with this name. Try \shell{ignore CVS} if you use CVS to
70 manage your projects' sources.
72 Any option which is not recognised will be added to the list
73 of known variables (ie. \shell{foo bar} will create a
74 variable \shell{$(foo)} which is expanded to \shell{bar}).
76 Here is an example:
78 \begin{example}
79 # This is a comment
80 # Options before the first [name] are defaults. Use them for global
81 # defaults
82 defaultoption value
84 # Special options for the project name. You can build targets for this
85 # project with "mmake name.target"
86 [AROS]
87 # The root dir of the project. This can be accessed as $(TOP) in every
88 # makefile or when you have to specify a path in mmake. The default is
89 # the current directory
90 top /home/digulla/AROS
91 # This is the default name for Makefiles. The default is "Makefile"
92 defaultmakefilename makefile
93 # If you just say "mmake AROS", then mmake will go for this target
94 defaulttarget AROS
95 # mmake allows to generate makefiles with a script. The makefile
96 # will be regenerated if it doesn't exist, if the source file is
97 # newer or if the file specified with genmakefiledeps is newer.
98 # The name of the source file is generated by concatenating
99 # defaultmakefilename and ".src"
100 genmakefilescript gawk -f $(TOP)/scripts/genmf.gawk --assign "TOP=$(TOP)"
101 # If this file is newer than the makefile, the script
102 # genmakefilescript will be executed.
103 genmakefiledeps $(TOP)/scripts/genmf.gawk
104 # mmake will read this file and every variable in this file will
105 # be available everywhere where you can use a variable.
106 globalvarfile $(TOP)/config/host.cfg
108 # Some makefiles must have a different name than
109 # defaultmakefilename. You can add them manually here.
110 #add compiler/include/makefile
111 #add makefile
112 \end{example}
114 A metatarget look like so: \shell{project.target}. Example:
115 \shell{AROS.setup}. If nothing is specified, mmake will make the default
116 target of the first project in the config file. If the project is specified
117 but no target, mmake will make the default target of this project.
119 mmake will look for all makefiles (regenerating them if necessary), check
120 which makefiles provide the metatargets you gave in the command line and on
121 which other metatargets that depend on those metatargets and will then
122 successively make all metatargets.
124 MMake will calculate \shell{$(TOP)} (the path to the top of the project)
125 and \shell{CURDIR} (the path to the current directory relative to
126 \shell{$(TOP)}) and pass them to make. Also \shell{$(TARGET)} will contain
127 the current target but this will not be passed to make automatically. If
128 you need the target in the makefile, you can use the \shell{maketool}
129 option to change this.