1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: Makefile Output Directory</TITLE>
<META NAME="description" CONTENT="Crystal Space: Makefile Output Directory">
<META NAME="keywords" CONTENT="Crystal Space: Makefile Output Directory">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC632"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_265.html#SEC631"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_267.html#SEC633"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_262.html#SEC628"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_263.html#SEC629"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_267.html#SEC633"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H3> 8.3.3 Output Directory </H3>
<!--docid::SEC632::-->
<P>
To avoid polluting the entire directory hierarchy with temporary and
intermediate files, all output from the build process should be placed into a
separate directory intended specifically for such transient files. By default
this directory is named as follows, and assigned to the makefile variable
`<SAMP>OUT</SAMP>'.
</P><P>
<TABLE><tr><td> </td><td class=example><pre>OUT = out/$(OS)/$(PROC)/$(MODE)$(MAKE_DLL)
</pre></td></tr></table></P><P>
So, if you're building a dynamic library for Linux on an x86 machine, the
output directory would be named `<TT>out/LINUX/X86/optimize.so/</TT>'. To
reference to the output directory you should use the variable <CODE>$(OUT)</CODE> in
your submakefiles. For example, the following rule tells `<SAMP>make</SAMP>' how to
compile `<TT>.cpp</TT>' files:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>$(OUT)%$O: %.cpp
$(DO.COMPILE.CPP)
</pre></td></tr></table></P><P>
This rule assumes that the `<TT>.cpp</TT>' file is located in the current
directory; this is wrong of course. We can avoid this problem in several
ways. The typical solution is to define a <CODE>vpath</CODE> for `<TT>.cpp</TT>' files,
this way:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>vpath %.cpp libs/csutil libs/cssys libs/csgfxldr
</pre></td></tr></table></P><P>
This forces `<SAMP>make</SAMP>' to look for `<TT>.cpp</TT>' files in all mentioned
directories. The overall rule is that each submakefile defines an additional
`<SAMP>vpath</SAMP>' for its own directory or directories. For example, the
submakefile that defines the rules for building <CODE>$(CSSYS.LIB)</CODE>, the
Crystal Space system library, defines the following `<SAMP>vpath</SAMP>':
</P><P>
<TABLE><tr><td> </td><td class=example><pre>vpath %.cpp libs/cssys
</pre></td></tr></table></P><P>
However, sometimes you want a separate rule for one or several files. In this
case you can define a rule for building an object file in the <CODE>$(OUT)</CODE>
directory from a source file in given directory. If we take the above
example, we could write, instead of that `<SAMP>vpath</SAMP>' directive, the
following:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>$(OUT)%$O: libs/cssys/%.cpp
$(DO.COMPILE.CPP) $(CFLAGS.CSSYS)
</pre></td></tr></table></P><P>
If you would like a separate rule for just one or several specific files, you
could do it this way:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>vpath %.cpp libs/cssys
$(OUT)file1$O: libs/cssys/file1.cpp
$(DO.COMPILE.CPP) $(CFLAGS.CSSYS)
$(OUT)file2$O: libs/cssys/file2.cpp
$(DO.COMPILE.CPP) $(CFLAGS.CSSYS)
</pre></td></tr></table><A NAME="Memory Debugger"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_265.html#SEC631"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_267.html#SEC633"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_262.html#SEC628"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_263.html#SEC629"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_267.html#SEC633"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>
|