delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/08/15/07:15:04

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How Can Makefiles Handle Source File in Extraneous Directories?
Date: 15 Aug 2003 11:11:44 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 33
Message-ID: <bhif5g$195$1@nets3.rz.RWTH-Aachen.DE>
References: <978b35e2 DOT 0308130707 DOT 1f7d42bf AT posting DOT google DOT com> <bhdqf2$9al$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <978b35e2 DOT 0308140847 DOT 254068cf AT posting DOT google DOT com> <bhggdh$g3i$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <978b35e2 DOT 0308141414 DOT 1aa82234 AT posting DOT google DOT com>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1060945904 1317 137.226.32.75 (15 Aug 2003 11:11:44 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 15 Aug 2003 11:11:44 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 <geoffr2 AT aol DOT com> wrote:

> other user-defined files.  The user has a project directory and a
> common directory they use.  Compiling stuff from the project directory
> no problem.  But a situation may arise where files from both of the
> user's directories need to be compiled.

That's not much of a problem, as far as make is concerned, *if* you can
do one of two things:

1) compile the files sitting in the "common" directory by running a recursive
   invocation of make over there, like this:

	$(MAKE) -C $(common_dir)

2) have all .o files, from both source file storage directories, end up
   in the directory you're running make in.

In the first case, you can get away with a single rule that executes
the recursive make for all .o files in the common directory, in the
second you can use VPATH to find files in both source directories.

Or you can give up the lazy approach and write explicit rules for every
source file.  

In the end, makefiles alone may not be enough.  There are cases where
you really need more tools, up to and including ones that generate
makefiles from outlines, or that generate makefile fragments on
request.  Or maybe make simply isn't up to the task you're trying to
solve.  Other tools, including Ant, may be worth trying.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019