I came across an interesting question today – How can I use a sources file to build multiple sub-folders?
Of course the obvious answer is don’t do that. Instead set up a tree something like this:
                MyDriver
                                |- Dirs (file listing sub-folders)
                                |- Folder1 (Create a static library)
                                                |- sources
                                                |- makefile
                                                |- file.c
                                |- Folder2 (Create a static library)
                                                |- sources
                                                |- makefile
                                                |- file2.c
                                |- BuildDLL (Link the libraries to create a DLL)
                                                |- sources
                                                |- makefile
 
But the question is still valid, can you use a sources file to build sub-folders? That depends… you can’t build a sub-folder with just any name, but there are some named sub-folders that are valid. The valid sub-folders are the names of CPU families like ARM and can be used with SOURCES or ARM_SOURCES. Example:
ARM_SOURCES=arm\file.c
An interesting twist on this is having multiple sources files that build the same source code in different ways. An example of this can be found in PUBLIC\COMMON\OAK\DRIVERS\BLOCK\MSFLASHFMD\STRATA where the source code is built for both linking with a driver and with the bootloader or kernel. That tree looks something like this:
                MyDriver
                                |- Dirs (file listing sub-folders)
                                |- file.c
                                |- file2.c
                                |- BuildForKernel (Create a static library)
                                                |- sources
                                                |- makefile
                                |- BuildForDriver (Create a static library)
                                                |- sources
                                                |- makefile
                                |- BuildDLL (Link the libraries to create a DLL)
                                                |- sources
                                                |- makefile
 
 
Tags: Build.exe
Copyright © 2008 – Bruce Eitman
All Rights Reserved