make2cook - translate makefiles into cookbooks
make2cook [ option... ][ infile [ outfile ]]
The make2cook program is used to translate Makefiles into cookbooks.
This command is provided to ease the transition to using the cook
If no input file is named, or the special name ‘‘-’’ is used, input
will be taken from the standard input. If no output file is named, or
the special name ‘‘-’’ is used, output will be taken from the
There is no one-to-one semantic mapping between make semantics and
cook semantics, so the results will probably need some manual editing.
The functionality provided by classic make (1) implementations is
accurately reproduced. Extensions, such as those offered by GNU Make
or BSD make, are not always understood, or are sometimes not
The following subsections enumerate a few of the things which are
understood and not understood. They are probably not complete.
The cook program requires variables to be defined before they are
used, whereas make will default them to be empty. This is understood,
and empty definitions are inserted as required.
Most of the builtin variables of GNU Make are understood.
Most of the builtin rules of classic make, GNU Make and BSD make are
For best results there should be a blank line after every rule, so
that there can be no confusion where one rule ends and a new one
Builtin variables are defaulted from the environment, if an
environment variable of the same name is set.
The GNU Make override variable assignment is understood.
The GNU Make ‘‘+=’’ assignment is understood.
The GNU Make ‘‘:=’’ variable assignment is understood.
Traditional make assignments are macros, they are expanded on use,
rather than on assignment. The cook program has only variables.
Assignment statements are re-arranged to ensure the correct results
when variables are referenced.
Single and double suffix rules are understood. The .SUFFIXES rules
are understood and honoured. Hint: if you want to suppress the
builtin-recipes, use a .SUFFIXES rule with no dependencies.
The .PHONY rule is understood, and is translated into a set forced
flag in appropriate recipes, except files from implicit recipes.
The .PRECIOUS rule is understood, and is translated into a set
precious flag in the appropriate recipes, except files from implicit
The .DEFAULT rule is understood, and is translated into an implicit
The .IGNORE rule is understood, and is translated into a set errok
The .SILENT rule is understood, and is translated into a set silent
Most GNU Make functions are understood. The filter and filter-out
functions only understand a single pattern. The sort function does
not remove duplicates (wrap the stringset function around it if you
The GNU Make static pattern rules are understood. They are translated
into recipe predicates.
The GNU Make and BSD make include variants are understood.
The bizarre irregularities surrounding archive files in automatic
variables and suffix rules are understood, and translated into
consistent readable recipes. The make semantics are preserved.
The BSD make .CURDIR variable is understood, and translated to an
equivalent expression. It cannot be assigned to.
The GNU Make and BSD make conditionals are understood, provided that
they bracket whole segments of the makefile, and that these segments
are syntactically valid. Cconditionals may also appear within rule
body commands. Conditionals are not understood within the lines of a
The GNU Make define is understood, but its use as a kind of ‘‘function
definition’’ is not understood.
The GNU Make export and unexport directives are understood.
The cook program tokenizes its input, whereas make does textual
replacement. The shennanigans required to construct a make macro
containing a single space are not understood. The translation will
result in a cook variable which is empty.
References to automatic variables within macro definitions will not
The GNU Make foreach function is olny partially understood. This has
no exact cook equivalent.
The GNU Make origin function is not understood. This has no cook
The archive((member)) notation is not understood. These semantics are
not available from cook.
The MAKEFILES and MAKELEVEL variables are not translated, If you wish
to reproduce this functionality, you must edit the output.
The MAKEFLAGS and MFLAGS variables will be translated to use the Cook
options function, which has a different range of values.
Many variants of make can use builtin rules to make the Makefile if it
is absent. Cook is unable to cook the cookbook if it is absent.
Wildcards are not understood in rule targets, rule dependencies or
include directives. If you want these, you will have to edit the
output to use the [wildcard] function.
Home directory tildes (~) are not understood in targets and
dependencies. If you want this, you will have to edit the output to
use the [home] function.
The -lhome dependency is not understood to mean a library. If you
want this, you will have to edit the output to use the [collect
findlibs -lname] function.
The .EXPORT_ALL_VARIABLES rule is not understood. This has no cook
The following options are understood:
Provide some help with using the make2cook command.
This option causes fragments to test for environment variables
when performing the default settings for variables. (This
corresponds to the make -e option.)
This option causes make2cook to include recipes for RCS and
SCCS in the output.
Insert line number directives into the output, so that it is
possible to tell where the lines came from. Most useful when
debugging. make2cook program.
This option may be used to supress all generation of recipes
corresponding to make’s internal rules. (This corresponds to
the make -r option.)
Print the version of the make2cook program being executed.
All other options will produce a diagnostic error.
All options may be abbreviated; the abbreviation is documented as the
upper case letters, all lower case letters and underscores (_) are
optional. You must use consecutive sequences of optional letters.
All options are case insensitive, you may type them in upper case or
lower case or a combination of both, case is not important.
For example: the arguments "-help", "-HEL" and "-h" are all
interpreted to mean the -Help option. The argument "-hlp" will not be
understood, because consecutive optional characters were not supplied.
Options and other command line arguments may be mixed arbitrarily on
the command line.
The GNU long option names are understood. Since all option names for
make2cook are long, this means ignoring the extra leading ’-’. The
"--option=value" convention is also understood.
The make2cook command will exit with a status of 1 on any error. The
make2cook command will only exit with a status of 0 if there are no
make2cook version 2.33
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Peter Miller
The make2cook program comes with ABSOLUTELY NO WARRANTY; for details
use the ’make2cook -VERSion License’ command. This is free software
and you are welcome to redistribute it under certain conditions; for
details use the ’make2cook -VERSion License’ command.
Peter Miller E-Mail: firstname.lastname@example.org
/\/\* WWW: http://miller.emu.id.au/pmiller/