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