Friday, 30 October 2009

Windows Embedded CE: Build Considerations

Hi folks,

When building your Windows Embedded CE OS image you might have noticed, that a lot of components are built even though they are not part of your image neither do you need them later on. This behavior takes up precious time, and space on your hard drive.

Having realized this behavior, it of course raises a couple of questions; How come those components that I don’t need are being built? And more importantly, is there a way to avoid building those components?

As you might have guessed, YES! You can avoid building the unnecessary components and it is quite easy, too! Simply set the environment variable SKIPBUILD in each applicable SOURCES file (e.g. set SKIPBUILD=1).

Make sure you use the respective SYSGEN variable set by selecting the appropriate catalog item in connection with the SKIPBUILD environment variable:

!if "$(SYSGEN_MY_VAR)" != "1"
SKIPBUILD=1
!endif


Et voilá, problem solved!

Have fun!

PS:
As stated in the comment section, there might, however arise one problem when using the SKIPBUILD environment variable:

Your sources file will still get pre-processed which could only cause a problem when you have two (or more) sources files generating a dll/exe/lib with the same name:

Your fist sources file (without SKIPBUILD condition) will generate the dll/exe/lib. But the second sources file (with SKIPBUILD condition), due to being pre-processed deletes your just build dll/exe/lib and due to the SKIPBUILD condition does not regenerate the dll/exe/lib.

Thanks for the useful input!

2 comments:

Anonymous said...

It should be noted however that the sources file will still get pre-processed. This is normally not an issue.
An example of when this might be a problem is if you had two sources files that generate the same dll/exe, the first sources file gets processed and generates a dll, the second bails because of a skip condition you setup however because it is pre-processed the dll is deleted (which you didn't want).

Jochen Dieckfoß said...

Hi,

thanks for your helpful comment! I updated my post accordingly.