Mail Archives: cygwin/1998/09/26/05:15:57
<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> EXEEXT = @EXEEXT@
<P> goal$(EXEEXT): goal.c
<BR>
$(CC) -o goal$(EXEEXT) goal.c
<BR>
cp goal$(EXEEXT) anothergoal$(EXEEXT)
<BR>
mv goal$(EXEEXT) yet.another.goal
<P>or should it look like this:
<P> EXEEXT = @EXEEXT@
<P> goal: goal.c
<BR>
$(CC) -o goal goal.c
<BR>
cp goal$(EXEEXT) anothergoal$(EXEEXT)
<BR>
mv goal$(EXEEXT) yet.another.goal</BLOCKQUOTE>
Actually, for really portable makefiles, you need to consider that not
all compilers and linkers use -o. Specifically, MSVC uses /OUT: with
not trailing space. Here's a remedy in pseudo-GNUmake syntax.
<BR>
<PRE>NULLSTRING =</PRE>
<PRE>SPACE = $(NULLSTRING) # DO NOT REMOVE. 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> $(CC) $(LDOUT)$@ $(LDFLAGS) $?</PRE>
<PRE>--
Stephen Vance | <A HREF="http://www.deneb.com">http://www.deneb.com</A>
Deneb Robotics, Inc. | <A HREF="mailto:vance AT deneb DOT com">mailto:vance AT deneb DOT com</A>
5500 New King Street | Phone: (248) 267-9696
Troy, MI 48098-2615 | Fax: (248) 267-8585
What is done well is done quickly enough. -Augustus Caesar</PRE>
</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 -