help-make
[Top][All Lists]
Advanced

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

Re: Turning warning into errors


From: Kaz Kylheku (gmake)
Subject: Re: Turning warning into errors
Date: Thu, 02 May 2019 19:48:35 -0700
User-agent: Roundcube Webmail/0.9.2

On 2019-05-02 18:31, Sébastien Hinderer wrote:
Dear Duane,

Many thanks for your response!

You are right, the code is rather straightforward and at the same time I
find it clever! In particular, I like the fact that, because of the
options you are using, you don't need to use grep to figure out whether
there are warnings or not. We would have to work quite a bit to reach
this state but it's interesting to know the trick so I am very grateful
to you that you shared your solution with me!

Hmm? It seems you don't have to work hard at all; you can just run
your existing Makefile with those same options to get an immediate benefit:

make --warn-undefined-variables --silent --dry-run clean ... 2>&1 > /dev/null

and check that the output is empty.  Duane has just put in a convenience
target to do this via "make check_undefined_vars".

Let's try it in a project of mine:

~/txr$ make --warn-undefined-variables --silent --dry-run clean 2>&1 > /dev/null
  Makefile:32: warning: undefined variable `CFLAGS'
  Makefile:33: warning: undefined variable `EXTRA_FLAGS'
  Makefile:37: warning: undefined variable `LDFLAGS'
  Makefile:38: warning: undefined variable `EXTRA_LDFLAGS'

Good. These should be undefined; if the user sets these, we use them.
Glad to see there are no others. :)

The "make self_test_check_undefined_vars" target just triggers an undefined
variable condition (the expression $(nothing at all)) to provide a basic
proof that it's doing something.

This can be integrated in a simpler form without the self-test stuff, and you might not be interested in the other kinds of checks that are in that
file that add to its complexity.




reply via email to

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