help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing grouped explicit targets rule with static pattern rule


From: Nithish Chandran
Subject: Re: Mixing grouped explicit targets rule with static pattern rule
Date: Mon, 22 Mar 2021 16:21:08 +0000

Hi Paul,

Please find my answers in blue inline to your questions.

Thanks,
Nithish

________________________________
From: Paul Smith <psmith@gnu.org>
Sent: Friday, March 19, 2021 3:36 PM
To: Nithish Chandran <nchandra@mathworks.com>; Troy Runkel 
<trunkel@mathworks.com>; help-make@gnu.org <help-make@gnu.org>
Subject: Re: Mixing grouped explicit targets rule with static pattern rule

On Fri, 2021-03-19 at 18:39 +0000, Nithish Chandran wrote:
> Please allow me to respond. We're using static pattern rule to create
> object files and were concerned about the situation discussed here ,
> where .d files could be corrupted if the build is killed at the wrong
> moment since make is not aware that it is creating .d files in the
> recipe and would not delete it when the build is killed. While there
> is a solution for this problem, we wanted to investigate options as
> well, that's when we came across grouped targets. Letting make know
> about the .d file being generated in the recipe would prompt it to
> delete the targets (.o and .d) if the build is killed during recipe
> execution.

If you do this, you will break that entire model of header file
tracking.  That model explicitly depends on make NOT knowing how to
build the .d files.  If it DOES know how to build the .d files, then it
will rebuild them as part of the include file operation, which is the
approach that the "advanced dependency generation" model is trying to
avoid in the first place.

I think this approach is a non-starter, regardless of whether there are
grouped targets or not.

That makes perfect sense. Thanks for pointing it out. I was ahead of myself and 
didn't think it thorough.

I think I am having problems visualizing what you are looking for;
maybe if you provided some examples of what you were thinking and what
it might look like (obviously this doesn't have to be things that work
today).

I was looking to use something along the following lines.
$(OBJS) $(OBJS_D) : %.o %.d &: %.c
    g++ -c $< -o $@ -MMD -MF $*.d -MP -MT $*.o

> We were able to use normal pattern rules along with grouped targets,
> we're not sure if it is good idea to expand the scope of creating the
> object files since we don't want to create any files that we don't
> intend to. That is the reason we wanted to check if there are any
> plans to support combining group targets with static pattern rules.

Sorry but I didn't understand that.

I tried using grouped targets with pattern rules which worked. But like you 
said this would defeat the purpose of advanced dependency generation.

%.o %.d &: %.c
    g++ -c $< -o $@ -MMD -MF $*.d -MP -MT $*.o

Thanks again!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]