MPC
1

# &mpc;, &mwc;

generate project and workspace files

          &mpc;
          OPTION
          FILE

          &mwc;
          OPTION
          FILE

## DESCRIPTION

`&mpc;` and `&mwc;`, the Makefile, Project and Workspace Creator generate platform and compiler specific files to automate the compilation process (e.g. `GNUmakefile` and `Makefile.am`).

The most common way to use the Make Project Creator is to run the workspace generator (`&mwc;`). This script will generate projects and a single workspace that contains the generated projects. If no input FILE (`.mwc` file) is specified, it will recurse into the directory in which the script was started. It looks for `.mpc` files and generates a project or projects for each one found.

Most of what is stated about `&mwc;` applies to `&mpc;` except that it only generates projects. If an input FILE (`.mpc` file) is not provided, the project creator will attempt to create a default project in the directory from which the script was started.

`-global` file

  specifies the global input file. Values stored within this file are applied to all projects. If not specified, defaults to `config/global.mpb`

`-include` directory

  specifies a directory to search when looking for base projects, template input files and templates. This option can be used multiple times to add directories. Two include directories are used by default (`config` and `templates`)

`-recurse`

  recurse from the current directory and generate from all found input files.

`-ti dll | lib | dll_exe | lib_exe:`file

  specifies the template input file (with no extension) for the specific type, e.g. `-ti dll_exe:vc8exe`. Each project creator has a default template input file for each type of project (`dll_exe`, `lib_exe`, `dll`, `lib`). You can override the default template input file name with the `-ti` option. The file must have a `mpt` extension and must reside within the include search directories. NOTE: the `lib` and the `lib_exe` template input files are only used when MPC is generating static projects

`-hierarchy`

  generate a workspace in a hierarchical fashion. Forces the generation of a hierarchical workspace at each directory level in between the toplevel directory and the location of the `.mpc` file that is being processed. This is the default for `make` based workspace creators. NOTE: This option has no effect when when used with `&mpc;`

`-template` file

  specifies the template name (with no extension). file should have a `.mpd` extension and sit in one of the include search directories. NOTE: The `-template` option overrides the template file for all types specified

`-relative` name=var

  any `$()` variable in an mpc file that is matched to name is replaced by var only if var can be made into a relative path based on the current working directory

`-base` project

  add project as a base project to each generated project file. Do not provide a file extension, the `.mpb` extension will be tried first; if that fails the `.mpc` extension will be tried

`-nocomments`

  do not place comments in the generated files

`-noreldefs`

  do not try to generate default relative definitions for `*_ROOT`, which come from environment variables

`-notoplevel`

  do not generate the top level target file. Files are still processed, but no top level file is created. For `&mwc;`, it says process all projects for a workspace, but do not generate the top level workspace file. For `&mpc;`, it says process the `.mpc` files, but do not generate the project files

`-static`

  specifies that only static projects are generated. By default, only dynamic projects will be generated. This parameter was previously `-static_only`. Currently, `&mpc;` only supports generating dynamic projects or static projects, but not both during the same run. To generate them both you must run `&mpc;` twice, once with the `-static` option and once without. Additionally, the `vc6`, `em3`, `vc7`, `vc71` and `vc8` project names will no longer automatically have `_Static` appended to the project name when generating static projects. This can still be achieved by using the `-name_modifier` option.

  When generating static projects, inter-project dependencies will not be generated for libraries within `vc6`, `em3`, `vc7`, and `vc71` workspaces. The reason is due to the fact that each static library that depended upon another would be combined at the library creation stage, resulting in extremely large libraries. Dependencies are handled correctly by vc8 and later. This behavior can be modified by setting the `MPC_DEPENDENCY_COMBINED_STATIC_LIBRARY` environment variable. It will force `&mpc;` to generate inter-project dependencies for libraries within a single workspace

`-genins`

  generate `.ins` files after processing each project that can be used in conjunction with the `prj_install.pl` script to install different parts of the project (such as header files) into an alternate location

`-use_env`

  use environment variables for all uses of `$()` instead of the relative replacement values

`-value_template` name`+=`val | name`=`val | name`-=`val

  this option allows modification of a template input name pair. Use `+=` to add val to the name's value. Use `-=` to subtract and `=` to override the value. If a template variable value will contain spaces, it is best to enclose the whole setting in double quotes and use single quotes within the value to retain spaces (if it is necessary)

`-value_project` name`+=`val | name`=`val | name`-=`val

  this option allows modification of a project variable assignment. Use `+=` to add val to the name's value. Use `-=` to subtract and `=` to override the value. This can be used to introduce new name value pairs to a project. However, it must be a valid project assignment

`-make_coexistence`

  if multiple `make` based project types are generated, they will be named such that they can coexist

