delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/08/20:28:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <42572294.3F74051@dessent.net>
Date: Fri, 08 Apr 2005 17:32:20 -0700
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Make, TMP=tmpnam => coredump
References: <PDEBLOPEKAOKEBIONCMIKEHNFAAA DOT larry AT eBizCreators DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

Larry wrote:

> The problem I found is that the Makefile contains the statement
> 'TMP=tmpnam'. The build fails after the program builds a file $(TMP).
> Apparently, the local tmpnam.exe file that gets built gets called when make
> attempts to build the remaining files. (Is there a way to disable the pwd to
> test this?) I've verified this problem on two out of three machines.
> 
> Does anybody know about this bug? Can someone please confirm what I'm
> experiencing?
> 
> Here's a simple test to confirm:
> 
> Makefile
> --------
> TMP=tmpnam
> 
> all: $(TMP) program
>     gcc -c program.c
> --------------------------
> 
> create two identical files tmpnam.c and program.c with the following code:
> --------------------------
> #include <stdio.h>
> 
> int main()
> {
>     printf("Hello World!");
> }
> --------------------------
> 
> Type make. This is what I get:
> 
> C:\Temp\Chap04\>make
> gcc     tmpnam.c   -o tmpnam
> gcc     program.c   -o program
> make: *** [program] Aborted (core dumped)

With the three files mentioned above, I get

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

...which is correct because there is nothing in the Makefile to tell
make how to make 'tmpnam'.  I suspect there is something else going on
in your case, such as some kind of implicit ".c.o" or ".c.exe" rule, or
some other makefile rules being included.  Your test makefile above
doesn't make much sense anyway, because "gcc -c program.c" will compile
but not link program.c, creating program.o, which in no way satisfies
either dependency of the rule.

Are you sure the 'make' and 'gcc' that are in your path are Cygwin's and
not some win32 tools?

And just so you know... Cygwin tries to provide a POSIX environment but
there are still many differences between it and linux.  I wouldn't
expect every example to work the same.  The .exe extension is one main
one that comes up in makefiles.  Another example is that -lm is totally
superfluous under Cygwin.  Also realize that under Windows the
environment variable $TMP is used as the location to place temporary
files, and is a horrible choice for the name of a variable to use in a
Makefile.  That's a good example of how not to write a portable
makefile...

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019