You cannot use conditional expressions in macros that build.exe itself interprets (notable, SOURCES=). This is because build.exe doesn’t understand nmake conditionals.
There are a variety of ways to work around this limitation (from the simple #include’ing of source files, to creating subdirectories and referencing common source files one level up ("…" is, IIRC, one of the few exceptions to the rule that you can’t make cross directory references in SOURCES=), with specific sources files in referenced from “.”. [You should be able to use !include from within sources, if I am remembering right - but they must be unconditional.]
This topic has, for what it’s worth, been discussed many times on the list previously, so you can probably find some additional advice on dealing with it through a little bit of searching.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Thursday, January 27, 2011 12:00 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] conditional expressions in sources file
I am building scsiport and storport drivers out of the same directory, conditionally depending on the build environment.
What is the correct way to determine the build environment in the sources file? I thought the following would work:
!IF “$(DDK_TARGET_OS)” == “Win2K” || “$(DDK_TARGET_OS)” == “WinXP”
TARGETLIBS=$(TARGETLIBS) $(DDK_LIB_PATH)\scsiport.lib SOURCES=xenvbd.rc xenvbd_scsiport.c !ELSE
TARGETLIBS=$(TARGETLIBS) $(DDK_LIB_PATH)\storport.lib SOURCES=xenvbd.rc xenvbd_storport.c !ENDIF
But the expression always evaluates to false and builds the storport version instead.
Thanks
James
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer