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