912-914.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 85 行

HTML
85
字号
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Source Code Control</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=56//-->

<!--PAGES=912-914//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="909-911.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch57/915-917.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H3><A NAME="Heading17"></A><FONT COLOR="#000077">Tying It All Together: Working with make and RCS</FONT></H3>

<P>The <TT>make</TT> program supports interaction with RCS, enabling you to have a largely complete software development environment. However, the whole issue of using <TT>make</TT> with RCS is a sticky one if your software project involves several people sharing source code files. Clearly, it may be problematic if someone is compiling files that need to be stable in order to do your own software testing. This may be more of a communication and scheduling issue between team members than anything else. At any rate, using <TT>make</TT> with RCS can be very convenient for a single programmer, particularly in the Linux envi-ronment.</P>

<P><TT>make</TT> can handle RCS files through the application of user-defined suffix rules that recognize the <TT>,v</TT> suffix. RCS interfaces well with <TT>make</TT> because its files use the <TT>,v</TT> suffix, which works well within a suffix rule. You can write a set of RCS-specific suffix rules to compile C code as follows:</P>

<!-- CODE SNIP //-->

<PRE>

CO = co

.c,v.o:

      &#36;&#123;CO&#125; &#36;&lt;

      &#36;&#123;CC&#125; &#36;&#123;CFLAGS&#125; -c &#36;*.c

      - rm -f &#36;*.c

</PRE>

<!-- END CODE SNIP //-->

<P>The <TT>CO</TT> macro represents the RCS check-out command. The <TT>&#36;*.c</TT> macro is necessary because <TT>make</TT> automatically strips off the <TT>.c</TT> suffix. The hyphen preceding the <TT>rm</TT> command instructs <TT>make</TT> to continue, even if the <TT>rm</TT> fails. For <TT>main.c</TT> stored in RCS, <TT>make</TT> generates these commands:</P>

<!-- CODE SNIP //-->

<PRE>

co main.c

cc -O -c main.c

rm -f main.c

</PRE>

<!-- END CODE SNIP //-->

<H3><A NAME="Heading18"></A><FONT COLOR="#000077">Summary</FONT></H3>

<P>Linux offers two key utilities for managing software development: <TT>make</TT> and RCS. <TT>make</TT> is a program that generates commands for compilation, linking, and other related development activities. <TT>make</TT> can manage dependencies between source code and object files so that an entire project can be recompiled as much as is required for it to be up-to-date. RCS is a set of source code control programs that enables several developers to work on a software project simultaneously. It manages the use of a source code file by keeping a history of editing changes that have been applied to it.</P>

<P>The other benefit of versioning control is that it can, in many cases, reduce disk space requirements for a project. CVS is an enhancement to the RCS programs. It automatically provides for the merging of revisions. This capability enables several developers to work on the same source code file at once, with the caveat that they are responsible for any merging conflicts that arise.</P>

<P>After reading about version systems, you may be more interested in getting to work programming with RCS. From here, logical chapters to read are:</P>

<DL>

<DD>Chapter 26, &#147;Programming in C,&#148; and Chapter 27, &#147;Programming in C&#43;&#43;,&#148; if you want to tie your C or C&#43;&#43; programming with <TT>make</TT> and RCS.

<DD>Chapter 30, &#147;Other Compilers,&#148; if you want to find out which languages are supported by Linux.

<DD>Chapter 31, &#147;Smalltalk/X,&#148; if you want to learn about the GUI-based version of the popular object-oriented programming language Smalltalk.

</DL>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="909-911.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch57/915-917.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?