You describe build products in a file called sources, which resides in each source code directory. This file contains a series of macro definitions that are recognized by BUILD. Following is a list of macros that are typically defined in a sources file:
windows |
Specifies Win32 (user-mode) |
NT |
Specifies kernel-mode |
console |
Specifies a Win32 Console application |
The UMLIBS path names need to be defined in a special way. Since BUILD provides a mechanism for building products for several hardware targets, the destination path for build products is constructed as follows:
%TARGETPATH%\<cpu_type>\
where TARGETPATH is defined in the sources file, and cpu_type specifies the CPU for which the products were built. For example, if you define TARGETPATH as OBJ, and request a build for i386 and MIPS, the build products would be directed to the following subdirectories:
obj\i386\ // build products for i386 obj\mips\ // build products for MIPS
Because of this convention, UMLIBS entries must specify library names in the following form:
<targetpath>\*\<library_name>
where targetpath is identical to the TARGETPATH defined in the sources file, and library_name is the full filename of the library to be linked to the application. The “*” is automatically replaced by the current CPU target during the build process.
It is possible to build your applications on a logical drive other than the one that has the DDK source tree, by making use of the BASEDIR environment variable. BUILD defines this environment variable to be \ddk_root by default. If you have your source tree on a logical drive that is different from the one that has the DDK sources, then you need to prepend the BASEDIR environment variable to the libraries that you need to link to, as follows:
$(BASEDIR)\lib\*\base.lib
In addition to sources, a standard file called makefile is required in each directory containing source code to be built. This file should not vary from one source directory to another and should never be altered.
To build a particular executable, change to the directory containing the sources file and invoke BUILD. BUILD automatically builds the library specified in sources, but it builds the executables only if explicitly told to do so (unless you use UMAPPL).
For example, if a sources file defined a library called “mylib” (as TARGETNAME), and an executable (UMTEST) called “myexe,” both products would be built for the i386 with the following invocation:
build -386 myexe
If “myexe” were not specified, only “mylib” would be built by default.
On the other hand, if you had defined a library called “mylib” (as TARGETNAME) and an executable (UMAPPL) called “myexe,” both products would be built for the i386 with the following invocation:
build -386
For simple programs consisting of a single source file, a library is not required. In this situation, define the sources file as follows:
BUILD will generate the executable file.