bug-gnu-utils
[Top][All Lists]
Advanced

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

gnu make bug


From: Laurie Moye
Subject: gnu make bug
Date: Fri, 16 Feb 2001 18:18:10 GMT

Hi,

For years, I have used a little test in my make files to ensure that
code compiled with CFLAGS=-g on the make comand line gets put into
libdbg and bindbg directories:

ifneq (  , $(findstring -g, $(CFLAGS)) )
    DBG = dbg
endif

I have just tried to compile some of this code on a Linux machine with
GNU Make version 3.74 and I find the ifneq is always true and my code
is always put into the debug directories regardless.

I constructed the following two test makefiles:
------------------------------------------------------------------------------
# TITLE: testmake1

ifneq (  , $(findstring -g, $(CFLAGS)) )
    DBG = dbg
endif

phony:  echo

echo:
        # $(DBG)
        # $(findstring -g, $(CFLAGS))
------------------------------------------------------------------------------
# TITLE: testmake2

ifneq "" "$(findstring -g, $(CFLAGS))"
    DBG = dbg
endif

phony:  echo

echo:
        # $(DBG)
        # $(findstring -g, $(CFLAGS))
------------------------------------------------------------------------------
When I run them I get:
titan0/HMMTools: make -f testmake1               
# dbg
# 
titan0/HMMTools: make -f testmake1 CFLAGS=-g     
# dbg
# -g
titan0/HMMTools: make -f testmake2
# 
# 
titan0/HMMTools: make -f testmake2 CFLAGS=-g
# dbg
# -g
------------------------------------------------------------------------------
Which seems to confirm that the bracketted form of the ifneq fails to
recognise the sort of empty string returned by findstring when it
fails.

There is only one snag:-
these two test files give exactly the same results when run on a DEC
alpha using GNU Make version 3.71, or on a Pentium running netbsd
using GNU Make version 3.74, even though my makefiles, which use this
exact construct run correctly on these two machines, putting the
optimised code in the bin and lib directories and the debug code in
the libdbg and bindbg directories just as they always have done. I
must admit to being completely mistified.

Regards,
        Laurie

-- 
                      Laurie Moye at 20/20 Speech Ltd.
    Malvern Hills Science Park, Geraldine Rd., MALVERN, Worcs WR14 3SZ, UK
      Phone: +44 1684 585121                    Fax:    +44 1684 585151



reply via email to

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