C_DEFINES=$(C_DEFINES) -D_PRODUCT_A
//C_DEFINES=$(C_DEFINES) -D_PRODUCT_B
#ifdef PRODUCT_A // <- I want to do doing like this in a sources file.
MOST_SOURCES= a.c b.c productA.c
#elif PRODUCT_B
MOST_SOURCES= a.c b.c productB.c
#endif
Is there a proper syntax?
We’ve covered this lots of times here. Here’s one from a few months ago:
http://www.osronline.com/showthread.cfm?link=184099
Tim Roberts’ first reply explains the problem.
-scott
–
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
wrote in message news:xxxxx@ntdev…
> C_DEFINES=$(C_DEFINES) -D_PRODUCT_A
> //C_DEFINES=$(C_DEFINES) -D_PRODUCT_B
>
> #ifdef PRODUCT_A // <- I want to do doing like this in a sources file.
> MOST_SOURCES= a.c b.c productA.c
> #elif PRODUCT_B
> MOST_SOURCES= a.c b.c productB.c
> #endif
>
>
> Is there a proper syntax?
>
> #ifdef PRODUCT_A // <- I want to do doing like this in a sources file.
MOST_SOURCES= a.c b.c productA.c
#elif PRODUCT_B
MOST_SOURCES= a.c b.c productB.c
#endif
productAB.C:
#ifdef PRODUCT_A
#include “productA.c”
#else
#include “productB.c”
#endif
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
No, nmake syntax is !if. However you cannot conditionally define your SOURCES line, so this line of approach will not work in the end. Two tools process the sources file during the build process; nmake.exe and build.exe. Build.exe doesn’t support conditionals in the way nmake does.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, September 07, 2010 11:41 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Preprocessing on the sources file of device driver
C_DEFINES=$(C_DEFINES) -D_PRODUCT_A
//C_DEFINES=$(C_DEFINES) -D_PRODUCT_B
#ifdef PRODUCT_A // <- I want to do doing like this in a sources file.
MOST_SOURCES= a.c b.c productA.c
#elif PRODUCT_B
MOST_SOURCES= a.c b.c productB.c
#endif
Is there a proper syntax?
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
I’ve used a way Tim Roberts said.
Thanks everyone!