Documentation for Build v2.08
Table of Contents

Rule Definition File

Defines the rules used to build non-D source files.


This is not as advanced as the typical makefile abilities and is only useful for simple situations. Specifically, it only caters for applications that take a single input file to create the required output file.

The default Rule Definition File is called "default.rdf". It is found by first looking in the directory where the utility is installed, and if it is not found there, the directories in the PATH environment symbol are scanned.

The default RDF can be overridden by the -RDF command line switch.

Each rule is defined in a set of four mandatory lines ...

  • rule=<name>
  • source=<extention>
  • target=<extention>
  • tool=<command pattern>

    Any other line in the file, not starting with one of the above keywords is simply ignored (treated as comments).

    The tool line can contain special tokens. These are keywords enclosed in braces. At compile time, the tokens are replaced by replacement text taken from the pragma(build) statement. There are two predefined tokens that can be used. {@IN} is replaced by the name of the input file, and {@OUT} is replaced by the name of the output file.

    ----- Windows Resource Compiler -----
     This uses ` pragma(/b'build', <sourcefile>.rc); ` 
    -------------------------------------
    rule=Resources
    source=rc
    target=res
     tool=rc /r {@IN} /fo {@OUT}
    

    ------------------------------------- DMD C linkage This uses ` pragma(build, <sourcefile>.c, "COPT=<options>", "HDR=<whatever>"); ` ------------------------------------- rule=DMD C/C++ source=c target=obj tool=dmc -c {COPT} {@IN} -o{@OUT} {HDR}