55 lines
2.2 KiB
HTML
55 lines
2.2 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||
|
<TITLE>cc65 Compiler Intro: The easy way (using the cl65 utility)</TITLE>
|
||
|
<LINK HREF="intro-6.html" REL=next>
|
||
|
<LINK HREF="intro-4.html" REL=previous>
|
||
|
<LINK HREF="intro.html#toc5" REL=contents>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<A HREF="intro-6.html">Next</A>
|
||
|
<A HREF="intro-4.html">Previous</A>
|
||
|
<A HREF="intro.html#toc5">Contents</A>
|
||
|
<HR>
|
||
|
<H2><A NAME="using-cl65"></A> <A NAME="s5">5.</A> <A HREF="intro.html#toc5">The easy way (using the cl65 utility)</A></H2>
|
||
|
|
||
|
|
||
|
<P>The <B>cl65</B> utility is able to do all of the steps described above, in just
|
||
|
one command line, and it has defaults for some options that are very
|
||
|
well-suited for our example.</P>
|
||
|
<P>To compile both files into one executable, enter:</P>
|
||
|
<P>
|
||
|
<BLOCKQUOTE><CODE>
|
||
|
<PRE>
|
||
|
cl65 -O -I ../../include -L ../../lib hello.c text.s
|
||
|
</PRE>
|
||
|
</CODE></BLOCKQUOTE>
|
||
|
</P>
|
||
|
<P>(The <CODE>-I</CODE> option is not needed if you are working under a Unix-like system
|
||
|
with the include files in their default path, or if the <CODE>CC65_INC</CODE>
|
||
|
environment variable is set correctly. The <CODE>-L</CODE> option is not needed if the
|
||
|
libraries are in their default path, or if the <CODE>CC65_LIB</CODE> environment
|
||
|
variable is set correctly. [Those two environment variables should be set to
|
||
|
absolute paths.])</P>
|
||
|
<P>The <B>cl65</B> utility knows how to translate C files into object files (it will
|
||
|
call the compiler, and then, the assembler). It does know also how to create
|
||
|
object files from assembly files (it will call only the assembler, for that).
|
||
|
It knows how to build an executable (it will pass all object files to the
|
||
|
linker). And finally, it has the C64 as a default target, and will supply the
|
||
|
correct startup file and runtime library names to the linker, so you don't
|
||
|
have to care about that.</P>
|
||
|
<P>The one-liner above should give you a C64 executable named "<CODE>hello</CODE>" in the
|
||
|
current directory.</P>
|
||
|
<P>For more information about the compile & link utility, see
|
||
|
<A HREF="cl65.html">cl65.html</A>.</P>
|
||
|
|
||
|
|
||
|
|
||
|
<HR>
|
||
|
<A HREF="intro-6.html">Next</A>
|
||
|
<A HREF="intro-4.html">Previous</A>
|
||
|
<A HREF="intro.html#toc5">Contents</A>
|
||
|
</BODY>
|
||
|
</HTML>
|