input: make it more modular
[picodrive.git] / platform / uiq2 / Makefile
CommitLineData
cc68a136 1# environmental vars required:\r
2# EPOCROOT2 - root of your SDK with slash at the end\r
3\r
4# settings\r
5#dprint = 1\r
6#mz80 = 1\r
7#debug_cyclone = 1\r
8asm_memory = 1\r
9#asm_render = 1\r
10#use_musashi = 1\r
11\r
12EPOCBLDUREL = _BUILD\r
13EPOCTRGUREL = $(EPOCROOT2)EPOC32\RELEASE\ARMI\UREL\r
14EPOCLINKUREL = $(EPOCTRGUREL)\r
15EPOCSTATLINKUREL = $(EPOCTRGUREL)\r
16\r
17\r
18# must set both PATH and Path to make it work correctly (?)\r
19Path:=$(EPOCROOT2)EPOC32\gcc\bin;$(Path)\r
20PATH:=$(Path)\r
21ERASE = @erase 2>>nul\r
22\r
23\r
24ALL : UREL\r
25UREL : CHECKENV MAKEDIRS\r
26UREL : $(EPOCTRGUREL)\PICOSMALL.EXE\r
27\r
28CLEAN :\r
29 @perl -S ermdir.pl "$(EPOCBLDUREL)"\r
30 @del *.o 2> NUL\r
31\r
32CLEANZ :\r
33 del ..\..\zlib\*.o 2> NUL\r
34\r
35CLEANM :\r
36 del ..\..\musashi\*.o 2> NUL\r
37\r
38CLEANALL : CLEAN CLEANZ CLEANM\r
39\r
40\r
41# check for EPOCROOT2\r
42CHECKENV : $(EPOCROOT2)epoc32\r
43\r
44$(EPOCROOT2)epoc32 :\r
45 @echo Please set EPOCROOT2 environmental variable to full path to your SDK\r
46 @echo with ending slash (something like C:\Uiq_21\)\r
47 @cd : 2> NUL # do something stupid to make it silently fail\r
48\r
49\r
50# GCC\r
51INCDIR = -I. -I "..\..\" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC"\r
52\r
53GCCFLAGS = -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -march=armv4t -mthumb-interwork -pipe -O3 -fomit-frame-pointer\r
54\r
55GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__EXE__ -DNDEBUG -D_UNICODE -DARM\r
56\r
57# dprint\r
58ifeq "$(dprint)" "1"\r
59GCCDEFS += -D__DEBUG_PRINT\r
60endif\r
61# drz80/mz80\r
62ifeq "$(mz80)" "1"\r
63GCCDEFS += -D_USE_MZ80\r
64else\r
65GCCDEFS += -D_USE_DRZ80\r
66endif\r
67# debug_cyclone\r
68ifeq "$(debug_cyclone)" "1"\r
69use_musashi := 1\r
70GCCDEFS += -DEMU_C68K\r
71asm_memory := 0\r
72endif\r
73# musashi\r
74ifeq "$(use_musashi)" "1"\r
75GCCDEFS += -DEMU_M68K\r
76else\r
77GCCDEFS += -DEMU_C68K\r
78endif\r
79\r
80\r
81GCC = gcc -c $(GCCFLAGS) $(GCCDEFS) $(INCDIR)\r
82\r
83\r
84LIBSUREL = \\r
85 $(EPOCSTATLINKUREL)\EGCC.LIB \\r
86 $(EPOCLINKUREL)\ESTLIB.LIB \\r
87 $(EPOCLINKUREL)\WS32.LIB \\r
88 $(EPOCLINKUREL)\HAL.LIB \\r
89 $(EPOCLINKUREL)\EUSER.LIB \\r
90 $(EPOCLINKUREL)\EFSRV.LIB \\r
91 $(EPOCLINKUREL)\EZLIB.LIB\r
92\r
93$(EPOCTRGUREL)\PICOSMALL.EXE : $(EPOCBLDUREL)\PICOSMALL.in $(EPOCSTATLINKUREL)\EEXE.LIB $(LIBSUREL)\r
94 @echo * linking and finishing\r
95 @ld -s -e _E32Startup -u _E32Startup \\r
96 --base-file "$(EPOCBLDUREL)\PICOSMALL.bas" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \\r
97 "$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \\r
98 --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
99 -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE"\r
100 @dlltool -m arm_interwork \\r
101 --base-file "$(EPOCBLDUREL)\PICOSMALL.bas" \\r
102 --output-exp "$(EPOCBLDUREL)\PICOSMALL.exp" \r
103 -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.bas"\r
104 @ld -s -e _E32Startup -u _E32Startup \\r
105 "$(EPOCBLDUREL)\PICOSMALL.exp" \\r
106 -Map "$(EPOCBLDUREL)\PICOSMALL.EXE.map" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \\r
107 "$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \\r
108 --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
109 -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.exp"\r
110ifeq "$(noecompxl)" "1"\r
111 @petran "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \\r
112 -nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \\r
113 -heap 0x00000001 0x00800000\r
114else\r
115 @petran_ "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \\r
116 -nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \\r
117 -heap 0x00000001 0x00800000 -stack 0x80000000\r
118endif\r
119# -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE"\r
120 @perl -S ecopyfile.pl "$@" "PICOSMALL.EXE"\r
121ifeq "$(up)" "1"\r
122 @quploadpico.cmd\r
123endif\r
124\r
125\r
126OBJECTSUREL= \\r
127 $(EPOCBLDUREL)\debug.o \\r
128 $(EPOCBLDUREL)\CART.o \\r
129 $(EPOCBLDUREL)\DRAW.o \\r
130 $(EPOCBLDUREL)\DRAW2.o \\r
131 $(EPOCBLDUREL)\MAIN.o \\r
132 $(EPOCBLDUREL)\MEMORY.o \\r
133 $(EPOCBLDUREL)\PICO.o \\r
134 $(EPOCBLDUREL)\SEK.o \\r
135 $(EPOCBLDUREL)\VIDEOPORT.o \\r
136 $(EPOCBLDUREL)\SIMPLESERVER.o \\r
137 $(EPOCBLDUREL)\VID.o \\r
138 $(EPOCBLDUREL)\Utils.o \\r
139 $(EPOCBLDUREL)\Area.o \\r
140 $(EPOCBLDUREL)\Misc.o \\r
141 $(EPOCBLDUREL)\unzip.o \\r
142 ..\..\zlib\gzio_symb.o \\r
143 $(EPOCBLDUREL)\sound.o \\r
144 $(EPOCBLDUREL)\sn76496.o \\r
145 $(EPOCBLDUREL)\ym2612.o \\r
146 $(EPOCBLDUREL)\blit.o\r
147\r
148ifeq "$(debug_cyclone)" "1"\r
149OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o $(EPOCBLDUREL)\_cyclone_debug.o\r
150endif\r
151# the MUSASHI core\r
152ifeq "$(use_musashi)" "1"\r
153OBJECTSUREL += \\r
154 ..\..\musashi\m68kcpu.o \\r
155 ..\..\musashi\m68kops.o \\r
156 ..\..\musashi\m68kopac.o \\r
157 ..\..\musashi\m68kopdm.o \\r
158 ..\..\musashi\m68kopnz.o \\r
159 ..\..\musashi\m68kdasm.o\r
160else\r
161OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o\r
162endif\r
163\r
164ifeq "$(mz80)" "1"\r
165OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\mz80.o\r
166else\r
167OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\DrZ80.o\r
168endif\r
169\r
170ifeq "$(asm_memory)" "1"\r
171ASMDEFINES += -D_ASM_MEMORY_C\r
172OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\memory_asm.o\r
173endif\r
174\r
175ifeq "$(asm_render)" "1"\r
176ASMDEFINES += -D_ASM_DRAW_C\r
177OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\draw_asm.o $(EPOCBLDUREL)\draw2_asm.o\r
178endif\r
179\r
180$(EPOCBLDUREL)\PICOSMALL.in : $(OBJECTSUREL)\r
181 @echo * ar\r
182 @if exist "$@" del "$@"\r
183 @ar cr $@ $^\r
184\r
185..\..\Cyclone\proj\Cyclone.s :\r
186 @echo You need to build Cyclone first. See Cyclone.txt in cyclone directory.\r
187 @cd : 2> NUL # do something stupid to make it silently fail\r
188\r
189$(EPOCBLDUREL)\Cyclone.o : ..\..\Cyclone\proj\Cyclone.s\r
190 @echo * assembling Cyclone..\r
191 @as -marmv4t -mthumb-interwork -o $@ $^\r
192\r
193$(EPOCBLDUREL)\DrZ80.o : ..\..\pico\sound\DrZ80.s ..\..\pico\sound\DrZ80.h\r
194 @echo * assembling DrZ80..\r
195 @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\sound\DrZ80.s\r
196\r
197\r
198# Source\r
199\r
200$(EPOCBLDUREL)\debug.o : debug.cpp debug.h\r
201 @echo * debug.cpp\r
202 @$(GCC) -o $@ debug.cpp\r
203\r
204$(EPOCBLDUREL)\MAIN.o : Main.cpp ..\..\pico\picoInt.h vid.h SimpleServer.h ClientServer.h audio.h debug.h\r
205 @echo * Main.cpp\r
206 @$(GCC) -o $@ "Main.cpp"\r
207\r
208$(EPOCBLDUREL)\VID.o : VID.cpp vid.h ClientServer.h ..\..\pico\picoInt.h\r
209 @echo * Vid.cpp\r
210 @$(GCC) -o $@ "VID.cpp"\r
211\r
212$(EPOCBLDUREL)\SIMPLESERVER.o : SIMPLESERVER.cpp version.h ClientServer.h SimpleServer.h ..\..\pico\picoInt.h debug.h\r
213 @echo * SimpleServer.cpp\r
214 @$(GCC) -o $@ "SIMPLESERVER.cpp"\r
215\r
216$(EPOCBLDUREL)\CART.o : ..\..\pico\Cart.c ..\..\pico\picoInt.h ..\..\pico\Pico.h ..\..\unzip\unzip.h\r
217 @echo * Cart.c\r
218 @$(GCC) -D_UNZIP_SUPPORT -o $@ "..\..\pico\Cart.c"\r
219\r
220$(EPOCBLDUREL)\DRAW.o : ..\..\pico\Draw.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
221 @echo * Draw.c\r
222 @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw.c"\r
223#\r
224\r
225$(EPOCBLDUREL)\DRAW2.o : ..\..\pico\Draw2.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
226 @echo * Draw2.c\r
227 @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw2.c"\r
228\r
229$(EPOCBLDUREL)\MEMORY.o : ..\..\pico\Memory.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
230 @echo * Memory.c\r
231 @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Memory.c"\r
232\r
233$(EPOCBLDUREL)\PICO.o : ..\..\pico\Pico.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
234 @echo * Pico.c\r
235 @$(GCC) -o $@ "..\..\pico\Pico.c"\r
236\r
237$(EPOCBLDUREL)\SEK.o : ..\..\pico\Sek.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
238 @echo * Sek.c\r
239 @$(GCC) -o $@ "..\..\pico\Sek.c"\r
240\r
241$(EPOCBLDUREL)\VIDEOPORT.o : ..\..\pico\Videoport.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
242 @echo * Videoport.c\r
243 @$(GCC) -o $@ "..\..\pico\Videoport.c"\r
244\r
245$(EPOCBLDUREL)\Utils.o : ..\..\pico\Utils.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
246 @echo * Utils.c\r
247 @$(GCC) -o $@ "..\..\pico\Utils.c"\r
248\r
249$(EPOCBLDUREL)\Area.o : ..\..\pico\Area.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
250 @echo * Area.c\r
251 @$(GCC) -o $@ "..\..\pico\Area.c"\r
252\r
253$(EPOCBLDUREL)\Misc.o : ..\..\pico\Misc.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
254 @echo * Misc.c\r
255 @$(GCC) -o $@ "..\..\pico\Misc.c"\r
256\r
257$(EPOCBLDUREL)\unzip.o : ..\..\unzip\unzip.c ..\..\unzip\unzip.h\r
258 @echo * unzip.c\r
259 @$(GCC) -o $@ "..\..\unzip\unzip.c"\r
260\r
261# assembly "optimized" stuff\r
262$(EPOCBLDUREL)\blit.o : blit.s\r
263 @echo * blit.s\r
264 @as -marmv4t -mthumb-interwork -o $@ blit.s\r
265\r
266$(EPOCBLDUREL)\draw_asm.o : ..\..\pico\draw.s\r
267 @echo * draw.s\r
268 @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw.s\r
269\r
270$(EPOCBLDUREL)\draw2_asm.o : ..\..\pico\draw2.s\r
271 @echo * draw2.s\r
272 @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw2.s\r
273\r
274$(EPOCBLDUREL)\memory_asm.o : ..\..\pico\memory.s\r
275 @echo * memory.s\r
276 @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\memory.s\r
277\r
278# sound stuff\r
279$(EPOCBLDUREL)\sound.o : ..\..\pico\sound\sound.c ..\..\pico\sound\sound.h\r
280 @echo * sound.c\r
281 @$(GCC) -o $@ "..\..\pico\sound\sound.c"\r
282\r
283$(EPOCBLDUREL)\ym2612.o : ..\..\pico\sound\ym2612.c ..\..\pico\sound\ym2612.h ..\..\pico\sound\driver.h\r
284 @echo * ym2612.c\r
285 @$(GCC) -o $@ "..\..\pico\sound\ym2612.c"\r
286\r
287$(EPOCBLDUREL)\sn76496.o : ..\..\pico\sound\sn76496.c ..\..\pico\sound\sn76496.h ..\..\pico\sound\driver.h\r
288 @echo * sn76496.c\r
289 @$(GCC) -o $@ "..\..\pico\sound\sn76496.c"\r
290\r
291$(EPOCBLDUREL)\mz80.o : ..\..\pico\sound\mz80.c ..\..\pico\sound\mz80.h\r
292 @echo * mz80.c\r
293 @$(GCC) -o $@ "..\..\pico\sound\mz80.c"\r
294\r
295# -D__DEBUG_PRINT_SND\r
296\r
297# misc\r
298\r
299$(EPOCBLDUREL)\_cyclone_debug.o : ..\..\pico\_cyclone_debug.c\r
300 @echo * _cyclone_debug.c\r
301 @$(GCC) -o $@ "..\..\pico\_cyclone_debug.c"\r
302\r
303# generic rule for generic C stuff\r
304\r
305.c.o:\r
306 @echo * $<\r
307 @$(GCC) $< -o $@\r
308\r
309\r
310\r
311# --- SRCFILES END ---\r
312\r
313\r
314# Rules to create all necessary directories\r
315\r
316MAKEDIRS : \\r
317 _build\r
318\r
319_build :\r
320 @echo * making build dir\r
321 @perl -S emkdir.pl $@\r