`-feature_file` file

  specifies the features file to read before processing. These feature names can be anything, but they should correspond to values used for the requires and avoids keywords. If a feature is required and is not enabled then the project will not be created. If a feature is to be avoided and it is enabled then the project will not be created. The default feature file is `default.features` under the `config` directory

`-expand_vars`

  perform direct expansion, instead of performing relative replacement with either `-use_env` or `-relative` options

`-features` features

  specifies the feature list to set before processing. Values specified by this option overwrite values from features files, e.g. `-features "qos=1,ssl=0"`

`-gendot`

  generate .dot files for use with `Graphvis`. This option, which is only useful with `&mwc;`, will result in the generation of .dot files for each workspace processed. Each .dot file will contain information that can be fed to Graphvis to display the dependency information for the various projects found within the workspace.

`-exclude` directories

  use this option to exclude directories or files when searching for input files. NOTE: This option has no effect when used with `&mpc;`

`-name_modifier` pattern

  modify generated workspace or project names. The pattern passed to this parameter will have the `*` portion replaced with the actual output name. For example `-name_modifier '*_Static'` will result in all workspace and project names ending in `_Static`, e.g. `FOO_Static.dsw` and `FOO_Static.dsp`

`-apply_project`

  when used in conjunction with `-name_modifier`, it applies the name modifier to the project name also. NOTE: this option has no effect without the `-name_modifier` option

`-workers`

  Specifies number of child processes to use to generate projects.

`-workers_dir`

  The directory for storing temporary output files from the child processes. The default is '/tmp/mpc' If neither -workers_dir nor -workers_port is used, -workers_dir is assumed.

`-workers_port`

  The port number for the parent listener.

`-version`

  print the MPC version and exit

`-into` directory

  place all output files in a mirrored directory structure starting at directory

`-gfeature_file` file

  specifies the global feature file. The default value is `global.features` under the `config` directory

`-language cplusplus | csharp | java | vb`

  specify the language preference. The default is `cplusplus`

`-type automake | bcb2007 | bcb2009 | bds4 | bmake | cc | em3 | ghs | html | make | nmake | sle | vc6 | vc7 | vc71 | vc8 | vc9 | vc10 | wb26`

  specifies the type of project file to generate. This option can be used multiple times to generate multiple types. There is no longer a default. NOTE: The `-ti` option overrides the template input file for all types specified

### MPC Codebase Configuration File

This configuration file can be used to specify alternate locations for the MPC Configuration File. If a base.cfg is found underneath the 'config' directory where MPC is executed, it will be read to determine the location of MPC.cfg based on the directory in which MPC was started.

For example, if $MPC_ROOT/mwc.pl is run under /foo/bar_root/src and $MPC_ROOT/config/base.cfg contained:

/foo/bar_root = /foo/bar_root/MPC/config

MPC would attempt to open and read /foo/bar_root/MPC/config/MPC.cfg as the MPC Configuration File. If the base configuration file is not present, MPC will try to use $MPC_ROOT/config/MPC.cfg as the MPC Configuration File.

You may reference environment variables, accessed by $NAME, on either side of the equals sign.

### MPC Configuration File

In an effort to move away from the use of environment variables, a configuration file has been introduced. The configuration file (MPC.cfg) can contain settings to provide command line options, control logging and direct MPC to dynamic project types.

The following keywords are allowed in the configuration file, which will be read from the 'config' directory of MPC.

`command_line`

  provide additional command line options to MPC. The value of this setting will be prepended to the options passed to `&mwc;` or `&mpc;`

`default_type`

  provide a single project type (as specified by the -type option) as the default project type

`dynamic_types`

  this comma separated list points to directories in which MPC will search for Perl modules to implement additional MPC project types, base projects or template files. This setting can be used to augment or replace functionality in MPC. For each suitable directory found, it will add a modules include path for Perl to find modules, add a config include path to locate base projects and a template include path to find MPC templates.

`includes`

  similar to the -include command line option, it adds the list of comma separated paths to the MPC include search paths.

`logging`

  if this setting contains info=1, informational messages will be printed. If it contains warn=1, warning messages will be printed. If it contains diag=1, diagnostic messages will be printed. If it contains debug=1, debug messages will be printed. And lastly, if it contains detail=1, detail messages will be printed. If it contains none of these, `&mpc;` will not print out any information or warnings when processing projects or workspaces. Errors are always printed if any are encountered.

`verbose_ordering`

  if this is set, `&mwc;` will warn the user about references to projects in the after keyword that have not been processed

### ENVIRONMENT VARIABLES

The following environment variable could affect `&mwc;` and `&mpc;`:

`MPC_DEPENDENCY_COMBINED_STATIC_LIBRARY`

  see the help on `-static` parameter above

`MPC_GHS_UNIX`

  this environment variable is only meaningful when generating the ghs project files. By default, the ghs type assumes that it is for Windows. If this is not the case, set this environment variable prior to running MPC