coreutils
[Top][All Lists]
Advanced

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

Re: non-recursive make: is there a performance gain?


From: Jim Meyering
Subject: Re: non-recursive make: is there a performance gain?
Date: Sat, 08 Sep 2012 20:44:52 +0200

Stefano Lattarini wrote:
> On 09/08/2012 07:46 PM, Jim Meyering wrote:
>> Stefano Lattarini wrote:
>>> On 09/08/2012 03:29 PM, Jim Meyering wrote:
>>>>
>>>> But, ... surprise!  So far there is *no* improvement, and in fact a small
>>>> penalty in this very worst case:
>>>>
>>> My wild guess is that the culprit for this might be the Automake-generated
>>> recursive make invocation in the handling of $(BUILT_SOURCES):
>>>
>>>     all: $(BUILT_SOURCES)
>>>             $(MAKE) $(AM_MAKEFLAGS) all-am
>>>
>>> What happens if, after the first build, you substitute the rule above in
>>> your Makefile with simply:
>>>
>>>     all: all-am
>>>
>>> ? Is there any improvement?
>>
>> Good call!  Yes:
>>
>> [SNIP]
>>
> Unfortunately, the extra recursive invocation involving $(BUILT_SOURCES) is
> truly needed in order to have correct semantics, because $(BUILT_SOURCES) must
> be built before *any* other (direct or indirect) prerequisite of 'all'.
> Automake-NG plays dirty tricks to maintain this semantics while avoiding that
> recursion, but I haven't been able to come up with a similar trick working 
> also
> for portable make.

Too bad.
I'm sure we'll come up with something.

On the subject of converting to non-recursive make in lib/,
I have at least one problem so far: how can I select different
CFLAGS depending on the directory containing the file I'm compiling?

As you know, we currently have three different sets of warnings:
  - strict, for src/
  - less strict, for lib/
  - even less strict, for gnulib-tests/

I could certainly do that with GNU make by defining

  src_CFLAGS = ...
  lib_CFLAGS = ...
  gnulib-tests_CFLAGS = ...

and then including $($(@D)_CFLAGS) in the generic compilation rule.

Hmm... maybe override that default rule in cfg.mk, where only GNU make
will see it.  Hah!  So the act of writing this question has provided me
with the solution:  add these lines to cfg.mk:

    COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
            $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $($(@D)_CFLAGS)

    src_CFLAGS = -WBOGUS

That -WBOGUS is just to test, and I confirm that it does what I expect.



reply via email to

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