Thursday, 27 August 2009

Windows CE: Sources File restrictions take II:

Hi folks,

you might remember my post from December 2008 where I talked about the SOURCES macro restrictions. Upon popular request I am going to extend that post now.

In particular I am going to talk about the restriction that one can only specify files, to be compiled, that reside in the same folder or one folder up from the location of the SOURCES file (e.g. SOURCES=myFile.c or SOURCES=..\myFile.c). Again this restriction only applies to the SOURCES macro and NOT to the assembly file macros (ARM_SOURCES, SH_SOURCES, x86_SOURCES, or MIPS_SOURCES).

Now let’s focus on what causes this restriction and how to solve the problem of compiling files that reside somewhere else in your system other than in the same directory or one directory above the location of the SOURCES file.

Cause:
SOURCES files are an integral part of the Windows Embedded CE build system and they are used in multiple places for instance as includes in makefiles. Unfortunately, this results in multiple parsers for SOURCES files which are not compatible with one another. Therefore the above mentioned restriction is incidental.

Solution:
But what do you do if you do have to compile files that are not in the same directory or one directory above the SOURCES file? How now brown cow?

You can simply create an interface file (myFile_i.c) in which you include the files to be compiled (#include <some_path>\myFile.c). All you have to do now is specify that interface file in your SOURCES macro (SOURCES=myFile_i.c). Et voilá, your problem is solved.

Have fun!

No comments: