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:
Surround any system-dependent features with conditional compilation directives.
Put all source files in one directory; for example, mydriver.
Create a subdirectory for each target operating system. For example:
mydriver\Windows2000
mydriver\WindowsMe
mydriver\XP
In each system-specific subdirectory, put the makefile, makefile.inc, and other system-dependent build files:
mydriver\Windows2000\makefile
mydriver\Windows2000\makefile.inc
In each system-specific subdirectory, create a sources file that refers to the source files in the parent directory, as in the following example:
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.