sources file conditional compile

i am trying to include a diff set of files for checkd and free build in
sources, but it doesnt seem to work…can any one point me to what i am
missing…

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

i always see i am compiling c2.c even when in checked build env.

output of ‘set’ command shows that DDKBUILDENV is chk.

Bedanto wrote:

i am trying to include a diff set of files for checkd and free build
in sources, but it doesnt seem to work…can any one point me to what
i am missing…

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

i always see i am compiling c2.c even when in checked build env.

Correct. Although this is valid syntax for a makefile, the “build”
utility does not recogize it. It requires a single SOURCES statement
with a single set of files.

You can always do the ugly hack of having c.c contain:

#ifdef _DEBUG
#include “c1.c”
#else
#include “c2.c”
#endif


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Or

!IF (“$(DDKBUILDENV)”==“chk”)
MYCSRC= c1.c
!ELSE
MYCSRC= c2.c
!ENDIF

SOURCES= CD.rc \
a.c b.c \
$(MYCSRC) \
d.c

SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

-----Original Message-----
From: Tim Roberts [mailto:xxxxx@probo.com]
Sent: Wednesday, December 17, 2008 3:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] sources file conditional compile

Bedanto wrote:

i am trying to include a diff set of files for checkd and free build
in sources, but it doesnt seem to work…can any one point me to what
i am missing…

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

i always see i am compiling c2.c even when in checked build env.

Correct. Although this is valid syntax for a makefile, the “build”
utility does not recogize it. It requires a single SOURCES statement
with a single set of files.

You can always do the ugly hack of having c.c contain:

#ifdef _DEBUG
#include “c1.c”
#else
#include “c2.c”
#endif


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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 have had success with

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES2=c1.c
!ELSE
SOURCES2=c2.c
!ENDIF

SOURCES= CD.rc \
a.c \
b.c \
$(SOURCES2) \
d.c

in the windows build env (of which the WDK build is a subset of, but for build.exe, I think everything is the same)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Wednesday, December 17, 2008 3:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] sources file conditional compile

Bedanto wrote:

i am trying to include a diff set of files for checkd and free build
in sources, but it doesnt seem to work…can any one point me to what
i am missing…

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

i always see i am compiling c2.c even when in checked build env.

Correct. Although this is valid syntax for a makefile, the “build”
utility does not recogize it. It requires a single SOURCES statement
with a single set of files.

You can always do the ugly hack of having c.c contain:

#ifdef _DEBUG
#include “c1.c”
#else
#include “c2.c”
#endif


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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

harish, doron,

i tried your suggstions, before my initial post, without luck.

my build script can be invoked from any CMD window. It initially does this…

Call C:\WINDDK\6001.18002\bin\setenv.bat C:\WINDDK\6001.18002 fre x86 WXP

@echo ==== Building Driver ====
echo
call build.exe -cez

On Wed, Dec 17, 2008 at 4:12 PM, Doron Holan wrote:

> I have had success with
>
> !IF (“$(DDKBUILDENV)”==“chk”)
> SOURCES2=c1.c
> !ELSE
> SOURCES2=c2.c
> !ENDIF
>
> SOURCES= CD.rc <br>> a.c <br>> b.c <br>> $(SOURCES2) <br>> d.c
>
> in the windows build env (of which the WDK build is a subset of, but for
> build.exe, I think everything is the same)
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Tim Roberts
> Sent: Wednesday, December 17, 2008 3:46 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] sources file conditional compile
>
> Bedanto wrote:
> > i am trying to include a diff set of files for checkd and free build
> > in sources, but it doesnt seem to work…can any one point me to what
> > i am missing…
> >
> > !IF (“$(DDKBUILDENV)”==“chk”)
> > SOURCES= CD.rc <br>> > a.c <br>> > b.c <br>> > c1.c <br>> > d.c
> > !ELSE
> > SOURCES= CD.rc <br>> > a.c <br>> > b.c <br>> > c2.c <br>> > d.c
> > !ENDIF
> >
> >
> > i always see i am compiling c2.c even when in checked build env.
>
> Correct. Although this is valid syntax for a makefile, the “build”
> utility does not recogize it. It requires a single SOURCES statement
> with a single set of files.
>
> You can always do the ugly hack of having c.c contain:
>
> #ifdef _DEBUG
> #include “c1.c”
> #else
> #include “c2.c”
> #endif
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> 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
>
>
> —
> 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
>

Bedanto wrote:

harish, doron,

i tried your suggstions, before my initial post, without luck.

What does that mean, exactly?

my build script can be invoked from any CMD window. It initially does
this…

Call C:\WINDDK\6001.18002\bin\setenv.bat C:\WINDDK\6001.18002 fre x86 WXP

@echo ==== Building Driver ====
echo
call build.exe -cez

You don’t need to use “call” when invoking an executable. That’s only
needed when you are calling another batch file.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

before i initially staterd this thread i tried the different alternatives.

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES2=c1.c
!ELSE
SOURCES2=c2.c
!ENDIF

SOURCES= CD.rc \
a.c \
b.c \
$(SOURCES2) \
d.c

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

when none of these options worked, i posted.

but i still cant get it to work.

thanks for hte tip abt ‘call’ i have fixed by batch file, it looks like …

Call C:\WINDDK\6001.18002\bin\setenv.bat C:\WINDDK\6001.18002 fre x86 WXP
@echo ==== Building Driver ====
echo
build.exe -cez

and

Call C:\WINDDK\6001.18002\bin\setenv.bat C:\WINDDK\6001.18002 chk x86 WXP

@echo ==== Building Driver ====
echo
build.exe -cez

. stil lno luck…

On Wed, Dec 17, 2008 at 4:44 PM, Tim Roberts wrote:

> Bedanto wrote:
> > harish, doron,
> >
> > i tried your suggstions, before my initial post, without luck.
>
> What does that mean, exactly?
>
>
> > my build script can be invoked from any CMD window. It initially does
> > this…
> >
> > Call C:\WINDDK\6001.18002\bin\setenv.bat C:\WINDDK\6001.18002 fre x86 WXP
> >
> > @echo ==== Building Driver ====
> > echo
> > call build.exe -cez
>
> You don’t need to use “call” when invoking an executable. That’s only
> needed when you are calling another batch file.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> 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
>

Bedanto wrote:

before i initially staterd this thread i tried the different alternatives.

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES2=c1.c
!ELSE
SOURCES2=c2.c
!ENDIF

SOURCES= CD.rc \
a.c \
b.c \
$(SOURCES2) \
d.c

That should work.

!IF (“$(DDKBUILDENV)”==“chk”)
SOURCES= CD.rc \
a.c \
b.c \
c1.c \
d.c
!ELSE
SOURCES= CD.rc \
a.c \
b.c \
c2.c \
d.c
!ENDIF

That should not work.

when none of these options worked, i posted.

but i still cant get it to work.

. stil lno luck…

We seem to be having a failure to communicate, so I will try to be more
explicit.

WHAT isn’t working? Exactly what do you see when you try your batch
file? Show us your entire “sources” file, then cut and paste the EXACT
error messages, or the EXACT contents of the log. This crap about “no
luck” doesn’t help us one bit in trying to isolate your problem. None
of the rest of us are seeing this issue. We can’t GUESS what you might
have done here.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

The SOURCES statement in the SOURCES file cannot be customized by any macros or conditions.

So, use the C macro:

#if DBG
#include “CheckedFile.c”
#else
#include “FreeFile.c”
#endif


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com