From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: How Can Makefiles Handle Source File in Extraneous Directories? Date: 14 Aug 2003 17:20:49 GMT Organization: Aachen University of Technology (RWTH) Lines: 51 Message-ID: References: <978b35e2 DOT 0308130707 DOT 1f7d42bf AT posting DOT google DOT com> <978b35e2 DOT 0308140847 DOT 254068cf AT posting DOT google DOT com> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1060881649 16498 137.226.32.75 (14 Aug 2003 17:20:49 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 14 Aug 2003 17:20:49 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Geoff Robinson wrote: > I can't get this thing to work. Do you know of any Windows-based > examples I could look at? No. The main reason for that being that your way of spreading source files all over the place is rather unusual, to put it mildly. > I'm finding it exceedingly hard to find documentation for this > specific problem. The real problem is that you're trying to be lazy and stubborn at the same time, and that can't usually work. Now I'll have to eplain what I mean with this... I say "lazy" because you want to avoid writing explicit rules for individual .o files, but rather use a simplistic "makefile template" with minimal modifications. With indiviudal rules and explicit commands for each of them, you could quite easily place your files wherever you want, and have object files and source files in completely unrelated directories. But your makefile would be a lot longer than in your current plan. And I say "stubborn" because you don't seem to be willing/able to adapt your source file storage pattern to the expectations built into make. Those expectations form the basis of features inside make that are there exactly to allow laziness. Among those tools in GNU make you're shutting yourself off of by your sourcefile placement, the most prominent are implicit suffix rules and the VPATH feature, which would help you to avoid writing repetitive stuff into your makefile all the time, if you let them. But you would have to refrain from using absolute paths to source files inside your makefile to fully exploit these features. Summing this up Your sourcefile layout is rather awkward and unusual, and that's where all your problems with make really come from. Source files used in the same project should not generally be spread across several different unrelated directories. If they belong to the same project, they really should all be in its source tree. If they don't, it's none of the project makefile's business how to compile them --- they should be in pre-built libraries instead, and/or maintained by a recursive invocation of 'make'. > Secondly, I'm not sure if there is any way around putting in a drive > letter. That may be a problem, but I'm willing to accept the risk. Drive letters aren't actually all that bad. Backslashes are worse. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.