Subject: Re: Make, TMP=tmpnam => coredump
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Fri, 08 Apr 2005 19:03:21 -0700

Larry wrote:

> Did you create two identical .c files, one named program.c and the
> other named tmpnam.c? I get the same error you report when I haven't
> created the tmpnam.c file.
> 
> I appreciate your additional helpful comments. I wish I was more
> experienced to know how to look further into debugging this.

Yes, I made both .c files:

$ ls -l
total 3.0K
-rw-r--r--  1 brian None 50 Apr  8 18:52 Makefile
-rw-r--r--  1 brian None 67 Apr  8 17:12 program.c
-rw-r--r--  1 brian None 67 Apr  8 17:12 tmpname.c

$ cat Makefile
TMP=tmpnam

all: $(TMP) program
	gcc -c program.c

# note, I had to change the Makefile to use a tab instead of 4 spaces

$ make
make: *** No rule to make target `tmpnam', needed by `all'.  Stop.

I suspect that you have some other flavor of make installed on your
system (like perhaps MSYS or MinGW or something) that is including extra
rule processing and/or is running make in "win32" mode.  As written the
above Makefile should do nothing.  It's saying "to build 'all', first
make sure 'tmpnam' and 'program' are up to date, then run 'gcc -c
program.c'" which doesn't make any sense because you haven't told it how
to make tmpnam or program.  However, if there was an implicit ".c.exe"
rule coming from somewhere that might do it.

Anyway, assuming you're at the cygwin bash prompt, try the following

$ make -v
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

$ type make
make is hashed (/usr/bin/make)

$ type gcc
gcc is hashed (/usr/bin/gcc)

If you get something different then check your path and see if any
non-Cygwin versions of those tools are installed.

Also, if you just want to work around the error, try changing the
Makefiles in your book to not use TMP as a variable name.  You don't
want to use that under Windows... I'm not sure where the core dump is
coming from, to be honest, since I can't replicate what's happening.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/