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