]> git.sur5r.net Git - cc65/blob - doc/compile.txt
30a2cf7c7a6055fe7fb9eeb69b006f845f493da5
[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 cc65
72 if exist .depend goto ahead1
73 make -f make\gcc.mak
74 :ahead1
75 make -f make\gcc.mak
76 move *.exe ..\binutils
77
78 cd ..\cl65
79 if exist .depend goto ahead2
80 make -f make\gcc.mak
81 :ahead2
82 make -f make\gcc.mak
83 move *.exe ..\binutils
84
85 cd ..\binutils\common
86 if exist .depend goto ahead3
87 make -f make\gcc.mak
88 :ahead3
89 make -f make\gcc.mak
90
91 cd ..\ca65
92 if exist .depend goto ahead4
93 make -f make\gcc.mak
94 :ahead4
95 make -f make\gcc.mak
96 move *.exe ..
97
98 cd ..\ld65
99 if exist .depend goto ahead5
100 make -f make\gcc.mak
101 :ahead5
102 make -f make\gcc.mak
103 move *.exe ..
104
105 cd ..\ar65
106 if exist .depend goto ahead6
107 make -f make\gcc.mak
108 :ahead6
109 make -f make\gcc.mak
110 move *.exe ..
111
112 cd ..\..\lib\common
113 make 'CFLAGS=-Oi -I../../include/'
114 ar65 a common.lib *.o
115 move common.lib ..
116
117 cd ..\runtime
118 make 'CFLAGS=-Oi -I../../include/'
119 ar65 a runtime.lib *.o
120 move runtime.lib ..
121
122  --
123
124 In djgpp.env I use:
125
126 +LFN=Y
127
128 for the .depend file.
129
130  --
131
132 And in autoexec.bat I have:
133
134 set CC65_INC=E:\djgpp_v2\cc65\include
135 set CC65_LIB=E:\djgpp_v2\cc65\lib
136 PATH=E:\djgpp_v2\cc65\binutils;%PATH%
137
138 -------------------------------------------------------------------------
139
140
141 OS/2 using the EMX compiler
142 ---------------------------
143
144 If you're using OS/2 and have the EMX compiler and some GNU tools
145 installed, you may also be able to compile the tools and libraries
146 under OS/2. Mirco Miranda (mircomir@libero.it) sent me the following
147 notes:
148
149
150 -------------------------------------------------------------------------
151
152 CC65 make facilities V0.3 for OS/2 by Mirco Miranda
153 Date: 02/01/2000
154
155 OS2HOWTO.TXT... I wrote this very fast... I hope that you can
156 understand...
157
158 Emx is a porting of gcc under OS/2. I wrote some C code that with
159 simply (and few) preprocessor line can be compiled under OS/2 and Linux.
160 Now for emx there are projects like P2 that let's add to OS/2 a complete
161 Posix.1/SUS-like environment... I think that in the future the porting
162 from bsd unix (and I hope linux) environment can be made very easy...
163
164 These are the things because I tried to compile CC65 with emx/gcc...
165
166 WARNING: at time that as wrote compiling with emx/gcc give some warnings.
167
168
169 1. What do you need
170 -------------------
171
172 - emx/gcc 0.9D for OS/2
173
174 http://hobbes.nmsu.edu/cgi-bin/h-browse?sh=1&dir=/pub/os2/dev/emx/v0.9d
175
176 - gnu make
177
178 http://hobbes.nmsu.edu/pub/os2/dev/util/gnumake.zip
179
180 - bash
181
182 Use (ba)sh coming with this package.
183 There are many porting of unix shell for OS/2 and some don't
184 work propely.
185
186 - and finally the source package of the CC65
187   http://www.cc65.org/#Download
188   http://www.acc.umu.se/~arvid/cc65_mirror/cc65-sources-2.6.0.tar.gz
189
190 I hope that's all! I have the complete emx/gnu tools installed on
191 my OS/2 and I haven't test if you need other package. Sorry.
192
193
194 2. Setup environment in OS/2
195 ----------------------------
196
197 Unpack source package in a Directory and
198 copy the files in src directory of source code.
199
200 Install emx 0.9D following the istruction comes with it.
201 Emx is well documented and I don't rewrite here emx documentation.
202
203 Unpack the gnu make tool and copy make-os2.exe in ...\emx\gnu directory
204 then rename it in make.exe
205
206 Copy xxsh.exe in ...\emx\gnu directory
207
208
209 If you want use my .cmd script (makeos2emx.cmd):
210
211 - copy it in src directory
212 - edit it and change the emx path(s) according with your(s).
213   (set MYEMXPATH=c:\appos2\emx)
214
215 else
216
217 - add ...\emx\gnu directory on your libpath
218 - add ...\emx\gnu directiry on your path
219 - set comspec=...\emx\gnu\xxsh.exe
220 - run make -f make/gcc.mak in src directory
221 - run make in libsrc directory
222
223 3. My make files
224 ----------------
225
226 If you use zap command, *.exe are not deleted.
227
228
229 4. Author & Disclaimer
230 ----------------------
231
232 Mirco Miranda
233 mircomir@libero.it
234 ICQ#: 51640305
235
236 I haven't tested the generated code of cc65 executables with emx/gcc...
237 If you use the cc65 executables compiled with emx/gcc to compile the library,
238 please test it before hardly or productivity using.
239
240 Safety solution is compile the cc65 executables with Watcom and then
241 compile the library using gnu make and gnu (ba)sh coming with this package.
242 If you use this last solution you must have only installed emx runtime because
243 make.exe and xxsh.exe use it!
244
245 -------------------------------------------------------------------------
246
247
248
249 DOS, Windows, OS/2 using the Watcom Compiler
250 --------------------------------------------
251
252 This is what I'm using. You need the Borland make in addition to the
253 Watcom tools, or you have to change the makefile.
254
255 1. Copy %WATCOM%\src\startup\wildargv.c from your Watcom directory into
256    binutils\common.
257
258 2. Enter
259
260         make -f make\watcom.mak
261
262    in the src/ directory.
263
264 3. Use Linux to build the libraries:-) If you don't have Linux, get it
265    now! More serious: There is no makefile to build the libraries under
266    any of the DOS based operating systems. Use a batch file similar to
267    the one above, or rewrite the makefile.
268
269
270