SekRunPS Cyclone integration
[picodrive.git] / platform / gp2x / Makefile
... / ...
CommitLineData
1\r
2# you may or may not need to change this\r
3#devkit_path = x:/stuff/dev/devkitgp2x/\r
4CROSS = arm-linux-\r
5#CROSS = $(devkit_path)bin/arm-linux-\r
6\r
7# settings\r
8dprint = 1\r
9#mz80 = 1\r
10#debug_cyclone = 1\r
11asm_memory = 0 # TODO\r
12asm_render = 1\r
13asm_ym2612 = 1\r
14asm_misc = 1\r
15asm_cdpico = 1\r
16#profile = 1\r
17#use_musashi = 1\r
18#up = 1\r
19\r
20DEFINC = -I../.. -I. -DARM -D__GP2X__ -D_UNZIP_SUPPORT # -DBENCHMARK\r
21COPT_COMMON = -static -O3 -ftracer -fstrength-reduce -Wall -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math # -s\r
22ifeq "$(profile)" "1"\r
23COPT_COMMON += -fprofile-generate\r
24endif\r
25ifeq "$(profile)" "2"\r
26COPT_COMMON += -fprofile-use\r
27endif\r
28COPT = $(COPT_COMMON) -mtune=arm920t\r
29ASOPT = -mcpu=arm920t -mfloat-abi=soft\r
30GCC = $(CROSS)gcc\r
31STRIP = $(CROSS)strip\r
32AS = $(CROSS)as\r
33LD = $(CROSS)ld\r
34OBJCOPY = $(CROSS)objcopy\r
35\r
36# frontend\r
37OBJS += main.o menu.o fonts.o gp2x.o usbjoy.o emu.o squidgehack.o asmutils.o cpuctrl.o\r
38# 940 core control\r
39OBJS += 940ctl.o\r
40# Pico\r
41OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory.o ../../Pico/Misc.o \\r
42 ../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \\r
43 ../../Pico/Patch.o\r
44# Pico - CD\r
45OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \\r
46 ../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \\r
47 ../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o\r
48# asm stuff\r
49ifeq "$(asm_render)" "1"\r
50DEFINC += -D_ASM_DRAW_C\r
51OBJS += ../../Pico/draw_asm.o ../../Pico/draw2_asm.o\r
52endif\r
53ifeq "$(asm_memory)" "1"\r
54DEFINC += -D_ASM_MEMORY_C\r
55OBJS += ../../Pico/memory_asm.o\r
56endif\r
57ifeq "$(asm_ym2612)" "1"\r
58DEFINC += -D_ASM_YM2612_C\r
59OBJS += ../../Pico/sound/ym2612_asm.o\r
60endif\r
61ifeq "$(asm_misc)" "1"\r
62DEFINC += -D_ASM_MISC_C\r
63OBJS += ../../Pico/misc_asm.o\r
64endif\r
65ifeq "$(asm_cdpico)" "1"\r
66DEFINC += -D_ASM_CD_PICO_C\r
67OBJS += ../../Pico/cd/pico_asm.o\r
68endif\r
69# Pico - sound\r
70OBJS += ../../Pico/sound/mix_asm.o\r
71OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o\r
72# zlib\r
73OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \\r
74 ../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o\r
75# unzip\r
76OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o\r
77# mp3\r
78OBJS += mp3.o\r
79# CPU cores\r
80ifeq "$(use_musashi)" "1"\r
81DEFINC += -DEMU_M68K\r
82OBJS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o\r
83else\r
84DEFINC += -DEMU_C68K\r
85OBJS += ../../cpu/Cyclone/proj/Cyclone.o\r
86endif\r
87# drz80/mz80\r
88ifeq "$(mz80)" "1"\r
89DEFINC += -D_USE_MZ80\r
90OBJS += ../../cpu/mz80/mz80.o\r
91else\r
92DEFINC += -D_USE_DRZ80\r
93OBJS += ../../cpu/DrZ80/drz80.o\r
94endif\r
95\r
96\r
97all: PicoDrive.gpe\r
98\r
99PicoDrive.gpe : $(OBJS) helix/helix_mp3.a\r
100 @echo $@\r
101 @$(GCC) -o $@ $(COPT) $^ -lm -Wl,-Map=PicoDrive.map\r
102ifeq ($(DEBUG),)\r
103 @$(STRIP) $@\r
104endif\r
105# @$(GCC) $(COPT) $(OBJS) -lm -o PicoDrive_.gpe\r
106# @gpecomp PicoDrive_.gpe $@\r
107ifeq "$(up)" "1"\r
108 @cmd //C copy $@ \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\\r
109endif\r
110\r
111up: PicoDrive.gpe\r
112 @cp -v PicoDrive.gpe /mnt/gp2x/mnt/sd/games/PicoDrive/\r
113\r
114# @cmd //C copy PicoDrive.gpe \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\\r
115\r
116\r
117testrefr.gpe : test.o gp2x.o asmutils.o\r
118 @echo $@\r
119 @$(GCC) $(COPT) $^ -o $@\r
120 @$(STRIP) $@\r
121\r
122.c.o:\r
123 @echo $<\r
124 @$(GCC) $(COPT) $(DEFINC) -c $< -o $@\r
125.s.o:\r
126 @echo $<\r
127 @$(GCC) $(COPT) $(DEFINC) -c $< -o $@\r
128\r
129../../Pico/draw_asm.o : ../../Pico/Draw.s\r
130 @echo $<\r
131 @$(AS) $(ASOPT) $< -o $@\r
132../../Pico/draw2_asm.o : ../../Pico/Draw2.s\r
133 @echo $<\r
134 @$(AS) $(ASOPT) $< -o $@\r
135../../Pico/memory_asm.o : ../../Pico/Memory.s\r
136 @echo $<\r
137 @$(AS) $(ASOPT) $< -o $@\r
138../../Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s\r
139 @echo $<\r
140 @$(AS) $(ASOPT) $< -o $@\r
141../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s\r
142 @echo $<\r
143 @$(AS) $(ASOPT) $< -o $@\r
144../../Pico/misc_asm.o : ../../Pico/misc.s\r
145 @echo $<\r
146 @$(AS) $(ASOPT) $< -o $@\r
147../../Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s\r
148 @echo $<\r
149 @$(AS) $(ASOPT) $< -o $@\r
150\r
151# build Cyclone\r
152../../cpu/Cyclone/proj/Cyclone.s :\r
153 @echo building Cyclone...\r
154 @make -C ../../cpu/Cyclone/proj -f Makefile.linux\r
155\r
156# build helix libs\r
157helix/helix_mp3.a:\r
158 make -C helix\r
159\r
160\r
161# cleanup\r
162clean: tidy\r
163 @$(RM) PicoDrive.gpe\r
164tidy:\r
165 @$(RM) $(OBJS)\r
166# @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean\r
167\r
168\r
169clean_prof:\r
170 find ../.. -name '*.gcno' -delete\r
171 find ../.. -name '*.gcda' -delete\r
172\r
173# ----------- release -----------\r
174ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r
175ifeq ($(VER),)\r
176$(error need VER)\r
177endif\r
178endif\r
179\r
180rel: PicoDrive.gpe code940/code940.bin ../readme.txt config.txt\r
181 zip -9 -j ../../PicoDrive_$(VER).zip $^ mmuhack.o\r
182\r
183code940/code940.bin:\r
184 make -C code940/\r
185\r
186\r
187# test\r
188usbjoy.o : usbjoy.c\r
189 @echo $<\r
190 @$(GCC) $(COPT) $(DEFINC) -fno-profile-generate -c $< -o $@\r
191\r
192../../Pico/Cart.o : ../../Pico/Cart.c\r
193 @echo $<\r
194 @$(GCC) $(COPT) $(DEFINC) -fno-profile-generate -c $< -o $@\r
195\r
196../../zlib/trees.o : ../../zlib/trees.c\r
197 @echo $<\r
198 @$(GCC) $(COPT) $(DEFINC) -fno-profile-generate -c $< -o $@\r
199\r