Detailed explanation of mke file


The old version of MicroStation supports cross-platform development, so its development architecture does not follow the Microsoft system but uses a Unix/Linux like development system, which uses production files rather than registry entries to control the entire project generation process. If you have developed with GCC under Unix or Linux, I believe that this system will have a familiar feel. The following figure is a complete process of generating ma and dll.

The shaded blocks are the source code (with header files, resource files, type files, and C ++ files), which we need to write by hand; rectangular blocks are some executables, including resource compilers, type generators, and MDL library wrappers, C ++ source file compiler, target object linker, etc. Other blocks are generated intermediate files or final files.

The resources in the MDL program are divided into command table resources, dialog resource, message resource, type resource, etc. They are all finally generated into the file ma (ma is the abbreviation of MicroStation Application). These are unique to Bentley, and these resource files must be written in accordance with the prescribed syntax. The process of generating C ++ source files to dynamic link libraries in MDL is the same as the compilation and linking process of ordinary C ++ files which is to invoke the compiler cl.exe under Microsoft VS to generate the obj file and then link the obj file (maybe multiple) into a dll file by invoking the linker link.exe. The almost independent processes of these two parts are controlled by a single mke file.

Below we use the mke file from the previous chapter as a basis to explain in detail the syntax of this production file.

$(mdlapps) $(appName).ma: $(appRscs) 
    $(msg) 
    >$(o) make.opt 
    -o $ @ 
    $ (appRscs) 
    < 
$ (RLibCmd) @ $ (o) make.opt 
    ~ time 

When $(appName).ma is generated from $(appRscs), there are no default rules in all mki (header files for making files). Here are the explicit rules. The final call is the command $(RLibCmd) to package multiple rsc files into a single ma file. $ (RLibCmd) is actually rlib.exe under the bin folder in the SDK. 

Note: If there is a blank line under the dependency without directly following the rule, it means to find the default rule in mki.

Next, we summarize a few points you need to care about in practice. As long as you grasp these points, you can basically create new mke files and modify mke files in the future.

$ (o)XXX $(oext) : $ (baseDir)XXX.cpp $ (baseDir)XXX.h

Learn More about the Bmake Utility here : [[Creating a Makefile and Using the bmake Utility]]

Prev:[[Building a simple MDL Application]]Next:[[Creating elements in MDL applications]]