cosmetic Makefile fix

Denys Vlasenko vda.linux at googlemail.com
Thu Jun 5 00:31:33 UTC 2008


On Wednesday 04 June 2008 19:21, Bernhard Fischer wrote:
> >I added this TODO for now in top-level Makefile.in:
> >
> >extra/config/conf extra/config/mconf: include/bits
> ># TODO: this results in "make[1]: `conf' is up to date" printed
> ># on every rebuild, because extra/config/conf is already built
> ># on previous make run. Make it "test -x $@ || ..." (simple & a bit wrong)
> ># or "make -q -C extra/config $(notdir $@) || ..." (less readable)?
> >        $(Q)$(MAKE) -C extra/config $(notdir $@)
> >
> >In your opinion, which option would be more appropriate here?
> 
> I don't see why we need this dependency in the first place?
> 
> Does anybody see why we shouldn't just remove it?

Have no idea.
Why?
Because whoever added that dependency did not add a comment
why it is needed. I am sure author was a much clever guy than me
and it was obvious to him why it is needed. However, not everyone
is a genius. Neither I nor you can see now why it is needed.
Imagine how much more easier it could be if there was a comment like
# Needed for "make; touch foo/bar; make" case

Just a few comment lines can save hours of head scratching later.
And yet, they are not there.

I would like to ask you guys to add comments when you code up something
non-obvious. Think about poor guy who will read it months/years later.
It is not limited to makefiles - C files as well.
I got this habit of forcing me to write down stuff after I had a recurring
experience of coming back to *my own code* and not understanding
what it is doing, or why it is coded in some specific way.
Deciphering it again is a waste fo time and is error-prone.

> I'm looking into this.

-extra/config/conf extra/config/mconf: include/bits
-# TODO: this results in "make[1]: `conf' is up to date" printed
-# on every rebuild, because extra/config/conf is already built
-# on previous make run. Make it "test -x $@ || ..." (simple & a bit wrong)
-# or "make -q -C extra/config $(notdir $@) || ..." (less readable)?
+extra/config/conf extra/config/mconf:
        $(Q)$(MAKE) -C extra/config $(notdir $@)

In light of my previous passage... please, consider not removing comments...
(Of course, not applicable to cases when comment is wrong, or
is flatly obvious: "i++; /* increment index */" - well duh...)
--
vda



More information about the uClibc mailing list