Consider a directory in which a file called etc.config
exists in
the directory $AST_ROOT/dev/etc
. How
does GEN_make go about creating a Makefile
? To get it started
the user types,
% GEN_make etc.configThe file extension may be omitted. GEN_make then follows the following algorithm,
etc
.
$AST_ROOT
( ../..)
Makefile
relative to $AST_ROOT
. ( dev/etc)
14 Jul 1789
format
Makefile
Makefile
was made ( xun9)
Makefile
text.
AST_MAKE_PATH
variable. This
is a colon separated list of the directories which will be searched for
proto-make files.
$AST_MAKE_PATH
.
#include
directives -- the file name argument following the #include
specifies a file which must lie somewhere in the $AST_MAKE_PATH
directory list. This file flattening process is performed for speed's
sake for a C tool which lives in the kernel called at_strm
.
#foreach
directive. This is a control
structure within the proto-make file for generating multiple copies
of the same bit of make text. An example is,
#foreach &X& :TASKS: $(BIN)/&x&: &x&.f alink $? `ast_link_adam` mv &x& $@ #endThis directive expands zero or more times, depending on the number of space separated values in the translation of the token specified as the second argument. The first argument is the loop variable name -- it must be enclosed in ampersands. This apparently silly choice of ampersands and colons was done deliberately to make GEN_make stuff stand out from normal
Makefile
text, and
ensure make
will break if you leave any such tokens untranslated.
Upper
case instances of the loop variable expand to upper case copies of
the elements of the second and subsequent arguments, and lower to
lower case copies.
The utility of this directive can only be appreciated after a thorough understanding of the differences of OSF, Solaris and Linux `make' syntax. The above text of a good example of why it useful. The final target is in another directory and we only want to rebuild it if it is out of date with respect to its source code.
The (entirely) blank line before the #end
marker is required
to generate correct Makefile
source if there is more than one
repetition of the directive.
The #foreach
directives cannot be nested.
Makefile
. Any pre-existing
file of that name is deleted.