Subject: B20: Bug in make with static pattern rules.
From: [email-masked] (Malcolm Purvis)

10 Nov 1998 17:09:30 -0800
Message-ID: <13895.52252.391853.9432.cygnus.gnu-win32@hobbes>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

I have just downloaded and installed the full.exe version of B20 onto my win
95B machine, and immediately set about installing some software that had been
ported to B18, but I don't think has been supported since.  Unfortunately, it
fails with make generating an error.  The following makefile highlights the
problem:

---------------------------------------------------------------------------
# Test for a bug in cygwin gnumake

AA := /a
BB := /a/b

all :: $(AA) $(BB)

$(AA) $(BB) : % :
	mkdir $@

---------------------------------------------------------------------------

When run under B20, it produces the message:

---------------------------------------------------------------------------
make: *** No rule to make target '/a', needed by 'all'.   Stop.
---------------------------------------------------------------------------

While gnumake 3.77 under Solaris produces the expected output:

---------------------------------------------------------------------------
mkdir /a
mkdir /a/b
---------------------------------------------------------------------------

However, it works if the leading '/' is removed from the path in $(BB).  Is
there a problem with absolute path names?

The error seems to be generated because the two paths are being combined into
one path with a space in the name and so the desired targets vanish and make
generates the error.  This can be seen if make's database is dumped (with the
-p argument).  The following is the relevant part of the dump (the rest is
deleted for brevity):

---------------------------------------------------------------------------
/a /a/b:
#  Implicit rule search has not been done.
#  Implicit/static pattern stem: `/a /a/b'
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (from `Makefile.txt', line 9):
	mkdir $@
---------------------------------------------------------------------------

The equivalent parts of the run on Solaris is:

---------------------------------------------------------------------------
/a:
#  Implicit rule search has not been done.
#  Implicit/static pattern stem: `/a'
#  File does not exist.
#  File has been updated.
#  Successfully updated.
# automatic
# ^ := 
# automatic
# @ := /a
# automatic
# + := 
# automatic
# ? := 
# automatic
# * := /a
# automatic
# % := 
# automatic
# < := 
# 7 variables in 23 hash buckets.
# average of 0.3 variables per bucket, max 2 in one bucket.
#  commands to execute (from `Makefile', line 9):
	mkdir $@

/a/b:
#  Implicit rule search has not been done.
#  Implicit/static pattern stem: `/a/b'
#  File does not exist.
#  File has been updated.
#  Successfully updated.
# automatic
# ^ := 
# automatic
# @ := /a/b
# automatic
# + := 
# automatic
# ? := 
# automatic
# * := /a/b
# automatic
# % := 
# automatic
# < := 
# 7 variables in 23 hash buckets.
# average of 0.3 variables per bucket, max 2 in one bucket.
#  commands to execute (from `Makefile', line 9):
	mkdir $@
---------------------------------------------------------------------------

-- 
Malcolm Purvis ([email-masked]) - ABC Technology Research and Development

"I don't want it to be practical, I want it to be *expensive*."
	-- my wife.
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".