So you have created a new DLL that implements a set of APIs. This creates value for your system by adding important functionality.  Now you want to add the header files and libraries to your SDK.

Of course you can configure your SDK to add the files, but let's add to the requirement.  The new DLL is part of your BSP, and your BSP is used by multiple OS designs.  Or, like me, you use this same code across multiple BSPs each with multiple OS designs.  So, configuring the SDK for each is a manual process, and manual processes are not idiot proof.  That means that you will probably waste time creating SDKs that don't include your important files.  Hopefully you will catch this in testing...

The following is a simple way to use the sources file and to add necessary files to the SDK.  This removes the manual process.

Let's assume that the DLL build folder contains the following files:

 - MyDll.c
 - MyDll.h
 - MyDll.def
 - sources
 - Makefile

For a quick refresher:
 - Build.exe parses the sources file and passes the result to nmake which opens the makefile and follows the rules to build the dll
 - We are building this in the BSP with RELEASETYPE=PLATFORM so the dll will be put in $(_TARGETPLATROOT)\target\$(_CPUINDPATH), but we don't care about that for this discussion
 - We do care about the lib (MyDll.lib) file that is created.  It is put in $(_TARGETPLATROOT)\lib\$(_CPUINDPATH).  This lib file exposes the APIs to applications and allows for implicit linking at runtime.

Now what we want to do is put MyDLL.lib and MyDll.h in the SDK.

Start with the sources file:



It is pretty simple and builds MyDll.dll.  Now let's tell it to do something after it finishes building the DLL.  To do that we use WINCETARGETFILES which is used to define a target that gets built after building the target defined in the sources file.  I will name this new target "CopySDK".  So add the following to the sources file:


Now, when build runs it will try to build the target CopySDK, but it doesn't have any rules for building CopySDK.  To add the rule for CopySDK, we will create a new file named

Start by adding the target CopySDK:


Of course we need it to do something. Let's start by making sure that the folders exist in the OS design for the SDK.  We need both Inc and Lib folder trees


Almost finished, now add the following to copy all header files and the lib file to the SDK folders:

        xcopy /I /D /Q *.h $(_PROJECTSDKROOT)\Inc > nul 

That is it, when you build this folder it will put the necessary files into the SDK folders so that when you roll the SDK your developer customers can take advantage of all of the work that you have done.

Go to Summary of Building Windows CE

Copyright © 2008 – Bruce Eitman
All Rights Reserved