groff
[Top][All Lists]
Advanced

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

Re: [Groff] MAKE_K_FLAG


From: Bruno Haible
Subject: Re: [Groff] MAKE_K_FLAG
Date: Tue, 10 Jan 2012 03:15:46 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Hi,

Werner asked me to answer this.

Ingo Schwarze wrote:
> Pascal Stumpf drew my attention to the fact that the following line
> in the top-level Makefile.in is causing trouble:
> 
>   MAKE_K_FLAG=`case "$(MAKEFLAGS)" in *k*) echo ' -k ';; esac`
> 
> The problem is that *any* k character anywhere in MAKEFLAGS,
> for example coming from something like
> 
>   make ... FOO=k ...
> 
> is mistaken for a -k flag, forcing some parts of the build to
> ignore errors even when that is not desired, making errors harder
> to spot.

Indeed. The test Makefile found in
http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.68/html_node/The-Make-Macro-MAKEFLAGS.html
confirms what you say.

Makefiles generated by Automake use this idiom:

        for f in x $$MAKEFLAGS; do \
          case $$f in \
            *=* | --[!k]*);; \
            *k*) keepgoing=yes;; \
          esac; \
        done; \

> Pascal found
> 
>   http://lists.gnu.org/archive/html/groff/2006-01/msg00075.html
> 
> but we don't quite understand the reasoning given there, as
> both BSD make and GNU make pass down -k to recursive make
> child processes anyway, without doing anything special.
> 
> So it seems one could just remove MAKE_K_FLAG completely
> without any adverse effect

I cannot confirm what you say. With GNU make, I get:

$ cat Makefile
MAKE_K_FLAG=`case "$(MAKEFLAGS)" in *k*) echo ' -k ';; esac`

all :
        echo MAKE='$(MAKE)', MAKEFLAGS='$(MAKEFLAGS)'
        $(MAKE) $(MAKEFLAGS) foo
        $(MAKE) $(MAKE_K_FLAG) foo

foo :

$ make
echo MAKE='make', MAKEFLAGS=''
MAKE=make, MAKEFLAGS=
make  foo
...

$ make -k
echo MAKE='make', MAKEFLAGS='k'
MAKE=make, MAKEFLAGS=k
make k foo
...

$ make FOO=kit
echo MAKE='make', MAKEFLAGS='FOO=kit'
MAKE=make, MAKEFLAGS=FOO=kit
make FOO=kit foo
...

$ make -k FOO=kit
echo MAKE='make', MAKEFLAGS='k -- FOO=kit'
MAKE=make, MAKEFLAGS=k -- FOO=kit
make k -- FOO=kit foo
...

Looking back at
http://lists.gnu.org/archive/html/groff/2006-01/msg00075.html
the right thing to do IMO is to fix the definition of MAKE_K_FLAG:
Please replace the line

  MAKE_K_FLAG=`case "$(MAKEFLAGS)" in *k*) echo ' -k ';; esac`

with

  MAKE_K_FLAG=`for f in x $(MAKEFLAGS); do \
                 case $$f in \
                   *=* | --[!k]*);; \
                   *k*) echo ' -k ';; \
                 esac; \
               done`

Bruno




reply via email to

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