107 |
bj |
1 |
The Makefile, Project and Workspace Creator.
|
|
|
2 |
Designed by Justin Michel (michel_j@ociweb.com) and Chad Elliott.
|
|
|
3 |
Implemented by Chad Elliott (elliott_c@ociweb.com).
|
|
|
4 |
|
|
|
5 |
A single tool (MPC) can be used to generate tool specific input (i.e.
|
|
|
6 |
Makefile, dsp, vcproj, etc). The generator takes platform and building
|
|
|
7 |
tool generic files (mpc files) as input which describe basic information
|
|
|
8 |
needed to generate a "project" file for various build tools. These tools
|
|
|
9 |
include Make, NMake, Visual C++ 6, Visual C++ 7, etc.
|
|
|
10 |
|
|
|
11 |
One of the many unique and useful features of the Makefile, Project and
|
|
|
12 |
Workspace Creator is that the project definition files can employ the idea
|
|
|
13 |
of inheritance. This feature allows a user to set up a basic base project
|
|
|
14 |
(mpb file) that can contain information that is applicable to all
|
|
|
15 |
sub-projects. Things such as include paths, library paths and inter-project
|
|
|
16 |
dependencies could be described in this base project and any project that
|
|
|
17 |
inherits from it would contain this information as well.
|
|
|
18 |
|
|
|
19 |
Another set of files, known as template input files (mpd files), provides
|
|
|
20 |
the generator with the necessary information to fill platform and build tool
|
|
|
21 |
specific information for dynamic and static library and binary executable
|
|
|
22 |
projects.
|
|
|
23 |
|
|
|
24 |
Together, the generic input files and the template input files are applied
|
|
|
25 |
toward a platform and build specific template (mpd file) to create the final
|
|
|
26 |
product (a build tool specific input file). These templates contain
|
|
|
27 |
"variables" that are filled in by the project creator with information
|
|
|
28 |
gathered through the mpc and mpd files and possibly by default values set
|
|
|
29 |
within the template itself.
|
|
|
30 |
|
|
|
31 |
Workspaces are defined by providing a list of mpc files in a single (mwc)
|
|
|
32 |
file. For each mpc file specified, the workspace creator (mwc.pl) calls
|
|
|
33 |
upon the project creator to generate the project. After all of the projects
|
|
|
34 |
are successfully generated, the tool specific workspace is generated
|
|
|
35 |
containing the projects and any defined inter-project dependency information
|
|
|
36 |
(if supported by the build tool). If no workspace files are provided to the
|
|
|
37 |
workspace creator, then the current directory is traversed and any mpc files
|
|
|
38 |
located will be part of the workspace that is generated.
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
Workspace Declarations
|
|
|
42 |
----------------------
|
|
|
43 |
|
|
|
44 |
workspace(workspace_name) {
|
|
|
45 |
file.mpc
|
|
|
46 |
directory
|
|
|
47 |
relative/path/to/another/mwc_file
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
Workspaces can contain individual mpc files, directories or other mwc files.
|
|
|
51 |
In the case of a directory, the workspace creator will traverse it and use
|
|
|
52 |
any mpc files that are found. If another workspace file is listed in the
|
|
|
53 |
workspace files, it will be aggregated into the workspace with paths relative
|
|
|
54 |
to the directory in which the main workspace is found. These "aggregated"
|
|
|
55 |
workspaces should not inherit from any other base workspace. The workspace
|
|
|
56 |
files should have an 'mwc' extension.
|
|
|
57 |
|
|
|
58 |
You can exclude directories from a workspace using the 'exclude' scope
|
|
|
59 |
operator:
|
|
|
60 |
|
|
|
61 |
workspace {
|
|
|
62 |
dir1
|
|
|
63 |
dir2
|
|
|
64 |
|
|
|
65 |
// exclude this_dir for all project types
|
|
|
66 |
exclude {
|
|
|
67 |
dir2/this_dir
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
// exclude other_dir for vc6, vc71 and vc8 types
|
|
|
71 |
exclude(vc6, vc71, vc8) {
|
|
|
72 |
dir2/other_dir
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
// exclude unix_only for every type except gnuace and make
|
|
|
76 |
exclude(!gnuace, !make) {
|
|
|
77 |
dir2/unix_only
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
dir3
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
Project Declarations
|
|
|
85 |
--------------------
|
|
|
86 |
|
|
|
87 |
project(project_name) : baseproject, anotherbaseproject {
|
|
|
88 |
exename = foo
|
|
|
89 |
includes += "."
|
|
|
90 |
libpaths = directory
|
|
|
91 |
|
|
|
92 |
Source_Files {
|
|
|
93 |
file1.cpp
|
|
|
94 |
file2.cpp
|
|
|
95 |
.
|
|
|
96 |
.
|
|
|
97 |
fileN.cpp
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
Header_Files {
|
|
|
101 |
file1.h
|
|
|
102 |
file2.h
|
|
|
103 |
.
|
|
|
104 |
.
|
|
|
105 |
fileN.h
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
When listing files within components (Source_Files, Header_Files, etc.), you
|
|
|
111 |
can use wild cards (*?[]) to include groups of files as can be done in shells.
|
|
|
112 |
You can exclude files by preceding the name (or wild card) with the '!', but
|
|
|
113 |
this sort of exclusion only pertains to files that exist in the directory at
|
|
|
114 |
the time of project generation. There is an additional syntax similar to
|
|
|
115 |
the '!' ('^') which works the same as the '!' except that after all of the
|
|
|
116 |
source files are added to the list (after automatic custom generated files
|
|
|
117 |
are added) these files are explicitly removed from the list.
|
|
|
118 |
|
|
|
119 |
The (project_name) part of the project declaration is optional. If it is
|
|
|
120 |
left off, the project name will default to the name of the mpc file without
|
|
|
121 |
the extension. Inheritance is optional.
|
|
|
122 |
|
|
|
123 |
If the project name or workspace name contains an asterisk (*) then the
|
|
|
124 |
default project (workspace) name will be used in its place. For example, if
|
|
|
125 |
the mpc file is named example.mpc and it contains the following:
|
|
|
126 |
|
|
|
127 |
project(*client) {
|
|
|
128 |
|
|
|
129 |
The project name will be example_client. If the any part of the modified
|
|
|
130 |
project (workspace) name contains a capital letter then each word will be
|
|
|
131 |
capitalized. For instance, if the above mpc file example was named
|
|
|
132 |
Example.mpc, then the modified project name would be Example_Client.
|
|
|
133 |
|
|
|
134 |
If the value set for exename contains an asterisk then the asterisk portion
|
|
|
135 |
of the name will be replaced with the current project name. The same logic
|
|
|
136 |
applies to sharedname and staticname.
|
|
|
137 |
|
|
|
138 |
If multiple projects are going to be contained within a single workspace
|
|
|
139 |
(using mwc.pl), there can be no duplication of project names. This is
|
|
|
140 |
disallowed due to limitations of some workspace tools.
|
|
|
141 |
|
|
|
142 |
Project Keywords
|
|
|
143 |
----------------
|
|
|
144 |
exename Specifies the name of the executable that will be created
|
|
|
145 |
sharedname Specifies the name of the shared library that will be created
|
|
|
146 |
staticname Specifies the name of the static library that will be created
|
|
|
147 |
dllout If defined, specifies where the dynamic libraries will be
|
|
|
148 |
placed. This overrides libout in the dynamic case.
|
|
|
149 |
libout Specifies where the dynamic and static libraries will be placed
|
|
|
150 |
install Specifies where executables will be installed
|
|
|
151 |
pch_header Specifies the precompiled header file name
|
|
|
152 |
pch_source Specifies the precompiled source file name
|
|
|
153 |
postbuild If this is defined in the project, the value will be
|
|
|
154 |
interpreted as commands to run after the project has been
|
|
|
155 |
successfully built. The <%..%> construct can be used within
|
|
|
156 |
this value to access template variables and functions of the
|
|
|
157 |
template parser. In addition, the following pseudo variables
|
|
|
158 |
can be used.
|
|
|
159 |
|
|
|
160 |
<%cat%> - Platform non-specific command to cat a file.
|
|
|
161 |
<%cp%> - Platform non-specific copy command.
|
|
|
162 |
<%mkdir%> - Platform non-specific mkdir command.
|
|
|
163 |
<%mv%> - Platform non-specific move command.
|
|
|
164 |
<%rm%> - Platform non-specific delete command.
|
|
|
165 |
<%nul%> - Platform non-specific null device.
|
|
|
166 |
<%gt%> - Project non-specific greater than sign.
|
|
|
167 |
<%lt%> - Project non-specific less than sign.
|
|
|
168 |
<%and%> - Project non-specific and sign.
|
|
|
169 |
<%or%> - Project non-specific or sign.
|
|
|
170 |
<%quote%> - Project non-specific double quote.
|
|
|
171 |
|
|
|
172 |
recurse If set to 1, MPC will recurse into directories listed under
|
|
|
173 |
component listings and add any component corresponding files
|
|
|
174 |
to the list. This keyword can be used as a global project
|
|
|
175 |
setting or a component scoped setting.
|
|
|
176 |
version Specifies the version number for the library or executable
|
|
|
177 |
macros These values will be passed as macros to the compiler.
|
|
|
178 |
libpaths Specifies 1 or more locations to find libraries
|
|
|
179 |
includes Specifies 1 or more locations to find include files
|
|
|
180 |
libs Specifies 1 or more libraries to link into the exe or library
|
|
|
181 |
lit_libs Specifies 1 or more libraries to link into the exe or library.
|
|
|
182 |
If libraries receive a library decorator, then these will not.
|
|
|
183 |
pure_libs Specifies 1 or more libraries to link into the exe or library.
|
|
|
184 |
If libraries receive a library decorator, then these will not.
|
|
|
185 |
If libraries receive a file extension, then these will not.
|
|
|
186 |
after Specifies that this project must be built after 1 or more
|
|
|
187 |
project names listed.
|
|
|
188 |
custom_only Create a project that contains only custom generation
|
|
|
189 |
targets (any file type described by a Define_Custom section).
|
|
|
190 |
dynamicflags Specifies preprocessor flags needed for dynamic libraries
|
|
|
191 |
staticflags Specifies preprocessor flags needed for static libraries
|
|
|
192 |
|
|
|
193 |
verbatim This allows arbitrary information to be place in a generated
|
|
|
194 |
project file. The syntax is as follows:
|
|
|
195 |
|
|
|
196 |
verbatim(<project type>, <location>) {
|
|
|
197 |
..
|
|
|
198 |
..
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
When MPC is generating a project of type <project type> and
|
|
|
202 |
comes upon a marker that matches the <location> name, it
|
|
|
203 |
will place the text found inside the construct directly into
|
|
|
204 |
the generated project. If you need to preserve white space,
|
|
|
205 |
the line or lines should be placed inside double quotes.
|
|
|
206 |
|
|
|
207 |
specific This scope allows assignments that are specific to a
|
|
|
208 |
particular project type. The syntax is as follows:
|
|
|
209 |
|
|
|
210 |
specific(<project type> [, <project type> ...]) {
|
|
|
211 |
lit_libs += c
|
|
|
212 |
...
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
or
|
|
|
216 |
|
|
|
217 |
specific(<project type> [, <project type> ...]) {
|
|
|
218 |
lit_libs += c
|
|
|
219 |
...
|
|
|
220 |
} else {
|
|
|
221 |
list_libs += c_other
|
|
|
222 |
...
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
If the else is provided, it is required to be on
|
|
|
226 |
the same line as the closing curly brace. You may
|
|
|
227 |
also negate the project type (using '!') which will cause
|
|
|
228 |
the specific to be evaluated for all types except the type
|
|
|
229 |
specified.
|
|
|
230 |
|
|
|
231 |
If a keyword is not recognized as a valid MPC keyword, it is
|
|
|
232 |
interpreted as a template value modifier. In this
|
|
|
233 |
situation, this construct has the exact same restrictions as
|
|
|
234 |
the -value_template command line option. See the USAGE file
|
|
|
235 |
for more information.
|
|
|
236 |
|
|
|
237 |
conditional This scope allows addition of source files conditionally
|
|
|
238 |
based on a particular project type. The syntax is as
|
|
|
239 |
follows:
|
|
|
240 |
|
|
|
241 |
conditional(<project type> [, <project type> ...]) {
|
|
|
242 |
source1.cpp
|
|
|
243 |
...
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
or
|
|
|
247 |
|
|
|
248 |
conditional(<project type> [, <project type> ...]) {
|
|
|
249 |
source1.cpp
|
|
|
250 |
...
|
|
|
251 |
} else {
|
|
|
252 |
source2.cpp
|
|
|
253 |
...
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
If the else is provided, it is required to be on
|
|
|
257 |
the same line as the closing curly brace. You may
|
|
|
258 |
also negate the project type (using '!') which will cause
|
|
|
259 |
the conditional to be evaluated for all types except the
|
|
|
260 |
type specified.
|
|
|
261 |
|
|
|
262 |
requires Specifies which features should be enabled in order to
|
|
|
263 |
generate the project file.
|
|
|
264 |
avoids Specifies which features should be disabled in order to
|
|
|
265 |
generate the project file.
|
|
|
266 |
|
|
|
267 |
Custom File Definitions
|
|
|
268 |
-----------------------
|
|
|
269 |
In order to support a variety of custom build rules, MPC allows you to
|
|
|
270 |
define your own custom file types. Below is an example of a custom
|
|
|
271 |
definition.
|
|
|
272 |
|
|
|
273 |
project {
|
|
|
274 |
Define_Custom(MOC) {
|
|
|
275 |
automatic = 0
|
|
|
276 |
command = $(QTDIR)/bin/moc
|
|
|
277 |
postcommand = echo <%quote%>#include <%lt%>some.h<%gt%><%quote%> <%gt%> <%temporary%> <%and%> \
|
|
|
278 |
<%cat%> <%output%> <%gt%><%gt%> <%temporary%> <%and%> \
|
|
|
279 |
<%mv%> <%temporary%> <%output%>
|
|
|
280 |
output_option = -o
|
|
|
281 |
inputext = .h
|
|
|
282 |
pre_extension = _moc
|
|
|
283 |
source_outputext = .cpp
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
MOC_Files {
|
|
|
287 |
QtReactor.h
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
Source_Files {
|
|
|
291 |
QtReactor_moc.cpp
|
|
|
292 |
}
|
|
|
293 |
}
|
|
|
294 |
|
|
|
295 |
The above example defines a custom file type "MOC" which describes basic
|
|
|
296 |
information about how to process the input files and what output files are
|
|
|
297 |
created. Once the custom file type is defined, MOC_Files can be defined in
|
|
|
298 |
order to specify the input files for this new file type.
|
|
|
299 |
|
|
|
300 |
Here is a list of keywords that can be used within the scope of
|
|
|
301 |
Define_Custom:
|
|
|
302 |
|
|
|
303 |
automatic If set to 1, then attempt to automatically determine
|
|
|
304 |
which files belong to the set of input files for the
|
|
|
305 |
custom type. If set to 0, then no files are
|
|
|
306 |
automatically added to the input files. If omitted,
|
|
|
307 |
then automatic is assumed to be 1. Custom file types
|
|
|
308 |
that are automatic will have the side effect of possibly
|
|
|
309 |
adding files to Source_Files, Inline_Files, Header_Files
|
|
|
310 |
Template_Files, Resource_Files and Documentation_Files
|
|
|
311 |
depending on which extension types the command generates.
|
|
|
312 |
dependent If this is given a value, then a dependency upon that
|
|
|
313 |
value will be given to all of the generated files.
|
|
|
314 |
The default for this is unset and no dependency will be
|
|
|
315 |
generated.
|
|
|
316 |
command The name of the command that should be used to process
|
|
|
317 |
the input files for the custom type.
|
|
|
318 |
commandflags Any options that should be passed to the command go here.
|
|
|
319 |
inputext This is a comma separated list of input file extensions
|
|
|
320 |
that belong to the command.
|
|
|
321 |
keyword This is a special assignment that takes the form of the
|
|
|
322 |
following:
|
|
|
323 |
|
|
|
324 |
keyword newname = existing_custom_name
|
|
|
325 |
|
|
|
326 |
This has the effect of mapping newname to be the
|
|
|
327 |
same as existing_custom_name. existing_custom_name,
|
|
|
328 |
which is optional, corresponds to one of the keywords
|
|
|
329 |
available within a Define_Custom scope (except for
|
|
|
330 |
keyword). This function puts newname into the project
|
|
|
331 |
level scope such that it can be used outside of the
|
|
|
332 |
scope of the particular custom file type being defined.
|
|
|
333 |
It should be noted that the mapped keywords can not be
|
|
|
334 |
used within the scope of a 'specific' clause. It does
|
|
|
335 |
not cause an error, but it has absolutely no affect.
|
|
|
336 |
If existing_custom_name is not supplied, then the only
|
|
|
337 |
way to utilize the newname value is from within the
|
|
|
338 |
template code. ex. <%newname%>
|
|
|
339 |
libpath If the command requires an additional library path, add
|
|
|
340 |
it here.
|
|
|
341 |
output_option If the command takes an option to specify only a single
|
|
|
342 |
file output name, then set it here. Otherwise, this
|
|
|
343 |
should be omitted.
|
|
|
344 |
pch_postrule If this is set to 1, then a rule will be added to the
|
|
|
345 |
custom rule that will modify the source output files to
|
|
|
346 |
include the precompiled header file.
|
|
|
347 |
postcommand Allows a user to execute arbitrary commands after
|
|
|
348 |
the main command is run to generate the output file.
|
|
|
349 |
The following pseudo variables can be accessed from
|
|
|
350 |
within the postcommand assignment:
|
|
|
351 |
<%input%> - The input file for the original command.
|
|
|
352 |
<%output%> - The output created by the original command.
|
|
|
353 |
<%input_basename%> - The basename of the input file.
|
|
|
354 |
<%input_noext%> - The input file with no extension.
|
|
|
355 |
<%output_basename%> - The basename of the output file.
|
|
|
356 |
<%output_noext%> - The output file with no extension.
|
|
|
357 |
The output file can be referenced as a generic output
|
|
|
358 |
file using <%output%> or can be referenced as a
|
|
|
359 |
component file (if it matches the particular type)
|
|
|
360 |
using one of the following:
|
|
|
361 |
|
|
|
362 |
<%source_file%>
|
|
|
363 |
<%template_file%>
|
|
|
364 |
<%header_file%>
|
|
|
365 |
<%inline_file%>
|
|
|
366 |
<%documentation_file%>
|
|
|
367 |
<%resource_file%>
|
|
|
368 |
|
|
|
369 |
The output file without an extension can be referenced
|
|
|
370 |
as a generic output file using <%output_noext%> or can
|
|
|
371 |
be referenced as a component file (if it matches the
|
|
|
372 |
particular type) using one of the following:
|
|
|
373 |
|
|
|
374 |
<%source_file_noext%>
|
|
|
375 |
<%template_file_noext%>
|
|
|
376 |
<%header_file_noext%>
|
|
|
377 |
<%inline_file_noext%>
|
|
|
378 |
<%documentation_file_noext%>
|
|
|
379 |
<%resource_file_noext%>
|
|
|
380 |
|
|
|
381 |
The following are also available for use within the
|
|
|
382 |
postcommand setting. They return the extension (if
|
|
|
383 |
there is any) of the input and output files
|
|
|
384 |
respectively:
|
|
|
385 |
|
|
|
386 |
<%input_ext%>
|
|
|
387 |
<%output_ext%>
|
|
|
388 |
|
|
|
389 |
The following pseudo template variables are valid for
|
|
|
390 |
use within the command, commandflags, dependent,
|
|
|
391 |
postcommand and output_option settings:
|
|
|
392 |
|
|
|
393 |
<%temporary%> - A temporary file name.
|
|
|
394 |
<%cat%> - Platform non-specific command to cat a file.
|
|
|
395 |
<%cp%> - Platform non-specific copy command.
|
|
|
396 |
<%mkdir%> - Platform non-specific mkdir command.
|
|
|
397 |
<%mv%> - Platform non-specific move command.
|
|
|
398 |
<%rm%> - Platform non-specific delete command.
|
|
|
399 |
<%nul%> - Platform non-specific null device.
|
|
|
400 |
<%gt%> - Project non-specific greater than sign.
|
|
|
401 |
<%lt%> - Project non-specific less than sign.
|
|
|
402 |
<%and%> - Project non-specific and sign.
|
|
|
403 |
<%or%> - Project non-specific or sign.
|
|
|
404 |
<%quote%> - Project non-specific double quote.
|
|
|
405 |
|
|
|
406 |
If any referenced pseudo template variable does
|
|
|
407 |
not contain a value, then the particular setting
|
|
|
408 |
(command, commandflags, dependent, postcommand or
|
|
|
409 |
output_option) will not be used.
|
|
|
410 |
pre_extension If the command produces multiple files of the same
|
|
|
411 |
extension, this comma separated list can be used to
|
|
|
412 |
specify them. For example, tao_idl creates two types of
|
|
|
413 |
files per extension (C.h, S.h, C.cpp, S.cpp, etc).
|
|
|
414 |
source_pre_extension This is the same as pre_extension except that it
|
|
|
415 |
only applies to source_outputext.
|
|
|
416 |
inline_pre_extension This is the same as pre_extension except that it
|
|
|
417 |
only applies to inline_outputext.
|
|
|
418 |
header_pre_extension This is the same as pre_extension except that it
|
|
|
419 |
only applies to header_outputext.
|
|
|
420 |
template_pre_extension This is the same as pre_extension except that it
|
|
|
421 |
only applies to template_outputext.
|
|
|
422 |
resource_pre_extension This is the same as pre_extension except that it
|
|
|
423 |
only applies to resource_outputext.
|
|
|
424 |
documentation_pre_extension This is the same as pre_extension except that it
|
|
|
425 |
only applies to documentation_outputext.
|
|
|
426 |
pre_filename This is similar to pre_extension except that the values
|
|
|
427 |
are prepended to the file name instead of the extension.
|
|
|
428 |
source_pre_filename This is the same as pre_filename except that it
|
|
|
429 |
only applies to source_outputext.
|
|
|
430 |
inline_pre_filename This is the same as pre_filename except that it
|
|
|
431 |
only applies to inline_outputext.
|
|
|
432 |
header_pre_filename This is the same as pre_filename except that it
|
|
|
433 |
only applies to header_outputext.
|
|
|
434 |
template_pre_filename This is the same as pre_filename except that it
|
|
|
435 |
only applies to template_outputext.
|
|
|
436 |
resource_pre_filename This is the same as pre_filename except that it
|
|
|
437 |
only applies to resource_outputext.
|
|
|
438 |
documentation_pre_filename This is the same as pre_filename except that it
|
|
|
439 |
only applies to documentation_outputext.
|
|
|
440 |
source_outputext This is a comma separated list of possible source file
|
|
|
441 |
output extensions. If the command does not produce
|
|
|
442 |
source files, then this can be omitted.
|
|
|
443 |
inline_outputext This is a comma separated list of possible inline file
|
|
|
444 |
output extensions. If the command does not produce
|
|
|
445 |
inline files, then this can be omitted.
|
|
|
446 |
header_outputext This is a comma separated list of possible header file
|
|
|
447 |
output extensions. If the command does not produce
|
|
|
448 |
header files, then this can be omitted.
|
|
|
449 |
template_outputext This is a comma separated list of possible template file
|
|
|
450 |
output extensions. If the command does not produce
|
|
|
451 |
template files, then this can be omitted.
|
|
|
452 |
resource_outputext This is a comma separated list of possible resource file
|
|
|
453 |
output extensions. If the command does not produce
|
|
|
454 |
resource files, then this can be omitted.
|
|
|
455 |
documentation_outputext This is a comma separated list of possible
|
|
|
456 |
documentation file output extensions. If the
|
|
|
457 |
command does not produce documentation files, then
|
|
|
458 |
this can be omitted.
|
|
|
459 |
generic_outputext If the command does not generate any of the other output
|
|
|
460 |
types listed above, then the extensions should be listed
|
|
|
461 |
under this.
|
|
|
462 |
|
|
|
463 |
If the custom output can not be represented with the above output extension
|
|
|
464 |
keywords (*_outputext) and you have knowledge of the output files a priori,
|
|
|
465 |
you can represent them with the '>>' construct.
|
|
|
466 |
|
|
|
467 |
Below is an example that demonstrates the use of '>>'. The command takes an
|
|
|
468 |
input file name of foo.prp and produces two files that have completely
|
|
|
469 |
unrelated filenames (i.e. foo !~ hello).
|
|
|
470 |
|
|
|
471 |
project {
|
|
|
472 |
Define_Custom(Quogen) {
|
|
|
473 |
automatic = 0
|
|
|
474 |
command = perl quogen.pl
|
|
|
475 |
commandflags = --debuglevel=1 --language=c++ \
|
|
|
476 |
--kernel_language=c++
|
|
|
477 |
inputext = .prp
|
|
|
478 |
keyword quogenflags = commandflags
|
|
|
479 |
}
|
|
|
480 |
|
|
|
481 |
Quogen_Files {
|
|
|
482 |
foo.prp >> hello.h hello.cpp
|
|
|
483 |
}
|
|
|
484 |
|
|
|
485 |
Source_Files {
|
|
|
486 |
hello.cpp
|
|
|
487 |
}
|
|
|
488 |
}
|
|
|
489 |
|
|
|
490 |
You can use the '<<' construct to represent dependencies for specific custom
|
|
|
491 |
input file. For instance, in the above example, assume that foo.prp depends
|
|
|
492 |
upon foo.in, we would represent this by adding << foo.in as shown below.
|
|
|
493 |
|
|
|
494 |
Quogen_Files {
|
|
|
495 |
foo.prp >> hello.h hello.cpp << foo.in
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
There is a construct that can be used within a Define_Custom section
|
|
|
499 |
called 'optional' and can be used to represent optional custom output
|
|
|
500 |
dependent upon particular command line parameters passed to the custom
|
|
|
501 |
command.
|
|
|
502 |
|
|
|
503 |
project {
|
|
|
504 |
Define_Custom(TEST) {
|
|
|
505 |
optional(keyword) {
|
|
|
506 |
flag_keyword(option) += value [, value]
|
|
|
507 |
}
|
|
|
508 |
}
|
|
|
509 |
}
|
|
|
510 |
|
|
|
511 |
In the above example, keyword can be any of the pre_extension, pre_filename
|
|
|
512 |
or keywords that end in _outputext. flag_keyword can be any of the custom
|
|
|
513 |
definition keywords, however only commandflags really make any sense.
|
|
|
514 |
Inside the parenthesis, the flag_keyword value is searched for the 'option'
|
|
|
515 |
value. If it is found, then the 'value' after the += is added to the list
|
|
|
516 |
specified by 'keyword'. This can also be negated by prefixing 'option' with
|
|
|
517 |
an exclamation point (!).
|
|
|
518 |
|
|
|
519 |
project {
|
|
|
520 |
Define_Custom(IDL) {
|
|
|
521 |
source_pre_extension = C, S
|
|
|
522 |
optional(source_pre_extension) {
|
|
|
523 |
commandflags(-GA) += A
|
|
|
524 |
}
|
|
|
525 |
}
|
|
|
526 |
}
|
|
|
527 |
|
|
|
528 |
In the preceding example, the source_pre_extension contains C and S. The
|
|
|
529 |
optional clause can be read as follows: If 'commandflags' contains -GA then
|
|
|
530 |
add A to source_pre_extension.
|
|
|
531 |
|
|
|
532 |
Particular output extensions are not required. However at least one output
|
|
|
533 |
extension type is required in order for MPC to generate a target. Within
|
|
|
534 |
graphical build environments, the custom input file will be listed
|
|
|
535 |
regardless of the presence of an extension definition. In this case, the
|
|
|
536 |
input file will be "excluded" from the build.
|
|
|
537 |
|
|
|
538 |
For custom file types, there are a few keywords that can be used within the
|
|
|
539 |
custom file type input lists: command, commandflags, dependent, gendir and
|
|
|
540 |
postcommand. These keywords (except for gendir) can be used to augment or
|
|
|
541 |
override the values of the same name defined in a Define_Custom section.
|
|
|
542 |
gendir can be used to specify the directory in which the generated
|
|
|
543 |
output will go. Below is an example:
|
|
|
544 |
|
|
|
545 |
MOC_Files {
|
|
|
546 |
commandflags += -nw
|
|
|
547 |
gendir = moc_generated
|
|
|
548 |
QtReactor.h
|
|
|
549 |
}
|
|
|
550 |
|
|
|
551 |
Source_Files {
|
|
|
552 |
moc_generated/QtReactor_moc.cpp
|
|
|
553 |
}
|
|
|
554 |
|
|
|
555 |
In the above example, the generated file (QtReactor_moc.cpp) is placed in
|
|
|
556 |
the moc_generated directory and the -nw option is added to commandflags.
|
|
|
557 |
It should be noted that if the custom file definition does not set the
|
|
|
558 |
output_option then you must provide the necessary options in
|
|
|
559 |
commandflags to ensure that the generated output goes into the directory
|
|
|
560 |
specified by gendir.
|
|
|
561 |
|
|
|
562 |
The following example illustrates the use of the keyword mapping capability
|
|
|
563 |
of the Define_Custom:
|
|
|
564 |
|
|
|
565 |
project {
|
|
|
566 |
Define_Custom(CIDL) {
|
|
|
567 |
automatic = 0;
|
|
|
568 |
command = $(CIAO_ROOT)/bin/cidlc
|
|
|
569 |
commandflags = -I$(TAO_ROOT)/tao -I$(TAO_ROOT)/orbsvcs/orbsvcs --
|
|
|
570 |
inputext = .cidl
|
|
|
571 |
source_outputext = _svnt.cpp
|
|
|
572 |
generic_outputext = E.idl
|
|
|
573 |
|
|
|
574 |
// Allow cidlflags to be used outside the scope of CIDL_Files
|
|
|
575 |
keyword cidlflags = commandflags
|
|
|
576 |
}
|
|
|
577 |
|
|
|
578 |
// This will get added to all commandflags for CIDL_Files
|
|
|
579 |
cidlflags += --some_option
|
|
|
580 |
|
|
|
581 |
CIDL_Files {
|
|
|
582 |
// This will have a combination of the original commandflags plus
|
|
|
583 |
// the value added to cidlflags above.
|
|
|
584 |
file.cidl
|
|
|
585 |
}
|
|
|
586 |
|
|
|
587 |
CIDL_Files {
|
|
|
588 |
// This will have a combination of the original commandflags plus
|
|
|
589 |
// the value added to cidlflags above plus the value added to
|
|
|
590 |
// cidlflags here.
|
|
|
591 |
cidlflags += --another_option
|
|
|
592 |
another_file.cidl
|
|
|
593 |
}
|
|
|
594 |
}
|
|
|
595 |
|
|
|
596 |
Special type of feature project
|
|
|
597 |
-------------------------------
|
|
|
598 |
A feature project contains information as a project would, but can only
|
|
|
599 |
be a base project and will only be added to a sub project if the features
|
|
|
600 |
that it requires (or avoids) are present.
|
|
|
601 |
|
|
|
602 |
A feature definition requires at least one feature name. A name by itself
|
|
|
603 |
specifies that the feature is required. A '!' in front of the feature name
|
|
|
604 |
indicates that the feature must be disabled. There may be more than one
|
|
|
605 |
feature listed between the parenthesis and they must be comma separated.
|
|
|
606 |
|
|
|
607 |
The following feature definition requires that the qt feature be enabled.
|
|
|
608 |
|
|
|
609 |
feature(qt) {
|
|
|
610 |
Define_Custom(MOC) {
|
|
|
611 |
automatic = 0
|
|
|
612 |
command = $(QTDIR)/bin/moc
|
|
|
613 |
output_option = -o
|
|
|
614 |
inputext = .h
|
|
|
615 |
pre_extension = _moc
|
|
|
616 |
source_outputext = .cpp
|
|
|
617 |
}
|
|
|
618 |
|
|
|
619 |
MOC_Files {
|
|
|
620 |
QtSpecific.h
|
|
|
621 |
}
|
|
|
622 |
|
|
|
623 |
Source_Files {
|
|
|
624 |
QtSpecific_moc.cpp
|
|
|
625 |
}
|
|
|
626 |
}
|
|
|
627 |
|
|
|
628 |
Assuming that the above feature definition is stored in a file named
|
|
|
629 |
qt_specific.mpb, an mpc project could inherit from it and would only receive
|
|
|
630 |
the feature definition if the qt feature was enabled.
|
|
|
631 |
|
|
|
632 |
project: qt_specific {
|
|
|
633 |
...
|
|
|
634 |
}
|
|
|
635 |
|
|
|
636 |
|
|
|
637 |
Feature Files
|
|
|
638 |
-------------
|
|
|
639 |
Features are enabled and disable within feature files or through the use of
|
|
|
640 |
the -features option (see USAGE for more details). The first feature file
|
|
|
641 |
read is always global.features found in the config directory. The second
|
|
|
642 |
feature file read is the project type name with .features appended
|
|
|
643 |
(ex. vc71.features, make.features, etc.) which must be located in the same
|
|
|
644 |
directory as the global.features file. Lastly, the file specified by the
|
|
|
645 |
-feature_file option is read if this option is used.
|
|
|
646 |
|
|
|
647 |
Each successive feature file has precedence over the previous. That is,
|
|
|
648 |
if a feature has already been set previously it is overridden. The
|
|
|
649 |
-features option has precedence over feature files.
|
|
|
650 |
|
|
|
651 |
Special Keywords Available to Templates
|
|
|
652 |
---------------------------------------
|
|
|
653 |
project_name This contains the name of the project.
|
|
|
654 |
project_file This contains the name of the output file.
|
|
|
655 |
guid This is used by the VC7 project and workspace creator.
|
|
|
656 |
configurations When used within a foreach context, this info (each
|
|
|
657 |
configuration) is gathered for use with the VC7 workspace
|
|
|
658 |
creator.
|
|
|
659 |
flag_overrides Used to determine flags that have been overridden on a per
|
|
|
660 |
file basis.
|
|
|
661 |
custom_types The list of custom file types that may have been defined
|
|
|
662 |
in the mpc file or a base project.
|
|
|
663 |
fornotlast Insert the text on every foreach iteration except the last.
|
|
|
664 |
forlast Insert the text only on the last foreach iteration.
|
|
|
665 |
fornotfirst Insert the text on every foreach iteration except the first.
|
|
|
666 |
forfirst Insert the text only on the first foreach iteration.
|
|
|
667 |
forcount A one based index number of the foreach iterations.
|
|
|
668 |
|
|
|
669 |
Project Variable and Template Input Variable Interaction
|
|
|
670 |
--------------------------------------------------------
|
|
|
671 |
Project variables and template input variables are separate entities and in
|
|
|
672 |
the context of the TemplateParser, template input variables have precedence
|
|
|
673 |
over project variables.
|
|
|
674 |
|
|
|
675 |
This means that if the project keyword 'libout' is set in an MPC project and
|
|
|
676 |
is set as a template input variable, the template input variable value will
|
|
|
677 |
be used. There are exceptions to this rule. The following list shows the
|
|
|
678 |
project keywords that have their MPC project value appended to the template
|
|
|
679 |
input value (if there is a template input value).
|
|
|
680 |
|
|
|
681 |
libpaths
|
|
|
682 |
includes
|
|
|
683 |
libs
|
|
|
684 |
lit_libs
|
|
|
685 |
pure_libs
|
|
|
686 |
dynamicflags
|
|
|
687 |
staticflags
|
|
|
688 |
requires
|
|
|
689 |
avoids
|
|
|
690 |
macros
|
|
|
691 |
|
|
|
692 |
Workspaces
|
|
|
693 |
----------
|
|
|
694 |
Workspaces (mwc files) can have assignments similar to projects. There are
|
|
|
695 |
currently only two assignments allowed.
|
|
|
696 |
|
|
|
697 |
The first is 'cmdline'. The values given to the cmdline assignment will be
|
|
|
698 |
processed as command line options, but only to the projects that are
|
|
|
699 |
contained within the workspace (or the scope of the assignment). The only
|
|
|
700 |
valid command line options for cmdline are -base, -global, -include, -ti,
|
|
|
701 |
-template, -static, -relative, -notoplevel, -value_template
|
|
|
702 |
and -value_project.
|
|
|
703 |
|
|
|
704 |
The second assignment is 'implicit'. This assignment takes two different
|
|
|
705 |
types of values. It takes a boolean value (0 or 1) to indicate that an
|
|
|
706 |
implicit project should be created in directories that contain no mpc file,
|
|
|
707 |
but contain project related files (source, headers, etc.). The default
|
|
|
708 |
value for implicit is 0. It also takes a character string that represents a
|
|
|
709 |
base project (similar to the -base option). In this case, implicit is
|
|
|
710 |
enabled and each implicitly generate project file will have the base project
|
|
|
711 |
or base projects (when addition is used) when the project is created.
|
|
|
712 |
|
|
|
713 |
Defaulting Behavior
|
|
|
714 |
-------------------
|
|
|
715 |
1) If a project name is not specified
|
|
|
716 |
|
|
|
717 |
it will be defaulted to the name of the mpc file without the extension
|
|
|
718 |
|
|
|
719 |
2) If a particular list is not specified (Source_Files, Header_Files, etc.)
|
|
|
720 |
|
|
|
721 |
all of the files in the directory will be added to the corresponding list
|
|
|
722 |
by extension
|
|
|
723 |
|
|
|
724 |
3) If the custom type is automatic and custom files (ex. idl files) exist in
|
|
|
725 |
the directory and the custom files components (ex. IDL_Files) are left
|
|
|
726 |
defaulted (i.e. not listed) or the custom files components are specified
|
|
|
727 |
and none of the custom generated files are listed in the corresponding
|
|
|
728 |
lists
|
|
|
729 |
|
|
|
730 |
the custom files are added to the custom files component list if they
|
|
|
731 |
weren't specified and all of the (would be) generated files will be added
|
|
|
732 |
to the front of the corresponding lists (source, inline and header lists)
|
|
|
733 |
|
|
|
734 |
4) If files are listed in the Source_Files list and a corresponding header or
|
|
|
735 |
inline file exists
|
|
|
736 |
|
|
|
737 |
the corresponding file will be added to the corresponding list (if it
|
|
|
738 |
isn't already there)
|
|
|
739 |
|
|
|
740 |
5) If a sharedname is specified and staticname is not
|
|
|
741 |
|
|
|
742 |
staticname is assigned the sharedname value (the same applies if
|
|
|
743 |
staticname is specified and sharedname is not)
|
|
|
744 |
|
|
|
745 |
6) If exename is specified then the project target is considered an
|
|
|
746 |
executable. If neither exename, sharedname or staticname are used and
|
|
|
747 |
any of the source files listed contains a language dependent "main", then
|
|
|
748 |
the project target is considered an executable, otherwise it is considered
|
|
|
749 |
a library.
|
|
|
750 |
|
|
|
751 |
7) If pch_header is not specified and a header file matches *_pch.h
|
|
|
752 |
|
|
|
753 |
it is assumed to be the precompiled header file (the same applies to
|
|
|
754 |
pch_source)
|
|
|
755 |
|
|
|
756 |
Processing Order
|
|
|
757 |
----------------
|
|
|
758 |
1) Project file is read
|
|
|
759 |
2) Template input file is read
|
|
|
760 |
3) Template file is read
|
|
|
761 |
4) Output project is written
|