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