]> git.sur5r.net Git - cc65/blob - doc/compile.txt
Improved cbm_dir routines by Thomas Giesel.
[cc65] / doc / compile.txt
1
2
3 Instructions for compiling cc65 and the ca65 binutils:
4
5
6 Linux (and probably most other Unices)
7 --------------------------------------
8                            
9 Preconditions:
10
11 You need the GNU C Compiler, Perl and sgml-tools installed.
12
13 The simple way:
14
15 From the main directory, use
16
17         make -f make/gcc.mak
18
19 to build all binaries, libraries and the docs. Use
20
21         make -f make/gcc.mak install
22
23 to install the files. Check the makefile before doing so and adjust the PREFIX
24 variable as you like it.
25
26
27 Step by step:
28
29 Enter the src/ directory and do a
30
31         make -f make/gcc.mak
32
33 This will build all executables. You may use
34
35         make -f make/gcc.mak strip
36
37 to remove debugging information from the binaries.
38
39 After that, you need to compile the libraries. Do
40
41         cd libsrc; make
42
43 HTML docs can be generated with
44
45         cd doc; make html
46
47 That's it! Installation directories for the RPM packages are
48
49         /usr/bin                        for the binaries
50         /usr/lib/cc65/include           for include files
51         /usr/lib/cc65/lib               for libraries and startup files
52         /usr/share/doc/cc65-<version>   for documentation
53
54 When using these directories, you don't need to set the CC65_INC and
55 CC65_LIB environment variables. You may also use the /usr/local tree
56 for installation, but the compiler and linker have no predefined search
57 path for this directory, so you need the environment variables or
58 change the search paths in the source.
59
60
61
62 DOS using the DJGPP compiler
63 ----------------------------
64
65 Most information in this section was provided by Keith W. Gerdes
66 (kwg@netzero.net). Thanks a lot!
67
68 The tmpfile() function in DJGPP has a bug and will not open the scratch
69 file in binary mode. If you have problems with the archiver (which uses
70 the tmpfile() function), you have two choices:
71
72   1. Get a fix from http://www.cartsys.com/eldredge/djgpp-patches.html
73      and apply it. This will solve the problem once and forever.
74
75   2. For a temporary solution, in the file binutils/ar65/main.c, add the
76      following lines:
77
78      At top:
79
80         #include <fcntl.h>
81
82      At start of main:
83
84         _fmode = O_BINARY;
85
86      This will switch the default mode to binary and will work around the
87      bug.
88
89 Keith sent me the following notes how to build the tools on a DOS system
90 using DJGPP (add your system type to CFLAGS if needed):
91
92 -------------------------------------------------------------------------
93
94 Here's my current batch file:
95
96 cd djgpp_v2\cc65
97
98 if exist bin\nul goto ahead
99 mkdir bin
100 mkdir lib
101 :ahead
102
103 cd src\common
104 make -f make\gcc.mak
105
106 cd ..\ar65
107 make -f make\gcc.mak
108 del ar65
109 strip ar65.exe
110 move ar65.exe ..\..\bin
111
112 cd ..\ca65
113 make -f make\gcc.mak
114 del ca65
115 strip ca65.exe
116 move ca65.exe ..\..\bin
117
118 cd ..\cc65
119 make -f make\gcc.mak
120 del cc65
121 strip cc65.exe
122 move cc65.exe ..\..\bin
123
124 cd ..\cl65
125 make -f make\gcc.mak
126 del cl65
127 strip cl65.exe
128 move cl65.exe ..\..\bin
129
130 cd ..\da65
131 make -f make\gcc.mak
132 del da65
133 strip da65.exe
134 move da65.exe ..\..\bin
135
136 cd ..\grc
137 make -f make\gcc.mak
138 del grc
139 strip grc.exe
140 move grc.exe ..\..\bin
141
142 cd ..\ld65
143 make -f make\gcc.mak
144 del ld65
145 strip ld65.exe
146 move ld65.exe ..\..\bin
147
148 cd ..\od65
149 make -f make\gcc.mak
150 del od65
151 strip od65.exe
152 move od65.exe ..\..\bin
153
154 cd ..\..
155
156 cd libsrc\common
157 make "CC=cc65" "CFLAGS=-Osir -g -t none -I../../include" "AS=ca65"
158 "AFLAGS=-t none"
159 ar65 a common.lib *.o
160 move common.lib ..\..\lib
161
162 cd ..\runtime
163 make "CC=cc65" "CFLAGS=-Osir -g -t none -I../../include" "AS=ca65"
164 "AFLAGS=-t none"
165 ar65 a runtime.lib *.o
166 move runtime.lib ..\..\lib
167
168  --
169
170 In djgpp.env I use:
171
172 +LFN=Y
173
174 for the .depend file.
175
176  --
177
178 And in autoexec.bat I have:
179
180 set CC65_INC=E:\djgpp_v2\cc65\include
181 set CC65_LIB=E:\djgpp_v2\cc65\lib
182 PATH=E:\djgpp_v2\cc65\binutils;%PATH%
183
184 -------------------------------------------------------------------------
185
186
187 OS/2 using the EMX compiler
188 ---------------------------
189
190 If you're using OS/2 and have the EMX compiler and some GNU tools
191 installed, you may also be able to compile the tools and libraries
192 under OS/2. Mirco Miranda (mircomir@libero.it) sent me the following
193 notes:
194
195
196 -------------------------------------------------------------------------
197
198 CC65 make facilities V0.3 for OS/2 by Mirco Miranda
199 Date: 02/01/2000
200
201 OS2HOWTO.TXT... I wrote this very fast... I hope that you can
202 understand...
203
204 Emx is a porting of gcc under OS/2. I wrote some C code that with
205 simply (and few) preprocessor line can be compiled under OS/2 and Linux.
206 Now for emx there are projects like P2 that let's add to OS/2 a complete
207 Posix.1/SUS-like environment... I think that in the future the porting
208 from bsd unix (and I hope linux) environment can be made very easy...
209
210 These are the things because I tried to compile CC65 with emx/gcc...
211
212 WARNING: at time that as wrote compiling with emx/gcc give some warnings.
213
214
215 1. What do you need
216 -------------------
217
218 - emx/gcc 0.9D for OS/2
219
220 http://hobbes.nmsu.edu/cgi-bin/h-browse?sh=1&dir=/pub/os2/dev/emx/v0.9d
221
222 - gnu make
223
224 http://hobbes.nmsu.edu/pub/os2/dev/util/gnumake.zip
225
226 - bash
227
228 Use (ba)sh coming with this package.
229 There are many porting of unix shell for OS/2 and some don't
230 work propely.
231
232 - and finally the source package of the CC65
233   http://www.cc65.org/#Download
234   http://www.acc.umu.se/~arvid/cc65_mirror/cc65-sources-2.6.0.tar.gz
235
236 I hope that's all! I have the complete emx/gnu tools installed on
237 my OS/2 and I haven't test if you need other package. Sorry.
238
239
240 2. Setup environment in OS/2
241 ----------------------------
242
243 Unpack source package in a Directory and
244 copy the files in src directory of source code.
245
246 Install emx 0.9D following the istruction comes with it.
247 Emx is well documented and I don't rewrite here emx documentation.
248
249 Unpack the gnu make tool and copy make-os2.exe in ...\emx\gnu directory
250 then rename it in make.exe
251
252 Copy xxsh.exe in ...\emx\gnu directory
253
254
255 If you want use my .cmd script (makeos2emx.cmd):
256
257 - copy it in src directory
258 - edit it and change the emx path(s) according with your(s).
259   (set MYEMXPATH=c:\appos2\emx)
260
261 else
262
263 - add ...\emx\gnu directory on your libpath
264 - add ...\emx\gnu directiry on your path
265 - set comspec=...\emx\gnu\xxsh.exe
266 - run make -f make/gcc.mak in src directory
267 - run make in libsrc directory
268
269 3. My make files
270 ----------------
271
272 If you use zap command, *.exe are not deleted.
273
274
275 4. Author & Disclaimer
276 ----------------------
277
278 Mirco Miranda
279 mircomir@libero.it
280 ICQ#: 51640305
281
282 I haven't tested the generated code of cc65 executables with emx/gcc...
283 If you use the cc65 executables compiled with emx/gcc to compile the library,
284 please test it before hardly or productivity using.
285
286 Safety solution is compile the cc65 executables with Watcom and then
287 compile the library using gnu make and gnu (ba)sh coming with this package.
288 If you use this last solution you must have only installed emx runtime because
289 make.exe and xxsh.exe use it!
290
291 -------------------------------------------------------------------------
292
293
294
295 DOS, Windows, OS/2 using the Watcom Compiler
296 --------------------------------------------
297
298 This is what I'm using. You need the Borland make in addition to the
299 Watcom tools, or you have to change the makefile.
300
301 1. Copy %WATCOM%\src\startup\wildargv.c from your Watcom directory into
302    binutils\common.
303
304 2. Enter
305
306         make -f make\watcom.mak
307
308    in the src/ directory.
309
310 3. Use Linux to build the libraries:-) If you don't have Linux, get it
311    now! More serious: There is no makefile to build the libraries under
312    any of the DOS based operating systems. Use a batch file similar to
313    the one above, or rewrite the makefile.
314
315
316