]> git.sur5r.net Git - cc65/blob - doc/cl65.sgml
76a51993ffdef6795a91ed61f7f0d7d1b0bd0593
[cc65] / doc / cl65.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4 <title>cl65 Users Guide
5 <author>Ullrich von Bassewitz, <tt/uz@musoftware.de/
6 <date>01.08.2000
7 <abstract>cl65 is the compile &amp; link utility for cc65.
8 </abstract>
9
10 <!-- Table of contents -->
11 <toc>
12
13 <!-- Begin the document -->
14
15 <sect>Overview<p>
16
17 cl65 is a frontend for cc65, ca65 and ld65. While you may not use the full
18 power of the tools when calling them through cl65, most features are
19 available, and the use of cl65 is much simpler.
20
21
22 <sect>Basic Usage<p>
23
24 The cl65 compile and link utility may be used to compile, assemble and
25 link files. While the separate tools do just one step, cl65 knows how to
26 build object files from C files (by calling the compiler, then the
27 assembler) and other things.
28
29 <tscreen><verb>
30 ---------------------------------------------------------------------------
31 Usage: cl65 [options] file
32 Short options:
33   -A                    Strict ANSI mode
34   -C name               Use linker config file
35   -Cl                   Make local variables static
36   -D sym[=defn]         Define a preprocessor symbol
37   -I dir                Set a compiler include directory path
38   -Ln name              Create a VICE label file
39   -O                    Optimize code
40   -Oi                   Optimize code, inline functions
41   -Or                   Optimize code, honour the register keyword
42   -Os                   Optimize code, inline known C funtions
43   -S                    Compile but don't assemble and link
44   -V                    Print the version number
45   -W                    Suppress warnings
46   -c                    Compiler and assemble but don't link
47   -d                    Debug mode
48   -g                    Add debug info
49   -h                    Help (this text)
50   -m name               Create a map file
51   -o name               Name the output file
52   -t sys                Set the target system
53   -v                    Verbose mode
54   -vm                   Verbose map file
55
56 Long options:
57   --ansi                Strict ANSI mode
58   --asm-include-dir dir Set an assembler include directory
59   --debug               Debug mode
60   --debug-info          Add debug info
61   --help                Help (this text)
62   --include-dir dir     Set a compiler include directory path
63   --target sys          Set the target system
64   --version             Print the version number
65   --verbose             Verbose mode
66 ---------------------------------------------------------------------------
67 </verb></tscreen>
68
69 Most of the options have the same meaning than the corresponding compiler,
70 assembler or linker option. See the documentation for these tools for an
71 explanation. If an option is available for more than one of the tools, it
72 is set for all tools, where it is available. One example for this is <tt/-v/:
73 The compiler, the assembler and the linker are all called with the <tt/-v/
74 switch.
75
76 There are a few remaining options that control the behaviour of cl65:
77
78 <descrip>
79
80   <tag><tt>-S</tt></tag>
81
82   This option forces cl65 to stop after the assembly step. This means that
83   C files are translated into assembler files, but nothing more is done.
84   Assembler files, object files and libraries given on the command line
85   are ignored.
86
87
88   <tag><tt>-c</tt></tag>
89
90   This options forces cl65 to stop after the assembly step. This means
91   that C and assembler files given on the command line are translated into
92   object files, but there is no link step, and object files and libraries
93   given on the command line are ignored.
94
95
96   <tag><tt>-o name</tt></tag>
97
98   The -o option is used for the target name in the final step. This causes
99   problems, if the linker will not be called, and there are several input
100   files on the command line. In this case, the name given with -o will be
101   used for all of them, which makes the option pretty useless. You
102   shouldn't use -o when more than one output file is created.
103
104
105   <tag><tt>-t sys, --target sys</tt></tag>
106
107   The default for this option is different from the compiler and linker in
108   the case that the option is missing: While the compiler and linker will
109   use the "none" system settings by default, cl65 will use the C64 as a
110   target system by default. This was choosen since most people seem to use
111   cc65 to develop for the C64.
112
113 </descrip>
114
115
116
117 <sect>More usage<p>
118
119 Since cl65 was created to simplify the use of the cc65 development
120 package, it tries to be smart about several things.
121
122 <itemize>
123
124 <item>  If you don't give a target system on the command line, cl65
125         defaults to the C64.
126
127 <item>  When linking, cl65 will supply the names of the startup file and
128         library for the target system to the linker, so you don't have to do
129         that.
130
131 <item>  If the final step is the linker, and the name of the output file was
132         not explicitly given, cl65 will use the name of the first input file
133         without the extension, provided that the name of this file has an
134         extension. So you don't need to name the executable name in most
135         cases, just give the name of your "main" file as first input file.
136 </itemize>
137
138
139 <sect>Examples<p>
140
141 The morse trainer software, which consists of one C file (morse.c) and one
142 assembler file (irq.s) will need the following separate steps to compile
143 into an executable named morse:
144
145 <tscreen><verb>
146         cc65 -g -Oi -t c64 morse.c
147         ca65 -g morse.s
148         ca65 -g irq.s
149         ld65 -t c64 -o morse c64.o morse.o irq.o c64.lib
150 </verb></tscreen>
151
152 When using cl65, this is simplified to
153
154 <tscreen><verb>
155         cl65 -g -Oi morse.c irq.s
156 </verb></tscreen>
157
158 As a general rule, you may use cl65 instead of cc65 at most times,
159 especially in makefiles to build object files directly from C files. Use
160
161 <tscreen><verb>
162         .c.o:
163                 cl65 -g -Oi $<
164 </verb></tscreen>
165
166 to do this.
167
168
169
170 <sect>Bugs/Feedback<p>
171
172 If you have problems using the utility, if you find any bugs, or if you're
173 doing something interesting with it, I would be glad to hear from you. Feel
174 free to contact me by email (<htmlurl url="uz@cc65.org" name="uz@cc65.org">).
175
176
177
178 <sect>Copyright<p>
179
180 cl65 (and all cc65 binutils) are (C) Copyright 1998-2000 Ullrich von
181 Bassewitz. For usage of the binaries and/or sources the following
182 conditions do apply:
183
184 This software is provided 'as-is', without any expressed or implied
185 warranty.  In no event will the authors be held liable for any damages
186 arising from the use of this software.
187
188 Permission is granted to anyone to use this software for any purpose,
189 including commercial applications, and to alter it and redistribute it
190 freely, subject to the following restrictions:
191
192 <enum>
193 <item>  The origin of this software must not be misrepresented; you must not
194         claim that you wrote the original software. If you use this software
195         in a product, an acknowledgment in the product documentation would be
196         appreciated but is not required.
197 <item>  Altered source versions must be plainly marked as such, and must not
198         be misrepresented as being the original software.
199 <item>  This notice may not be removed or altered from any source
200         distribution.
201 </enum>
202
203
204
205 </article>
206