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