We took one approach (this was not because we had run out of command line space, simply because we wanted to create a cleaner build system) so that each “module” performs its own assembly in passes.
So let's say you have 3 modules: A, B and C.
Your control makefile simply calls every makefile for the same purpose.
Then we set the goals as consistent clean, header, lib and exec.
So, the make control file was something like this:
modules=ABC clean: for i in $modules: ( cd $i ; make clean ; cd .. ) header: for i in $modules: ( cd $i ; make header ; cd .. ) lib: for i in $modules: ( cd $i ; make lib ; cd .. ) exec: for i in $modules: ( cd $i ; make exec ; cd .. )
Each module that had header files needed by other modules copied these header files to a central location during the header phase. Then, during the lib or exec phase, each module had to use only this central location to find all its headers. It also limited the modules to headings that were published centrally by other modules.
Similarly, each module that created the library needed by the exec phase copied the library to a central location. This greatly minimized the -I (include directory) and -L (library directory) clauses in build commands.
Using this scheme, you can rebuild the whole thing simply by running make clean header lib exec at the top level (or leave clean to make build properly, taking into account the dependencies).
This is one way to get around your problem, but I'm really interested in how you exceeded the limit. 8K, even 25 characters per path, would require about 300 different paths included. Is your hierarchy really voluminous?
Update 1:
If you are looking for a quick “dirty way” to make it work without changing the “makefile” architecture, you write a script that, given the list of directories, will copy all the header files from these directories to a central location.
Then run this as the first step in all your rules and change the include statement on your compilation lines to just reference that location, not a large list. You can even make a copy in stages (for example, 20 directories at a time x 20 times could process 400 directories).
This gives the same effect as my proposed solution with fewer changes to makefiles.
Update 2:
Another solution, as you stated in your comments, was to prescribe the path.
You can do this with subst.exe , for example:
> subst x: "c:\Documents and Settings\Pax\My Documents\Not my directory" > dir x: Volume in drive X has no label. Volume Serial Number is 8AA3-703A Directory of X:\ 08/09/2009 10:12 AM <DIR> . 08/09/2009 10:12 AM <DIR> .. 24/08/2009 01:54 PM 6,409 p0rn_sites.txt 09/07/2008 02:49 PM <DIR> downloaded_p0rn : : : 09/07/2008 02:52 PM <DIR> other_suspect_stuff 3 File(s) 18,520 bytes 18 Dir(s) 63,840,849,920 bytes free > subst x: /d > dir x: The system cannot find the path specified.