cue/bin finally implemented
[picodrive.git] / platform / uiq3 / Makefile
CommitLineData
cc68a136 1# makefile for GCCE\r
2\r
3# settings\r
4#dprint = 1\r
5asm_memory = 1\r
6asm_render = 1\r
7asm_blit = 1\r
8#use_musashi = 1\r
9#up = 1\r
10#sis = 1\r
11\r
12# targets\r
13all: $(EPOCROOT2)epoc32 MAKEDIRS RESOURCES PicoDrive.exe\r
14\r
15clean :\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
29EPOCROOT2_NODRV = $(filter \\%,$(subst :, ,$(EPOCROOT2)))\r
30EPOCLIB = $(EPOCROOT2)EPOC32\RELEASE\ARMV5\r
31\r
32# C/C++ Compiler\r
33CC=arm-none-symbianelf-gcc\r
34\r
35# Linker\r
36LD=arm-none-symbianelf-ld\r
37\r
38# Assembler\r
39ASM=arm-none-symbianelf-as\r
40\r
41# Archiver\r
42AR=arm-none-symbianelf-ar\r
43\r
44# Strip\r
45STRIP=arm-none-symbianelf-strip\r
46\r
47# gcc config\r
48GCCDEFINES = -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
52GCCDEFINES += -D_UNZIP_SUPPORT -D__BROKEN_FWRITE\r
53\r
54# 'CSL Arm Toolchain' stuff must be specified after Symbian includes\r
55GCCINCLUDES = -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
59GCCCOMMFLAGS = -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
62GCCCPPFLAGS = -x c++ -Wno-ctor-dtor-privacy -O3 -fno-unit-at-a-time\r
63GCCCFLAGS = -x c -O3 -fno-unit-at-a-time\r
64\r
65GCCLDFLAGS = -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
70LIBS = \\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
93LIBS += \\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
106OBJECTS += _build\App.o _build\Engine.o _build\Dialogs.o _build\CSimpleTextParser.o\r
107# engine\r
108OBJECTS += _build\main.o _build\vid.o _build\polledas.o _build\audio_mediaserver.o _build\debug.o\r
109\r
110# Pico\r
111OBJECTS += _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
114ifeq "$(asm_render)" "1"\r
115GCCDEFINES += -D_ASM_DRAW_C\r
116OBJECTS += _build\draw_asm.o _build\draw2_asm.o\r
117endif\r
118ifeq "$(asm_memory)" "1"\r
119GCCDEFINES += -D_ASM_MEMORY_C\r
120OBJECTS += _build\memory_asm.o\r
121endif\r
122# Pico - sound\r
123OBJECTS += _build\sound.o _build\sn76496.o _build\ym2612.o\r
124# misc\r
125OBJECTS += _build\unzip.o _build\gzio_symb.o\r
126# CPU cores\r
127ifeq "$(use_musashi)" "1"\r
128GCCDEFINES += -DEMU_M68K\r
129OBJECTS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o\r
130else\r
131GCCDEFINES += -DEMU_C68K\r
132OBJECTS += _build\Cyclone.o\r
133endif\r
134ifeq "$(asm_blit)" "1"\r
135OBJECTS += _build\blit_asm.o\r
136else\r
137OBJECTS += _build\blit.o\r
138endif\r
139GCCDEFINES += -D_USE_DRZ80\r
140OBJECTS += _build\DrZ80.o\r
141GCCDEFINES += -D_ASM_YM2612_C\r
142OBJECTS += _build\ym2612_asm.o\r
143\r
144\r
145\r
146# dprint\r
147ifeq "$(dprint)" "1"\r
148GCCDEFINES += -D__DEBUG_PRINT\r
149endif\r
150\r
151\r
152define crule\r
153 @echo * $<\r
154 @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCFLAGS) $< -o $@\r
155endef\r
156\r
157define cpprule\r
158 @echo * $<\r
159 @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCPPFLAGS) $< -o $@\r
160endef\r
161\r
162define asmrule\r
163 @echo * $<\r
164 @$(ASM) -marmv4t -mthumb-interwork -o $@ $^\r
165endef\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
249PicoDrive.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
260ifeq "$(sis)" "1"\r
261 @make -C _out\r
262ifeq "$(up)" "1"\r
263 @qup.cmd\r
264endif\r
265endif\r
266\r
267\r
268MAKEDIRS : _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
277RESOURCES : rsc\PicoDrive.mbm rsc\PicoDrive.RSC rsc\PicoDrive_reg.RSC rsc\PicoDrive_loc.RSC rsc\PicoDrive.mbg\r
278\r
279rsc\PicoDrive.mbg : rsc\PicoDrive.mbm\r
280\r
281rsc\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
289rsc\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
297rsc\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
304rsc\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