If your driver must run on more than one Microsoft® Windows® operating system, or support more than one hardware architecture, you can organize your builds in any of the following ways:
In the simplest scenario, you can use a single source directory with a single makefile to build a single executable or driver.
However, the Build utility allows you to have a single subdirectory where you can build multiple executable output files.
It is easiest to use a single set of source files, regardless of the number of binaries to be created. If at all possible, avoid using more than one set of sources. Instead, use preprocessor symbols to isolate system-specific and architecture-specific code, and conditionally compile. Maintenance and debugging are vastly simplified when you use a single set of sources.
To develop a driver that will run on multiple Windows operating systems, use a single set of source files and create a single binary. However, sometimes it is not possible to generate a single binary that supports all target operating systems. Nevertheless, in such a case you should use the same source code and build the drivers as follows:
mydriver\Windows2000
mydriver\WindowsMe
mydriver\XP
mydriver\Windows2000\makefile
mydriver\Windows2000\makefile.inc
mydriver\WindowsMe\makefile
mydriver\WindowsMe\makefile.inc
mydriver\XP\makefile
mydriver\XP\makefile.inc
TARGETNAME=MYDRIVER
TARGETTYPE=DRIVER
DRIVERTYPE=WDM
C_DEFINES=-DDRIVER
INCLUDES=..\..\inc;
SOURCES= \
..\main.c \
..\vars.c \
This sources file creates a WDM driver named MYDRIVER, using source files from the parent directory and header files from an inc directory at the same level as the parent directory. Output files are placed in a subdirectory whose name is based on the build environment type, the platform, and the Windows version for which they are built. Log files use a similar naming scheme. See Specifying the Location of Created Files for details.
Note To do this in Visual Studio®, you must create a project file (.dsp) for each target operating system. Each project file should specify the preprocessor options that are required to build the driver on the target operating system. In addition, create a subdirectory for each target operating system. Direct the output object (.obj) and dynamic-link library (.dll) files for each target system to the corresponding subdirectory.