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