FAMEC idle loops, PSP port sync, minor adjustments
[picodrive.git] / platform / gp2x / Makefile
CommitLineData
cc68a136 1\r
2# you may or may not need to change this\r
3#devkit_path = x:/stuff/dev/devkitgp2x/\r
da42200b 4export CROSS = arm-linux-\r
cc68a136 5#CROSS = $(devkit_path)bin/arm-linux-\r
6\r
7# settings\r
cc68a136 8#mz80 = 1\r
0af33fe0 9#debug_cyclone = 1\r
66fdc0f0 10asm_memory = 1\r
cc68a136 11asm_render = 1\r
12asm_ym2612 = 1\r
3a81ecde 13asm_misc = 1\r
7336a99a 14asm_cdpico = 1\r
4ff2d527 15asm_cdmemory = 1\r
e8151fd5 16amalgamate = 0\r
cc68a136 17#profile = 1\r
18#use_musashi = 1\r
19#up = 1\r
20\r
2d0b15bb 21\r
22ifeq "$(debug_cyclone)" "1"\r
23use_cyclone = 1\r
24use_musashi = 1\r
2270612a 25endif\r
26ifeq "$(use_musashi)" "1"\r
27asm_cdpico = 0\r
2d0b15bb 28asm_memory = 0\r
29asm_cdmemory = 0\r
2270612a 30else\r
2d0b15bb 31use_cyclone = 1\r
32endif\r
33\r
3ec29f01 34DEFINC = -I../.. -I. -DARM -D__GP2X__ # -DBENCHMARK\r
1dceadae 35COPT_COMMON = -static -Wall -Winline\r
36ifeq ($(DEBUG),)\r
ca61ee42 37COPT_COMMON += -O3 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math\r
1dceadae 38else\r
39COPT_COMMON += -ggdb\r
40endif\r
cc68a136 41ifeq "$(profile)" "1"\r
42COPT_COMMON += -fprofile-generate\r
43endif\r
44ifeq "$(profile)" "2"\r
45COPT_COMMON += -fprofile-use\r
46endif\r
47COPT = $(COPT_COMMON) -mtune=arm920t\r
48ASOPT = -mcpu=arm920t -mfloat-abi=soft\r
49GCC = $(CROSS)gcc\r
50STRIP = $(CROSS)strip\r
51AS = $(CROSS)as\r
52LD = $(CROSS)ld\r
53OBJCOPY = $(CROSS)objcopy\r
54\r
55# frontend\r
e5f426aa 56OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o\r
cc68a136 57# 940 core control\r
85f8e929 58OBJS += 940ctl.o\r
eff55556 59\r
e5f426aa 60# common\r
58c86d00 61OBJS += ../common/emu.o ../common/menu.o ../common/fonts.o ../common/config.o ../common/arm_utils.o \\r
da42200b 62 ../common/readpng.o ../common/mp3_helix.o\r
e5f426aa 63\r
cc68a136 64# Pico\r
eff55556 65ifeq "$(amalgamate)" "1"\r
66OBJS += ../../PicoAll.o\r
67else\r
68OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \\r
b67ef287 69 ../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \\r
70 ../../Pico/Patch.o\r
8c1952f0 71# Pico - CD\r
72OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \\r
9037e45d 73 ../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/cue.o ../../Pico/cd/gfx_cd.o \\r
0a051f55 74 ../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o\r
eff55556 75endif\r
c9e1affc 76# Pico - Pico\r
4b9c5888 77OBJS += ../../Pico/Pico/Pico.o ../../Pico/Pico/Memory.o ../../Pico/Pico/xpcm.o\r
0ffefdb8 78# Pico - carthw\r
14565041 79OBJS += ../../Pico/carthw/carthw.o ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o \\r
80 ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/compiler.o ../../Pico/carthw/svp/stub_arm.o\r
eff55556 81\r
cc68a136 82# asm stuff\r
83ifeq "$(asm_render)" "1"\r
84DEFINC += -D_ASM_DRAW_C\r
85OBJS += ../../Pico/draw_asm.o ../../Pico/draw2_asm.o\r
86endif\r
87ifeq "$(asm_memory)" "1"\r
88DEFINC += -D_ASM_MEMORY_C\r
89OBJS += ../../Pico/memory_asm.o\r
90endif\r
91ifeq "$(asm_ym2612)" "1"\r
92DEFINC += -D_ASM_YM2612_C\r
93OBJS += ../../Pico/sound/ym2612_asm.o\r
94endif\r
cea65903 95ifeq "$(asm_misc)" "1"\r
96DEFINC += -D_ASM_MISC_C\r
97OBJS += ../../Pico/misc_asm.o\r
6cadc2da 98OBJS += ../../Pico/cd/misc_asm.o\r
cea65903 99endif\r
7336a99a 100ifeq "$(asm_cdpico)" "1"\r
101DEFINC += -D_ASM_CD_PICO_C\r
102OBJS += ../../Pico/cd/pico_asm.o\r
103endif\r
4ff2d527 104ifeq "$(asm_cdmemory)" "1"\r
105DEFINC += -D_ASM_CD_MEMORY_C\r
106OBJS += ../../Pico/cd/memory_asm.o\r
107endif\r
eff55556 108\r
cc68a136 109# Pico - sound\r
eff55556 110ifneq "$(amalgamate)" "1"\r
111OBJS += ../../Pico/sound/sound.o\r
112endif\r
4f265db7 113OBJS += ../../Pico/sound/mix_asm.o\r
eff55556 114OBJS += ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o\r
cc68a136 115# zlib\r
116OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \\r
117 ../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o\r
118# unzip\r
83bd0b76 119OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o\r
2d0b15bb 120# debug\r
121ifeq "$(debug_cyclone)" "1"\r
99464b62 122OBJS += ../../Pico/Debug.o ../../cpu/musashi/m68kdasm.o\r
2d0b15bb 123endif\r
cc68a136 124# CPU cores\r
125ifeq "$(use_musashi)" "1"\r
126DEFINC += -DEMU_M68K\r
2270612a 127OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o\r
2d0b15bb 128endif\r
129ifeq "$(use_cyclone)" "1"\r
cc68a136 130DEFINC += -DEMU_C68K\r
053fd9b4 131OBJS += ../../cpu/Cyclone/proj/Cyclone.o ../../cpu/Cyclone/tools/idle.o\r
cc68a136 132endif\r
133# drz80/mz80\r
134ifeq "$(mz80)" "1"\r
135DEFINC += -D_USE_MZ80\r
136OBJS += ../../cpu/mz80/mz80.o\r
137else\r
138DEFINC += -D_USE_DRZ80\r
139OBJS += ../../cpu/DrZ80/drz80.o\r
140endif\r
141\r
cb0316e4 142\r
42c7b147 143all: PicoDrive.gpe\r
cc68a136 144\r
da42200b 145PicoDrive.gpe : $(OBJS) ../common/helix/helix_mp3.a\r
b542be46 146 @echo ">>>" $@\r
147 $(GCC) -o $@ $(COPT) $^ -lm -lpng -Wl,-Map=PicoDrive.map\r
7336a99a 148ifeq ($(DEBUG),)\r
b542be46 149 $(STRIP) $@\r
cc68a136 150endif\r
151\r
4f265db7 152up: PicoDrive.gpe\r
d5d11924 153 @cp -v PicoDrive.gpe /mnt/gp2x/mnt/sd/emus/PicoDrive/\r
672ad671 154\r
155# @cmd //C copy PicoDrive.gpe \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\\r
156\r
cc68a136 157\r
cc68a136 158.c.o:\r
b542be46 159 @echo ">>>" $<\r
160 $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r
cc68a136 161.s.o:\r
b542be46 162 @echo ">>>" $<\r
163 $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r
e807ac75 164.S.o:\r
165 @echo ">>>" $<\r
166 $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r
cc68a136 167\r
5c129565 168../../Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c\r
169\r
cc68a136 170../../Pico/draw_asm.o : ../../Pico/Draw.s\r
b542be46 171 @echo ">>>" $<\r
172 $(AS) $(ASOPT) $< -o $@\r
cc68a136 173../../Pico/draw2_asm.o : ../../Pico/Draw2.s\r
b542be46 174 @echo ">>>" $<\r
175 $(AS) $(ASOPT) $< -o $@\r
cc68a136 176../../Pico/memory_asm.o : ../../Pico/Memory.s\r
b542be46 177 @echo ">>>" $<\r
178 $(AS) $(ASOPT) $< -o $@\r
cc68a136 179../../Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s\r
b542be46 180 @echo ">>>" $<\r
181 $(AS) $(ASOPT) $< -o $@\r
4f265db7 182../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s\r
b542be46 183 @echo ">>>" $<\r
184 $(AS) $(ASOPT) $< -o $@\r
ea8c405f 185../../Pico/misc_asm.o : ../../Pico/Misc.s\r
b542be46 186 @echo ">>>" $<\r
187 $(AS) $(ASOPT) $< -o $@\r
7336a99a 188../../Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s\r
b542be46 189 @echo ">>>" $<\r
190 $(AS) $(ASOPT) $< -o $@\r
4ff2d527 191../../Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s\r
b542be46 192 @echo ">>>" $<\r
193 $(AS) $(ASOPT) $< -o $@\r
ea8c405f 194../../Pico/cd/misc_asm.o : ../../Pico/cd/Misc.s\r
b542be46 195 @echo ">>>" $<\r
196 $(AS) $(ASOPT) $< -o $@\r
cc68a136 197\r
198# build Cyclone\r
199../../cpu/Cyclone/proj/Cyclone.s :\r
200 @echo building Cyclone...\r
0af33fe0 201 @make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h\r
2270612a 202\r
203../../cpu/musashi/m68kops.c :\r
204 @make -C ../../cpu/musashi\r
205\r
e352c3af 206../../Pico/Pico.o ../../Pico/cd/Pico.o: ../../Pico/PicoFrameHints.c ../../Pico/PicoInt.h\r
4b9c5888 207../../Pico/Memory.o Pico/cd/Memory.o : ../../Pico/MemoryCmn.c ../../Pico/PicoInt.h\r
cc68a136 208\r
cb0316e4 209# build helix libs\r
da42200b 210../common/helix/helix_mp3.a:\r
211 make -C ../common/helix\r
cb0316e4 212\r
7eed09b3 213readme.txt: ../../tools/textfilter ../base_readme.txt\r
214 ../../tools/textfilter ../base_readme.txt $@ GP2X\r
215\r
216../../tools/textfilter: ../../tools/textfilter.c\r
217 make -C ../../tools/ textfilter\r
218\r
cc68a136 219\r
cc68a136 220# cleanup\r
42c7b147 221clean: tidy\r
8022f53d 222 $(RM) PicoDrive.gpe\r
42c7b147 223tidy:\r
8022f53d 224 $(RM) $(OBJS)\r
cc68a136 225# @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean\r
226\r
cc68a136 227\r
228clean_prof:\r
229 find ../.. -name '*.gcno' -delete\r
230 find ../.. -name '*.gcda' -delete\r
231\r
cb0316e4 232# ----------- release -----------\r
233ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r
234ifeq ($(VER),)\r
235$(error need VER)\r
236endif\r
237endif\r
238\r
f9d3ee9d 239rel: PicoDrive.gpe code940/pico940_v2.bin readme.txt PicoDrive.man.txt PicoDrive.png ../game_def.cfg\r
cb0316e4 240 zip -9 -j ../../PicoDrive_$(VER).zip $^ mmuhack.o\r
a4f0cc86 241 zip -9 -r ../../PicoDrive_$(VER).zip skin -i \*.png -i \*.txt\r
c0fcf293 242 mkdir bin_to_cso_mp3\r
243 cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/\r
244 zip -9 -r ../../PicoDrive_$(VER).zip bin_to_cso_mp3\r
245 rm -rf bin_to_cso_mp3\r
cb0316e4 246\r
247code940/code940.bin:\r
248 make -C code940/\r
249\r