From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Need a little help with make Date: 23 May 2002 12:53:23 GMT Organization: Aachen University of Technology (RWTH) Lines: 36 Message-ID: References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1022158403 28210 137.226.32.75 (23 May 2002 12:53:23 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 23 May 2002 12:53:23 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Manni Heumann wrote: > I've got a tiny little makefile that does what it is supposed to do: > compile the object files if needed and then build a binary. > Now I wanted to store all the .o files into a subdirectory. You can do that, but you may buy yourself more trouble than it's worth. Currently, you're exploiting a lot of the built-in tricks make has been taught by its makers. What you're trying to do renders many of those tricks invalid, and you'll have to reinvent them. At the minimum, you'ld have to put the name of that subdirectory in front of every single .o file name in your OBJECTS list. That alone is cumbersome enough to make the whole plan questionable, I'd say. Next, you'ld have to change your pattern rule to name the .o files' directory, too. And that may well break it --- pattern rules are usually meant to match from the start of a relative pathname, not somewhere in the middle of it. An alternative method that might work: run make from inside the .o files' directory, using the makefile in the actual source directory, and then use VPATH to let it find the sources, i.e.: ODIR = odir all: program program: all-objects .PHONY: all-objects all-objects: $(MAKE) -C $(ODIR) -f ../Makefile VPATH=.. $(OBJECTS) -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.