bug-make
[Top][All Lists]
Advanced

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

[bug #63352] nested conditional wrongly reports extraneous endif


From: Paul D. Smith
Subject: [bug #63352] nested conditional wrongly reports extraneous endif
Date: Sun, 13 Nov 2022 17:22:16 -0500 (EST)

Update of bug #63352 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #3:

This is not a bug in GNU make.

Your makefile is malformed; make conditional statements must have a space
after them in order to be recognized.  Your makefile:

ifneq (,)
  ifeq(,)
  endif
endif

is equivalent (to the GNU make parser) to this:

ifneq (,)
  yadayadayada
  endif
endif


As you can see, you _DO_ have an extraneous endif here; you have one *ifneq*
and two *endif*s.

The reason the issue "only manifests when the outer condition fails" is
because when the outer condition fails, the contents of the if-statement are
not parsed by the make parser so make doesn't realize that the text is
invalid.  This is a feature, not a bug: many makefiles make use of this to
allow content in a makefile that would otherwise be considered a syntax
error.

If you change it so the outer condition succeeds, and make _does_ parse the
content, then you get an error which should point you to the problem:

$ cat Makefile
ifeq (,)
  ifeq(,)
  endif
endif

$ make
Makefile:2: *** missing separator.  Stop.


Obviously to make your original makefile correct, you just need to add a space
after the *ifeq*:

ifneq (,)
  ifeq (,)
  endif
endif



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63352>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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