ca482e5d |
1 | # makefile for GCCE\r |
2 | \r |
3 | # settings\r |
4 | #dprint = 1\r |
5 | asm_memory = 1\r |
6 | asm_render = 1\r |
7 | asm_blit = 1\r |
8 | #use_musashi = 1\r |
9 | #up = 1\r |
10 | #sis = 1\r |
11 | \r |
12 | # targets\r |
13 | all: $(EPOCROOT2)epoc32 MAKEDIRS RESOURCES PicoDrive.exe\r |
14 | \r |
15 | clean :\r |
16 | @perl -S ermdir.pl _build\r |
17 | @erase 2>>nul rsc\*.rsc\r |
18 | @erase 2>>nul rsc\*.rsg\r |
19 | @erase 2>>nul rsc\PicoDrive.mb?\r |
20 | \r |
21 | \r |
22 | # paths\r |
23 | $(EPOCROOT2)epoc32 :\r |
24 | @echo Please set EPOCROOT2 environmental variable to full path to your SDK\r |
25 | @echo with ending slash (something like C:\Uiq_21\)\r |
26 | @cd : 2> NUL # do something stupid to make it silently fail\r |
27 | \r |
28 | # resource compiler hates drive lettered paths\r |
29 | EPOCROOT2_NODRV = $(filter \\%,$(subst :, ,$(EPOCROOT2)))\r |
30 | EPOCLIB = $(EPOCROOT2)EPOC32\RELEASE\ARMV5\r |
31 | \r |
32 | # C/C++ Compiler\r |
33 | CC=arm-none-symbianelf-gcc\r |
34 | \r |
35 | # Linker\r |
36 | LD=arm-none-symbianelf-ld\r |
37 | \r |
38 | # Assembler\r |
39 | ASM=arm-none-symbianelf-as\r |
40 | \r |
41 | # Archiver\r |
42 | AR=arm-none-symbianelf-ar\r |
43 | \r |
44 | # Strip\r |
45 | STRIP=arm-none-symbianelf-strip\r |
46 | \r |
47 | # gcc config\r |
48 | GCCDEFINES = -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__ \\r |
49 | -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ \\r |
50 | -D__MARM_ARMV5__ -D__PRODUCT_INCLUDE__=\"$(EPOCROOT2)epoc32/include/variant/UIQ_3.0.hrh\"\r |
51 | \r |
52 | GCCDEFINES += -D_UNZIP_SUPPORT -D__BROKEN_FWRITE\r |
53 | \r |
54 | # 'CSL Arm Toolchain' stuff must be specified after Symbian includes\r |
55 | GCCINCLUDES = -I "$(EPOCROOT2)epoc32\include\variant" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC" \\r |
56 | -I "$(EPOCROOT2)\CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3\include" -I.\r |
57 | \r |
58 | # -funit-at-a-time is not compatible with SDK, it either has linker problems or does not start on device\r |
59 | GCCCOMMFLAGS = -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -nostdinc -msoft-float \\r |
60 | $(GCCINCLUDES) -include "$(EPOCROOT2)EPOC32/INCLUDE/GCCE/GCCE.h" -marm\r |
61 | \r |
62 | GCCCPPFLAGS = -x c++ -Wno-ctor-dtor-privacy -O3 -fno-unit-at-a-time\r |
63 | GCCCFLAGS = -x c -O3 -fno-unit-at-a-time\r |
64 | \r |
65 | GCCLDFLAGS = -L"$(EPOCROOT2)CSL Arm Toolchain\arm-none-symbianelf\lib" \\r |
66 | -L"$(EPOCROOT2)CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3" \\r |
67 | --target1-abs --no-undefined -nostdlib -shared -Ttext 0x8000 -Tdata 0x400000 --default-symver\r |
68 | \r |
69 | # libs\r |
70 | LIBS = \\r |
71 | $(EPOCLIB)\LIB\ESTLIB.dso \\r |
72 | $(EPOCLIB)\urel\qikalloc.lib \\r |
73 | $(EPOCLIB)\LIB\euser.dso \\r |
74 | $(EPOCLIB)\LIB\apparc.dso \\r |
75 | $(EPOCLIB)\LIB\cone.dso \\r |
76 | $(EPOCLIB)\LIB\eikcore.dso \\r |
77 | $(EPOCLIB)\LIB\eikcoctl.dso \\r |
78 | $(EPOCLIB)\LIB\qikcore.dso \\r |
79 | $(EPOCLIB)\LIB\qikdlg.dso \\r |
80 | $(EPOCLIB)\LIB\etext.dso \\r |
81 | $(EPOCLIB)\LIB\bafl.dso \\r |
82 | $(EPOCLIB)\LIB\efsrv.dso \\r |
83 | $(EPOCLIB)\LIB\eikctl.dso \\r |
84 | $(EPOCLIB)\LIB\WS32.dso \\r |
85 | $(EPOCLIB)\LIB\EIKDLG.dso \\r |
86 | $(EPOCLIB)\LIB\GDI.dso \\r |
87 | $(EPOCLIB)\LIB\estor.dso \\r |
88 | $(EPOCLIB)\LIB\EZLIB.dso \\r |
89 | $(EPOCLIB)\LIB\HAL.dso \\r |
90 | $(EPOCLIB)\LIB\mediaclient.dso \\r |
91 | $(EPOCLIB)\LIB\mediaclientaudiostream.dso\r |
92 | \r |
93 | LIBS += \\r |
94 | $(EPOCLIB)\LIB\qikallocdll.dso \\r |
95 | $(EPOCLIB)\UREL\usrt2_2.lib \\r |
96 | $(EPOCLIB)\LIB\dfpaeabi.dso \\r |
97 | $(EPOCLIB)\LIB\dfprvct2_2.dso \\r |
98 | $(EPOCLIB)\LIB\drtaeabi.dso \\r |
99 | $(EPOCLIB)\LIB\scppnwdl.dso \\r |
100 | $(EPOCLIB)\LIB\drtrvct2_2.dso\r |
101 | \r |
102 | \r |
103 | # objects\r |
104 | \r |
105 | # launcher\r |
106 | OBJECTS += _build\App.o _build\Engine.o _build\Dialogs.o _build\CSimpleTextParser.o\r |
107 | # engine\r |
108 | OBJECTS += _build\main.o _build\vid.o _build\polledas.o _build\audio_mediaserver.o _build\debug.o\r |
109 | \r |
110 | # Pico\r |
111 | OBJECTS += _build\Area.o _build\Cart.o _build\Utils.o _build\Memory.o _build\Misc.o \\r |
112 | _build\Pico.o _build\Sek.o _build\VideoPort.o _build\Draw2.o _build\Draw.o\r |
113 | # asm stuff\r |
114 | ifeq "$(asm_render)" "1"\r |
115 | GCCDEFINES += -D_ASM_DRAW_C\r |
116 | OBJECTS += _build\draw_asm.o _build\draw2_asm.o\r |
117 | endif\r |
118 | ifeq "$(asm_memory)" "1"\r |
119 | GCCDEFINES += -D_ASM_MEMORY_C\r |
120 | OBJECTS += _build\memory_asm.o\r |
121 | endif\r |
122 | # Pico - sound\r |
123 | OBJECTS += _build\sound.o _build\sn76496.o _build\ym2612.o\r |
124 | # misc\r |
125 | OBJECTS += _build\unzip.o _build\gzio_symb.o\r |
126 | # CPU cores\r |
127 | ifeq "$(use_musashi)" "1"\r |
128 | GCCDEFINES += -DEMU_M68K\r |
129 | OBJECTS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o\r |
130 | else\r |
131 | GCCDEFINES += -DEMU_C68K\r |
132 | OBJECTS += _build\Cyclone.o\r |
133 | endif\r |
134 | ifeq "$(asm_blit)" "1"\r |
135 | OBJECTS += _build\blit_asm.o\r |
136 | else\r |
137 | OBJECTS += _build\blit.o\r |
138 | endif\r |
139 | GCCDEFINES += -D_USE_DRZ80\r |
140 | OBJECTS += _build\DrZ80.o\r |
141 | GCCDEFINES += -D_ASM_YM2612_C\r |
142 | OBJECTS += _build\ym2612_asm.o\r |
143 | \r |
144 | \r |
145 | \r |
146 | # dprint\r |
147 | ifeq "$(dprint)" "1"\r |
148 | GCCDEFINES += -D__DEBUG_PRINT\r |
149 | endif\r |
150 | \r |
151 | \r |
152 | define crule\r |
153 | @echo * $<\r |
154 | @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCFLAGS) $< -o $@\r |
155 | endef\r |
156 | \r |
157 | define cpprule\r |
158 | @echo * $<\r |
159 | @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCPPFLAGS) $< -o $@\r |
160 | endef\r |
161 | \r |
162 | define asmrule\r |
163 | @echo * $<\r |
164 | @$(ASM) -marmv4t -mthumb-interwork -o $@ $^\r |
165 | endef\r |
166 | \r |
167 | # object making rules\r |
168 | _build\App.o : App.cpp\r |
169 | $(cpprule)\r |
170 | _build\Engine.o : Engine.cpp\r |
171 | $(cpprule)\r |
172 | _build\Dialogs.o : Dialogs.cpp\r |
173 | $(cpprule)\r |
174 | _build\CSimpleTextParser.o : CSimpleTextParser.cpp\r |
175 | $(cpprule)\r |
176 | \r |
177 | _build\main.o : engine\main.cpp\r |
178 | $(cpprule)\r |
179 | _build\vid.o : engine\vid.cpp\r |
180 | $(cpprule)\r |
181 | _build\polledas.o: engine\polledas.cpp\r |
182 | $(cpprule)\r |
183 | _build\audio_mediaserver.o : engine\audio_mediaserver.cpp\r |
184 | $(cpprule)\r |
185 | _build\debug.o : engine\debug.cpp\r |
186 | $(cpprule)\r |
187 | _build\blit.o : engine\blit.c\r |
188 | $(crule)\r |
189 | \r |
190 | _build\Area.o : ..\..\Pico\Area.c\r |
191 | $(crule)\r |
192 | _build\Cart.o : ..\..\Pico\Cart.c\r |
193 | $(crule)\r |
194 | _build\Draw.o : ..\..\Pico\Draw.c\r |
195 | $(crule)\r |
196 | _build\Draw2.o : ..\..\Pico\Draw2.c\r |
197 | $(crule)\r |
198 | _build\Memory.o : ..\..\Pico\Memory.c\r |
199 | $(crule)\r |
200 | _build\Misc.o : ..\..\Pico\Misc.c\r |
201 | $(crule)\r |
202 | _build\Pico.o : ..\..\Pico\Pico.c\r |
203 | $(crule)\r |
204 | _build\Sek.o : ..\..\Pico\Sek.c\r |
205 | $(crule)\r |
206 | _build\Utils.o : ..\..\Pico\Utils.c\r |
207 | $(crule)\r |
208 | _build\VideoPort.o : ..\..\Pico\VideoPort.c\r |
209 | $(crule)\r |
210 | _build\sound.o : ..\..\Pico\sound\sound.c\r |
211 | $(crule)\r |
212 | _build\sn76496.o : ..\..\Pico\sound\sn76496.c\r |
213 | $(crule)\r |
214 | _build\ym2612.o : ..\..\Pico\sound\ym2612.c\r |
215 | $(crule)\r |
216 | \r |
217 | _build\unzip.o : ..\..\unzip\unzip.c\r |
218 | $(crule)\r |
219 | _build\gzio_symb.o : ..\..\zlib\gzio_symb.c\r |
220 | $(crule)\r |
221 | \r |
222 | _build\m68kcpu.o : ..\..\musashi\m68kcpu.c\r |
223 | $(crule)\r |
224 | _build\m68kopac.o : ..\..\musashi\m68kopac.c\r |
225 | $(crule)\r |
226 | _build\m68kopdm.o : ..\..\musashi\m68kopdm.c\r |
227 | $(crule)\r |
228 | _build\m68kopnz.o : ..\..\musashi\m68kopnz.c\r |
229 | $(crule)\r |
230 | _build\m68kops.o : ..\..\musashi\m68kops.c\r |
231 | $(crule)\r |
232 | \r |
233 | _build\Cyclone.o : ..\..\cpu\Cyclone\proj\Cyclone.s\r |
234 | $(asmrule)\r |
235 | _build\DrZ80.o : ..\..\cpu\DrZ80\drz80.s\r |
236 | $(asmrule)\r |
237 | _build\draw_asm.o : ..\..\Pico\draw.s\r |
238 | $(asmrule)\r |
239 | _build\draw2_asm.o : ..\..\Pico\draw2.s\r |
240 | $(asmrule)\r |
241 | _build\memory_asm.o : ..\..\Pico\memory.s\r |
242 | $(asmrule)\r |
243 | _build\ym2612_asm.o : ..\..\Pico\sound\ym2612.s\r |
244 | $(asmrule)\r |
245 | _build\blit_asm.o : engine\blit.s\r |
246 | $(asmrule)\r |
247 | \r |
248 | \r |
249 | PicoDrive.exe : $(OBJECTS)\r |
250 | @echo * ld\r |
251 | @$(LD) $(GCCLDFLAGS) -soname PicoDrive{000a0000}[a00010f3].exe --entry _E32Startup -u _E32Startup \\r |
252 | $(EPOCROOT2)EPOC32\RELEASE\ARMV5\UREL\EEXE.LIB -o "_build\PicoDrive_elf.exe" -Map "_build\PicoDrive.exe.map" $(OBJECTS) $(LIBS) -lsupc++ -lgcc\r |
253 | # @echo * strip\r |
254 | # @$(STRIP) _build\PicoDrive_elf.exe\r |
255 | @echo * elf2e32\r |
256 | @elf2e32 --sid=0xa00010f3 --heap=0x00000100,0x00800000 --stack=0x00003000 \\r |
257 | --uid1=0x1000007a --uid2=0x100039ce --uid3=0xa00010f3 \\r |
258 | --capability=none --fpu=softvfp --targettype=EXE --output="$@" \\r |
259 | --elfinput="_build\PicoDrive_elf.exe" --linkas=PicoDrive{000a0000}[a00010f3].exe --libpath="$(EPOCLIB)\LIB"\r |
260 | ifeq "$(sis)" "1"\r |
261 | @make -C _out\r |
262 | ifeq "$(up)" "1"\r |
263 | @qup.cmd\r |
264 | endif\r |
265 | endif\r |
266 | \r |
267 | \r |
268 | MAKEDIRS : _build\r |
269 | \r |
270 | _build :\r |
271 | # @echo * making build dir\r |
272 | @perl -S emkdir.pl $@\r |
273 | \r |
274 | \r |
275 | # BitMap PicoDrive.mbm\r |
276 | \r |
277 | RESOURCES : rsc\PicoDrive.mbm rsc\PicoDrive.RSC rsc\PicoDrive_reg.RSC rsc\PicoDrive_loc.RSC rsc\PicoDrive.mbg\r |
278 | \r |
279 | rsc\PicoDrive.mbg : rsc\PicoDrive.mbm\r |
280 | \r |
281 | rsc\PicoDrive.mbm : rsc\pico18x18.bmp rsc\pico18x18m.bmp rsc\pico40x40.bmp rsc\pico40x40m.bmp rsc\pico64x64.bmp rsc\pico64x64m.bmp\r |
282 | @echo * $@\r |
283 | @perl -S epocmbm.pl -h"rsc\PicoDrive.mbg" -o"rsc\PicoDrive.mbm" -l"\Z\Resource\Apps\:rsc" \\r |
284 | -b"/c24rsc\pico18x18.bmp /8rsc\pico18x18m.bmp /c24rsc\pico40x40.bmp /8rsc\pico40x40m.bmp /c24rsc\pico64x64.bmp /8rsc\pico64x64m.bmp" -l"\Z\Resource\Apps\:rsc"\r |
285 | @perl -S ecopyfile.pl "rsc\PicoDrive.mbg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.mbg"\r |
286 | \r |
287 | # Resource Z\Resource\Apps\PicoDrive.RSC\r |
288 | \r |
289 | rsc\PicoDrive.RSC : rsc\PicoDrive.rss picodrive.hrh\r |
290 | @echo * $@\r |
291 | @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2_NODRV)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive.rss" -o$@ \\r |
292 | -h"rsc\PicoDrive.rsg" -t"rsc" -l"Z\Resource\Apps:rsc"\r |
293 | @perl -S ecopyfile.pl "rsc\PicoDrive.rsg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.RSG"\r |
294 | \r |
295 | # Resource Z\private\10003a3f\apps\PicoDrive_reg.RSC\r |
296 | \r |
297 | rsc\PicoDrive_reg.RSC : rsc\PicoDrive_reg.rss\r |
298 | @echo * $@\r |
299 | @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_reg.rss" -o$@ \\r |
300 | -t"rsc" -l"Z\private\10003a3f\apps:rsc"\r |
301 | \r |
302 | # Resource Z\Resource\Apps\PicoDrive_loc.RSC\r |
303 | \r |
304 | rsc\PicoDrive_loc.RSC : rsc\PicoDrive_loc.rss\r |
305 | @echo * $@\r |
306 | @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_loc.rss" -o$@ \\r |
307 | -t"rsc" -l"Z\Resource\Apps:rsc"\r |