delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/09/26/05:15:57

From: vance AT deneb DOT com (Stephen Vance)
Subject: Re: gcc produces foo.exe, not foo
26 Sep 1998 05:15:57 -0700 :
Message-ID: <360BA99B.6DBB00B6.cygnus.gnu-win32@deneb.com>
References: <Pine DOT HPP DOT 3 DOT 95 DOT 980924111126 DOT 1831B-100000 AT grimer DOT diku DOT dk>
Mime-Version: 1.0
To: Arne Glenstrup <panic AT diku DOT dk>
Cc: gnu-win32 AT cygnus DOT com

<HTML>
Arne Glenstrup wrote:
<BLOCKQUOTE TYPE=CITE>Now that we have established that we need some (in
my opinion) dirty
<BR>$(EXEEXT)-stuff, what is the consensus on how to use it with regards
to
<BR>makefile targets and -o switches to compilers? Should a makefile look
<BR>like this:

<P>&nbsp; EXEEXT = @EXEEXT@

<P>&nbsp; goal$(EXEEXT): goal.c
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$(CC) -o goal$(EXEEXT) goal.c
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
cp goal$(EXEEXT) anothergoal$(EXEEXT)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mv goal$(EXEEXT) yet.another.goal

<P>or should it look like this:

<P>&nbsp; EXEEXT = @EXEEXT@

<P>&nbsp; goal:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; goal.c
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$(CC) -o goal goal.c
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
cp goal$(EXEEXT) anothergoal$(EXEEXT)
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mv goal$(EXEEXT) yet.another.goal</BLOCKQUOTE>
Actually, for really portable makefiles, you need to consider that not
all compilers and linkers use -o.&nbsp; Specifically, MSVC uses /OUT: with
not trailing space.&nbsp; Here's a remedy in pseudo-GNUmake syntax.
<BR>&nbsp;
<PRE>NULLSTRING =</PRE>

<PRE>SPACE = $(NULLSTRING) # DO NOT REMOVE.&nbsp; End of line.</PRE>

<PRE></PRE>

<PRE>if $(MSVC)</PRE>

<PRE>LDOUT = /OUT:</PRE>

<PRE>else</PRE>

<PRE>LDOUT = -o$(SPACE)</PRE>

<PRE>endif</PRE>

<PRE>foo$(EXEEXT): foo$(OBJEXT)</PRE>

<PRE>&nbsp;&nbsp;&nbsp; $(CC) $(LDOUT)$@ $(LDFLAGS) $?</PRE>

<PRE>--&nbsp;
Stephen Vance&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; <A HREF="http://www.deneb.com">http://www.deneb.com</A>
Deneb Robotics, Inc.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; <A HREF="mailto:vance AT deneb DOT com">mailto:vance AT deneb DOT com</A>
5500 New King Street&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; Phone: (248) 267-9696
Troy, MI 48098-2615&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; Fax:&nbsp;&nbsp; (248) 267-8585

What is done well is done quickly enough. -Augustus Caesar</PRE>
&nbsp;</HTML>

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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