Content-type: text/html
The mgen.config file is a configuration file for the 'MakeGENerator'. mgen.config contains configuration information for the 'MakeGENerator', which is used in order to control the content of the generated Makefile. The mgen.config file does not need to contain all the supported configuration parameters. All the 'MakeGENerator' configuration parameters are initialised to their default values, prior to reading any configuration file. The default values of the configuration parameters can be seen by issuing the mgen-gcc -h command.
The file contains different formats for parameters, due to the different nature of the parameters. Some of the parameters describe macros, some are aliases, some dascribe pathes, files etc. In the next sections we will describe the format of each of parameters.
Here is where you define the value of the MGEN_BASE_WD macro, as a full path to the upper working directory, using "full", or as a relative path, to the upper working directory ("..") using "uwd".
Example:
base-working-directory uwd
or
The 'MakeGENerator' has a mechanism to define macros, that can be used for defining other macros, define pathes, or, be used elsewhere in the generated Makefile. The exact format of a macro definition line is:
[-|+]define-macro <MACRO_NAME> = <value>
where <value> can be based on other macros.
Examples:
-define-macro MGEN_OBJECTS_DIR = obj
or
+define-macro MGEN_TARGET_DIR = $(MGEN_OBJECTS_DIR)
If you define an already defined macro, the new definition will replace the old one.
Macro definition lines beginning with a minus sign are used in order to undefine all existing macro definitions, and re-apply default macros.
MGEN_OBJECTS_DIR is used for specifying where all object files will reside.
MGEN_TARGET_DIR is used for specifying where the primary target image will reside.
MGEN_TARGET_NAME is used for specifying the name of the primary target file.
MGEN_CLEAN is used for specifying the name of the 'clean:' node.
MGEN_REBUILD is used for specifying the name of the 'rebuild:' node.
MGEN_DEPEND is used for specifying the name of the 'depend:' node.
MGEN_OBJ_GROUP is used for specifying the name of the 'object group' macro.
MGEN_RM is used for specifying the 'file delete' command.
MGEN_MKDIR is used for specifying the 'create directory' command.
By default, the 'MakeGENerator' defines a macro named 'MGEN_INCLUDE_PATH' in the generated Makefile. This macro is a concatination of all the relevant pathes, each prefixed by an <include-path-prefix> and followed by an <include-path-suffix>. These values default to "-I" and to a space, accordingly, by default. Defining these macros is usefull for the compile command as in
"$(CC) -c $(MGEN_INCLUDE_PATH) file.c"
Examples:
include-path-prefix -I
notice the prefix begins right after the first space following the 'include-path-prefix' directive.
include-path-suffix [space]
notice the suffix begins right after the first space following the 'include-path-suffix' directive.
Here is where you define which macros you would like to be generated automatically, by the 'MakeGENerator'.
The following macros can be generated for you by the 'MakeGENerator':
MGEN_OBJECTS is a list of the object files in this makefile
MGEN_INCLUDE_PATH is a list of the include pathes
MGEN_PACKAGE_NAME is the package's name
MGEN_SOURCE_FILES is a list of the source files
The exact syntax is
auto-macro <macro-name>[-|+]
Where macro-name is one of MGEN_OBJECTS / MGEN_INCLUDE_PATH / MGEN_PACKAGE_NAME / MGEN_SOURCE_FILES. '-' disables the macro's generation and '+' enables the macro generation.
By default, MGEN_OBJECTS and MGEN_INCLUDE_PATH are generated, and MGEN_PACKAGE_NAME and MGEN_SOURCE_FILES are not.
Here is where you can set general recipes, for compilation, link or
any other activities. These recipes can be used for the extra extentions
defined. When defining a recipe you should specify, on what "page"
will it be located in the "cookbook", or, a recipe number. This will be used later on, when
you choose how to cook object files, for a certain group a source files.
You can specify up to 50 different recipes!
Each recipe can contain several commands, and make advantage of a macro mechanism
defined explicitly for this purpose.
The recipe definition consists of one or more lines, as in the following:
[-|+]define-recipe <recipe-number> <command>
Where a '-' at the beginning of a line means we wish to re-define a recipe, and a '+' means we add a command to an existing one. The <recipe-number> should be a value between 0 and 50.
Supported macros
| Full form | Short macro form | Macro Expansion |
+--------------+--------------------+-------------------+
| \filename | \fn | filename |
| \basename | \bn | basename |
| \extention | \xt | extention |
| \newline | \n | newline |
| \backslash | \bs | backslash |
| | | |
Example:
-define-recipe 1 @ if [ ! -d $(MGEN_OBJECTS_DIR) ]; then mkdir $(MGEN_OBJECTS_DIR); fi
+define-recipe 1 @ echo "Making $(MGEN_OBJECTS_DIR)/\bn.o"
+define-recipe 1 @ echo "From \fn"
+define-recipe 1 @ $(CC) -c \fn $(MGEN_INCLUDE_PATH_1) -o $(MGEN_OBJECTS_DIR)/\bn.o
Note that recipe number 0 is reserved for the commands you wish to run after all object files are generated. This is usually where you wish to place a call for the archiver, or, for the linker.
The search path definition consists of one or more lines, as in the following:
[-|+]define-search-path <path-number> <path>
Where a '-' is used for redefining a certain search path, and a '+' is used for appending to an existing search path.
Example:
In the next example we define 12 and 23 to be two include search path groups.
-define-search-path 12 /usr/include
+define-search-path 12 ../include
-define-search-path 23 /usr/include/X11
+define-search-path 23 ../../include
Here is where you can define general groups, for compilation, link or
any other activity. These groups can be used for the extra extentions
defined. When defining a group you should specify, on what "page"
will it be located in the "groupbook", or a group number. You can specify up to 50
different groups!
For each group you will have to specify the header file include search path index it uses,
what object file extentions are associated with it, what is the recipe number it uses for that
object file creation, should an include search be performed for files in this group, and of course, what files are actually in this group. These files can be specified in one or more lines.
The group definition consists of one or more lines, as in the following:
-define-group <group-number> <path> <objects-extention> <recipe-number> <search-includes?> 0 0 0
and
+define-group <group-number> 0 0 0 <filename>
Example:
-define-group 10 12 o 1 1 0 0 0
and then define file-spec. for these groups, as in
+define-group 10 0 0 0 root.c
+define-group 10 0 0 0 ../dir1/*.c
+define-group 10 0 0 0 ../dir2/somefile.cpp
The dependency definition consists of one or more lines, as in the following:
[-|+]additional-target-dependencies <some-file>
Where a '-' is used for redefining primary target dependency list, and a '+' is used for appending to an existing dependency list.
Example:
-additional-target-dependencies linker_config_file.1
+additional-target-dependencies linker_config_file.2
The following is where you define a list of files that your secondary targets depends upon.
The dependency definition consists of one or more lines, as in the following:
[-|+]additional-object-dependencies <some-file>
Where a '-' is used for redefining secondary target dependency list, and a '+' is used for appending to an existing dependency list.
Example:
-additional-object-dependencies compiler_config_file.1
+additional-object-dependencies compiler_config_file.2
Here is where you can control skipping the generation of some portions of the makefile, which might be usefull, if you need to include it from a different makefile.
The portions you can skip are:
a) The MGEN_BASE_WD macro definition
b) The user defined macros
c) The primary node, also defines the high level dependecies
d) The secondary nodes, also defines the low level dependecies
This capability is controlled by the following definitions:
skip <part-to-skip>[-|+]
Where 'part-to-skip' one of 'mgen-base-wd' or 'user-defined-macros' or 'high-level-dependencies' or 'low-level-dependencies'. The '+' is used for skipping this part, and '-' is used for not skipping it.
Example:
skip mgen-base-wd+
skip user-defined-macros-
skip high-level-dependencies-
skip low-level-dependencies-
Here is where you instruct the 'MakeGENerator' to generate a list of all the missing header files. These files were not found in the appropriate include search path. This list is printed per group of source files, using a common header file include search path.
This capability is controlled by the following definitions:
list-missing-files[-|+]
Where '+' is used for enabling missing file printing, and '-' is used for disabling it.
Example:
Here is where you instruct the 'MakeGENerator' to generate a list of all the header files found in the appropriate include path. This list is printed per group of source files, using a common header file include search path.
This capability is controlled by the following definitions:
list-used-files[-|+]
Where '+' is used for enabling used file printing, and '-' is used for disabling it.
Example:
Here is where you instruct the 'MakeGENerator' to generate a list of all the header files include path. A path will be printed if a header file was included from the directory. This list is printed per group of source files, using a common header file include search path. The purpose of this feature is to shorten the definition of the header include search path.
This capability is controlled by the following definitions:
list-actual-path[-|+]
Where '+' is used for enabling actual include path printing, and '-' is used for disabling it.
Example:
Here is where you instruct the 'MakeGENerator' to if it should generate one of the above Makefile nodes, automatically. The purpose of this feature is to provide the Makefile built-in standard nodes.
depend serves for automatic makefile generation using the "make depend" command.
clean serves for automatic deletion of primary target and secondary targets. The node is created also per group.
rebuild serves for automatic generation of all object files and primary target. The node is created also per group.
obj-group serves for automatic generation of all object files belonging to a certain group. The node is created per group.
This capability is controlled by the following definitions:
auto-node [depend|clean|rebuild|obj-group][-|+]
Where '+' is used for enabling node generation, and '-' is used for disabling it.
Example:
auto-node depend+
auto-node clean+
auto-node rebuild-
auto-node obj-group-
Here is where you instruct the 'MakeGENerator' to generate output that uses the user defined macros, in order to describe file locations throuout the Makefile. If a macro was used in the definition of an include path, or, in the list of files in a certain group, this macro will be used whenever possible in the Makefile.
This capability is controlled by the following definitions:
use-logical-pathes[-|+]
Where '+' is used for enabling the usage of logical pathes, and '-' is used for disabling it.
Example:
use-logical-pathes+
Here is where you instruct the 'MakeGENerator' to generate output that makes sure all filenames are in lowercase.
This flag has relevance only when running under Windows.
This capability is controlled by the following definitions:
use-case-sensitive-filenames[-|+]
Where '+' is used for enabling usage of case sensitive filenames, and '-' is used for disabling it.
Example:
Here is where you instruct the 'MakeGENerator' to generate output, that includes the content of
other makefiles right before the primary target's node. This is usefull when we wish to define other macros, and default rules.
It is possible to define up to 10 such files.
This capability is controlled by the following definitions:
[-|+]import-header some_file.mk
Where '-' is used for redefining the list of files to include, and '+' is used for appending a file to the list of files to include.
Example:
-import-header first_file.mk
+import-header second_file.mk
+import-header third_file.mk
Here is where you instruct the 'MakeGENerator' to generate output, that includes the content of
other makefiles at the end of the generated file. This is usefull when we wish to define additional rules.
It is possible to define up to 10 such files.
This capability is controlled by the following definitions:
[-|+]import-footer some_file.mk
Where '-' is used for redefining the list of files to include, and '+' is used for appending a file to the list of files to include.
Example:
-import-footer almost_last_file.mk
+import-footer last_file.mk
Here is where you instruct the 'MakeGENerator' to generate output that specifies all the dependencies of a file either in one line, or, using one line per dependency item. In the first case the seperator is a space, and in the second it is using a backslash as the last character in the line.
This capability is controlled by the following definitions:
dependency-seperator [nl|spc]
Where 'nl' is used for a single item per line, and 'spc' is used for a space seperator.
Example:
Here is where you can instruct the 'MakeGENerator' to scan only part of the input files, for the '#include' directive. This is done by specifying how many lines to scan in each file. Here we assume all header file inclusions are at the beginning of the file.
This capability is controlled by the following definitions:
lines-to-search <num-of-lines>
Where '0' means scan the whole file, and any other number is the number of lines to scan.
Example:
Here is where you instruct the 'MakeGENerator' to generate the output into the filename that you prefer.
This capability is controlled by the following definitions:
makefiles-name <alternate-filename>
Where the output will be written to the specified filename. If we fail to write to the requested file, we write to the standard output.
Example:
Here is where you instruct the 'MakeGENerator' to save the configuration, which might be gathered from several mgen.config files, into a single file.
This capability is controlled by the following definitions:
save-configuration-file <new-config-filename>
Where the configuration will be written to the specified filename.
Example:
save-configuration-file mgen.config.new
Here is where you instruct the 'MakeGENerator' to generate output with modified names for several macros. That means that instead of using the MGEN_OBJECTS macro in the output file, the 'MakeGENerator' can use a different macro, according to your definition. This mechanism is used for 'aliasing' these macros.
This capability is controlled by the following definitions:
alias <default-macro-name> <macro's alias>
Where 'default-macro-name' could be one of 'MGEN_BASE_WD', or 'MGEN_OBJECTS_DIR', or 'MGEN_PACKAGE_NAME', or 'MGEN_SOURCE_FILES', or 'MGEN_OBJECTS', or 'MGEN_INCLUDE_PATH', or 'MGEN_TARGET_DIR', or 'MGEN_TARGET_NAME', or 'MGEN_DEPEND', or 'MGEN_CLEAN', or 'MGEN_REBUILD' or 'MGEN_OBJ_GROUP'.
Example:
alias MGEN_OBJECTS_DIR PROJECT_OBJ_DIR
The 'MakeGENerator' configuration is very flexible. However, not all configurations make sense. Thus, sometimes generated Makefiles are not very usable. The default values of the configuration parameters are quite reasonable, and could serve as a good start point for any user. Usage of several configuration files is highly recomended.
The 'MakeGENerator' is unable to process #ifdefs, and as such, might try to look for files your compiler won't try to #include, due to the compiler's correct handling of #ifdef.
This man was last updated for version 4.06.04 of the 'MakeGENerator'.
The original 'MakeGENerator' was released in the year 1997, as version 3.65. This version is an evolution of the old version, and this version replaces its successor. However, the configuration of the new version is not compatible with the configuration of the old version.
mgen-gcc(1).
The MakeGENerator was written by Gil Madar (make.generator AT gmail.com).