]> git.sur5r.net Git - cc65/blob - doc/compile.txt
getfd.o: new object file
[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
22         make clean atarilib
23         make clean c64lib
24         make clean c128lib
25         make clean plus4lib
26         make clean cbm610lib
27         make clean petlib
28         make clean apple2lib
29
30 Be sure to say "clean" each time, since some of the sources have a
31 "#ifdef <target_system>".
32
33
34
35 DOS using the DJGPP compiler
36 ----------------------------
37
38 Most information in this section was provided by Keith W. Gerdes
39 (kwg@freebird.ghofn.org). Thanks a lot!
40
41 The tmpfile() function in DJGPP has a bug and will not open the scratch
42 file in binary mode. If you have problems with the archiver (which uses
43 the tmpfile() function), you have two choices:
44
45   1. Get a fix from http://www.cartsys.com/eldredge/djgpp-patches.html
46      and apply it. This will solve the problem once and forever.
47
48   2. For a temporary solution, in the file binutils/ar65/main.c, add the
49      following lines:
50
51      At top:
52
53         #include <fcntl.h>
54
55      At start of main:
56
57         _fmode = O_BINARY;
58
59      This will switch the default mode to binary and will work around the
60      bug.
61
62 Keith sent me the following notes how to build the tools on a DOS system
63 using DJGPP (add your system type to CFLAGS if needed):
64
65 -------------------------------------------------------------------------
66
67 Here's my current batch file:
68
69 cd cc65
70 if exist .depend goto ahead1
71 make -f make\gcc.mak
72 :ahead1
73 make -f make\gcc.mak
74 move *.exe ..\binutils
75
76 cd ..\cl65
77 if exist .depend goto ahead2
78 make -f make\gcc.mak
79 :ahead2
80 make -f make\gcc.mak
81 move *.exe ..\binutils
82
83 cd ..\binutils\common
84 if exist .depend goto ahead3
85 make -f make\gcc.mak
86 :ahead3
87 make -f make\gcc.mak
88
89 cd ..\ca65
90 if exist .depend goto ahead4
91 make -f make\gcc.mak
92 :ahead4
93 make -f make\gcc.mak
94 move *.exe ..
95
96 cd ..\ld65
97 if exist .depend goto ahead5
98 make -f make\gcc.mak
99 :ahead5
100 make -f make\gcc.mak
101 move *.exe ..
102
103 cd ..\ar65
104 if exist .depend goto ahead6
105 make -f make\gcc.mak
106 :ahead6
107 make -f make\gcc.mak
108 move *.exe ..
109
110 cd ..\..\lib\common
111 make 'CFLAGS=-Oi -I../../include/'
112 ar65 a common.lib *.o
113 move common.lib ..
114
115 cd ..\runtime
116 make 'CFLAGS=-Oi -I../../include/'
117 ar65 a runtime.lib *.o
118 move runtime.lib ..
119
120  --
121
122 In djgpp.env I use:
123
124 +LFN=Y
125
126 for the .depend file.
127
128  --
129
130 And in autoexec.bat I have:
131
132 set CC65_INC=E:\djgpp_v2\cc65\include
133 set CC65_LIB=E:\djgpp_v2\cc65\lib
134 PATH=E:\djgpp_v2\cc65\binutils;%PATH%
135
136 -------------------------------------------------------------------------
137
138
139 DOS, Windows, OS/2 using the Watcom Compiler
140 --------------------------------------------
141
142 This is what I'm using. You need the Borland make in addition to the
143 Watcom tools, or you have to change the makefile.
144
145 1. Copy %WATCOM%\src\startup\wildargv.c from your Watcom directory into
146    binutils\common.
147
148 2. Enter
149
150         make -f make\watcom.mak
151
152    in the src/ directory.
153
154 3. Use Linux to build the libraries:-) If you don't have Linux, get it
155    now! More serious: There is no makefile to build the libraries under
156    any of the DOS based operating systems. Use a batch file similar to 
157    the one above, or rewrite the makefile.
158
159