Conditional evaluation in make(1)
From: Ruslan Ermilov (ru_at_FreeBSD.org)
Date: 07/28/03
- Previous message: Paul Schenkeveld: "Re: Things to remove from /rescue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jul 2003 14:00:08 +0300 To: arch@FreeBSD.org
Gang,
> Script started on Mon Jul 28 11:02:58 2003
> goshik# cd /usr/ports ; make index ; cd /usr/local/etc; exit
>
> Generating INDEX - please wait.."/usr/ports/print/pips2200/../pips800/Makefile", line 60: Malformed conditional (${PRTYPE} == 780cs)
> "/usr/ports/print/pips2200/../pips800/Makefile", line 63: Malformed conditional (${PRTYPE} == 820ug)
> "/usr/ports/print/pips2200/../pips800/Makefile", line 1: Malformed conditional (${PRTYPE} == 750_2000)
> "/usr/ports/print/pips2200/../pips800/Makefile", line 1: Need an operator
> "/usr/ports/print/pips2200/../pips800/Makefile", line 5: Malformed conditional (${PRTYPE} == 780cs)
> "/usr/ports/print/pips2200/../pips800/Makefile", line 7: Malformed conditional (${PRTYPE} == 820ug)
> "/usr/ports/print/pips2200/../pips800/Makefile", line 305: if-less endif
> "/usr/ports/print/pips2200/../pips800/Makefile", line 305: Need an operator
> make: fatal errors encountered -- cannot continue
> make_index: icemc-0.2.4: no entry for /usr/ports/x11-toolkits/qt31
> [...]
> make_index: bugzilla-2.16.3_1: no entry for /usr/ports/www/p5-Template-Toolkit
> Warning: Duplicate INDEX entry: *** Error code 1
> Warning: Duplicate INDEX entry:
> Done.
> exit
>
> Script done on Mon Jul 28 11:13:07 2003
I've just fixed ports/print/pips800/Makefile that was broken.
Its string conditional operators were broken, and just sitting
hidden behind another bug in make(1) that was recently fixed.
As explained in section 4.3 of the "PMake -- A Tutorial"
(PSD:12-39) book,
: The arithmetic and string operators may only be used to test
: the value of a variable. The lefthand side must contain the
: variable expansion, while the righthand side contains either
: a string, enclosed in double-quotes, or a number. The stan-
^^^^^^^^^^^^^^^^^^^^^^^^^
: dard C numeric conventions (except for specifying an octal
: number) apply to both sides. E.g.
:
: #if $(OS) == 4.3
:
: #if $(MACHINE) == "sun3"
:
: #if $(LOAD_ADDR) < 0xc000
:
: are all valid conditionals.
Since "1.3.2" doesn't represent a valid number, the test
condition against it should be written like this (with
RHS enclosed in quotes):
.if ${PORTVERSION} == "1.3.2"
But not like this:
.if ${PORTVERSION} == 1.3.2
which currently results in a "malformed conditional" complaint
from make(1), and in my opinion, for a good reason. The reason
why I think conditionals of the form
.if ${VAR} == (number)(non-number)
(without double quotes) should be complained about by make(1)
is to avoid hiding user bugs of the form:
.if ${VAR} == 0z
where "z" was put by mistake. Note that
.if ${VAR} == (all-non-number)
conditionals with an unquoted RHS are still perfectly supported,
and result in a string comparison being performed.
The -dc option to make(1) can be used to debug conditional
evalulation.
I can easily "fix" our make code to restore the support for
broken string comparisons with the attached patch, so it's
rather a question of do we want to continue supporting this
bug or not.
Cheers,
-- Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software Ltd, ru@FreeBSD.org FreeBSD committer
- text/plain attachment: p
- application/pgp-signature attachment: stored
- Previous message: Paul Schenkeveld: "Re: Things to remove from /rescue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|