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