delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/13/11:48:01

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Sun, 13 Jan 2002 18:43:13 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Martin Steuer <martinSteuer AT gmx DOT de>
Message-Id: <1438-Sun13Jan2002184313+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <5.0.2.1.2.20020113120630.009e6c70@pop.gmx.net> (message from
Martin Steuer on Sun, 13 Jan 2002 12:27:49 +0100)
Subject: Re: Setting Env Var from within make
References: <5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020112104932 DOT 009eaec0 AT pop DOT gmx DOT net>
<5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020111135643 DOT 009e11a0 AT pop DOT gmx DOT net>
<5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020110113803 DOT 009e0200 AT pop DOT gmx DOT net>
<5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020110113803 DOT 009e0200 AT pop DOT gmx DOT net>
<5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020111135643 DOT 009e11a0 AT pop DOT gmx DOT net>
<5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020112104932 DOT 009eaec0 AT pop DOT gmx DOT net> <5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020113120630 DOT 009e6c70 AT pop DOT gmx DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Sun, 13 Jan 2002 12:27:49 +0100
> From: Martin Steuer <martinSteuer AT gmx DOT de>
> 
> So now when i include the *.d dependecies the targets names are not the 
> same and so make won't check for the change of the include files it just 
> uses the above rule.
> So every time gcc is invoked i want to change the content of 
> DEPENDENCIES_OUTPUT where you can directly specify the targets name as the 
> second value (i'd use $@ for it).
> 
> It could be so easy if i could specify the targets name directly to gcc, 
> i'm currently using version 2.952, i think thats a feature which should be 
> added to later versions (maybe it has already been done?).

In GCC 3.0.2, you have "-MF FILE", which I think will do what you
want.  I don't know in what version was -MF introduced.

> I really want to do it this way because i think the whole directory 
> structure is much clearer.

I can think about two options:

  - Run GCC as usual with -MMD, then move the .d file to the
    directory where you want it (I assume that all the .d files
    should end up in the same directory).

  - Invoke Make recursively.  Here's an example (untested):

OBJPATH = ./obj/

$(target): $(source)
	 $(CC) $(CFLAGS) -c $< -o $(OBJPATH)$*.o

$(OBJPATH)%.o : %.c
	$(MAKE) $(MAKEFLAGS) $@ target=$@ source=$< DEPENDENCIES_OUTPUT=$*.d

- Raw text -


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