PowerMaker utility (TDK)
Typically, you do not need to know about the PowerMaker utility, because TDK uses the PowerMaker utility without you having to interact with it.
For information about the PowerMaker language, see the Related Topics.
What is PowerMaker?
PowerMakerr is a command line program that generates makefiles for specific purposes. TDK uses this utility for generating the makefile that is needed for completing the build process of a Code Generator DLL.
Writing makefiles by hand is a very boring and time-consuming activity. Very often the same set of rules is repeated for a large set of files. Makefile syntax allows file grouping, but this often leads to a completely unreadable makefile.
PowerMaker has been designed for hiding the complexity and details of a makefile from the user. It works with an abstract syntax that allows a simple specification of what has to be done, which files should be considered as input, and which special targeting configuration should be used. Everything entered in the configuration file is checked both syntactically and semantically for errors, in such a way that a number of errors that would lead to inconsistent builds are discovered before the build takes place.
How does PowerMaker work?
PowerMaker uses the configuration file (Maker.cfg) that is generated by the TDK in the target directory. When launched, PowerMaker parses the configuration file, checks its semantics and if no errors are found it generates a makefile in a specified location.
PowerMaker has the following command line:
PowerMaker <Working Directory> [<Current Config>]
Where <Working Directory> is the directory where the configuration file (.cfg) resides, and <Current Config> is the configuration for which the makefile has to be generated. If you omit <Current Config>, the configuration file is checked syntactically and semantically, but no makefile is written to output.
What is a PowerMaker configuration?
When automating a build process, you often have to manage the same input files compiled with different command line switches, in such a way that it is possible to get different executables compiled with different options. Basically, a configuration is one of those executables.
Why use PowerMaker?
Managing different configurations is a difficult task, which can be error prone. When mistakes occur, it can take a lot of time and effort to determine the problem.
PowerMaker simplifies the makefile creation by checking semantically the contents of the configuration file. It also offers a number of useful constructs that automate the makefile generation. In particular, the following constructs and checks are available:
• Each variable has been declared.
• The existence of a configuration has to be declared.
• Each expression can depend on the selected configuration; however, the expression must specify a value for each possible configuration.
• Expressions can be scalar (a single value) oriented and list (array of values) oriented.
• Files path/name/extension can be changed by means of explicit change rules.
• Input files can be specified with search-absolute, search-in-directory and search-in-file techniques.
• Rules must have a name.
• The same rule can be applied to a whole set of files with the foreach operator.
• Commands can be repeated in the same rule with the foreach operator.