bugfix
[picodrive.git] / platform / gp2x / Makefile
CommitLineData
da42200b 1export CROSS = arm-linux-\r
cc68a136 2\r
3# settings\r
cc68a136 4#mz80 = 1\r
0af33fe0 5#debug_cyclone = 1\r
0ace9b9a 6asm_memory = 1\r
cc68a136 7asm_render = 1\r
8asm_ym2612 = 1\r
3a81ecde 9asm_misc = 1\r
7336a99a 10asm_cdpico = 1\r
0ace9b9a 11asm_cdmemory = 1\r
e8151fd5 12amalgamate = 0\r
490eb480 13#profile = 1\r
cc68a136 14#use_musashi = 1\r
1d29444d 15use_sh2mame = 1\r
cc68a136 16#up = 1\r
17\r
2d0b15bb 18\r
19ifeq "$(debug_cyclone)" "1"\r
20use_cyclone = 1\r
21use_musashi = 1\r
2270612a 22endif\r
23ifeq "$(use_musashi)" "1"\r
24asm_cdpico = 0\r
2d0b15bb 25asm_memory = 0\r
26asm_cdmemory = 0\r
2270612a 27else\r
2d0b15bb 28use_cyclone = 1\r
29endif\r
30\r
bbc8ceb9 31DEFINC = -I../.. -I. -DARM -D__GP2X__ -DIN_GP2X -DIN_EVDEV # -DBENCHMARK\r
ee2a3bdf 32CFLAGS += -Wall -Winline\r
1dceadae 33ifeq ($(DEBUG),)\r
e39e0acb 34CFLAGS += -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math\r
1dceadae 35else\r
ee2a3bdf 36CFLAGS += -ggdb\r
1dceadae 37endif\r
cc68a136 38ifeq "$(profile)" "1"\r
ee2a3bdf 39CFLAGS += -fprofile-generate\r
cc68a136 40endif\r
41ifeq "$(profile)" "2"\r
ee2a3bdf 42CFLAGS += -fprofile-use\r
cc68a136 43endif\r
ee2a3bdf 44CFLAGS += -mcpu=arm920t -mtune=arm920t\r
ca482e5d 45SFLAGS = $(CFLAGS)\r
46ASFLAGS = -mcpu=arm920t -mfloat-abi=soft\r
47CC = $(CROSS)gcc\r
cc68a136 48STRIP = $(CROSS)strip\r
49AS = $(CROSS)as\r
50LD = $(CROSS)ld\r
51OBJCOPY = $(CROSS)objcopy\r
52\r
53# frontend\r
e39e0acb 54OBJS += plat.o warm.o pollux_set.o soc.o soc_mmsp2.o soc_pollux.o emu.o in_gp2x.o\r
cc68a136 55# 940 core control\r
85f8e929 56OBJS += 940ctl.o\r
eff55556 57\r
e5f426aa 58# common\r
490eb480 59OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
60 platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \\r
61 platform/common/mp3_helix.o platform/common/input.o platform/common/main.o \\r
bbc8ceb9 62 platform/linux/sndout_oss.o platform/linux/plat.o platform/linux/in_evdev.o\r
e5f426aa 63\r
cc68a136 64# Pico\r
eff55556 65ifeq "$(amalgamate)" "1"\r
efcba75f 66OBJS += ../../picoAll.o\r
eff55556 67else\r
45f2f245 68OBJS += pico/area.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \\r
69 pico/videoport.o pico/draw2.o pico/draw.o pico/mode4.o pico/sms.o \\r
70 pico/misc.o pico/eeprom.o pico/patch.o pico/debug.o\r
8c1952f0 71# Pico - CD\r
efcba75f 72OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \\r
73 pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \\r
74 pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o\r
eff55556 75endif\r
974fdb5b 76# Pico - 32X\r
db1d3564 77OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o\r
c9e1affc 78# Pico - Pico\r
efcba75f 79OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o\r
0ffefdb8 80# Pico - carthw\r
efcba75f 81OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \\r
82 pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o\r
eff55556 83\r
cc68a136 84# Pico - sound\r
eff55556 85ifneq "$(amalgamate)" "1"\r
efcba75f 86OBJS += pico/sound/sound.o\r
eff55556 87endif\r
efcba75f 88OBJS += pico/sound/mix_arm.o\r
89OBJS += pico/sound/sn76496.o pico/sound/ym2612.o\r
e39e0acb 90# unzip\r
91OBJS += unzip/unzip.o unzip/unzip_stream.o\r
cc68a136 92# zlib\r
8187ba84 93OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \\r
94 zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o\r
2d0b15bb 95# debug\r
96ifeq "$(debug_cyclone)" "1"\r
efcba75f 97OBJS += pico/DebugCPU.o cpu/musashi/m68kdasm.o\r
2d0b15bb 98endif\r
490eb480 99# CPU cores\r
e39e0acb 100ifeq "$(use_musashi)" "1"\r
101DEFINC += -DEMU_M68K\r
102OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o\r
103endif\r
104ifeq "$(use_cyclone)" "1"\r
105DEFINC += -DEMU_C68K\r
5e89f0f5 106OBJS += pico/m68kif_cyclone.o cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o\r
e39e0acb 107endif\r
490eb480 108ifeq "$(mz80)" "1"\r
109DEFINC += -D_USE_MZ80\r
110OBJS += cpu/mz80/mz80.o\r
111else\r
112DEFINC += -D_USE_DRZ80\r
113OBJS += cpu/DrZ80/drz80.o\r
114endif\r
41397701 115OBJS += cpu/sh2/sh2.o\r
1d29444d 116ifeq "$(use_sh2mame)" "1"\r
41397701 117OBJS += cpu/sh2/mame/sh2pico.o\r
1d29444d 118else\r
119endif\r
41397701 120OBJS += cpu/drc/cmn.o\r
121OBJS += cpu/drc/cmn_arm.o\r
cc68a136 122\r
8187ba84 123vpath %.c = ../..\r
124vpath %.s = ../..\r
125vpath %.S = ../..\r
490eb480 126\r
5e49c3a8 127DIRS = platform platform/gp2x platform/linux platform/common pico pico/cd pico/pico pico/32x \\r
128 pico/sound pico/carthw/svp zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools \\r
41397701 129 cpu/mz80 cpu/DrZ80 cpu/sh2/mame cpu/drc\r
cb0316e4 130\r
8187ba84 131\r
490eb480 132all: mkdirs PicoDrive\r
cc68a136 133\r
efcba75f 134include ../common/common_arm.mak\r
87b0845f 135include ../common/revision.mak\r
b3158e98 136\r
490eb480 137# partial linking helps profiled builds due to section merging\r
e39e0acb 138PicoDrive.o : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a\r
139 $(LD) -r -o $@ $^\r
140\r
490eb480 141# still using static, dynamic linking slows Wiz 1-10%\r
142# also libm on F100 is not compatible\r
143PicoDrive : PicoDrive.o\r
b542be46 144 @echo ">>>" $@\r
e39e0acb 145 $(CC) -static -o $@ $(CFLAGS) $^ -lm -lpng -Wl,-Map=$@.map\r
7336a99a 146ifeq ($(DEBUG),)\r
b542be46 147 $(STRIP) $@\r
cc68a136 148endif\r
149\r
ee2a3bdf 150up: PicoDrive\r
151 @cp -v PicoDrive /mnt/gp2x/mnt/sd/emus/PicoDrive/\r
672ad671 152\r
8187ba84 153clean: tidy\r
ee2a3bdf 154 $(RM) PicoDrive\r
8187ba84 155tidy:\r
156 $(RM) $(OBJS)\r
8187ba84 157\r
7eed09b3 158readme.txt: ../../tools/textfilter ../base_readme.txt\r
159 ../../tools/textfilter ../base_readme.txt $@ GP2X\r
160\r
cb0316e4 161# ----------- release -----------\r
162ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r
163ifeq ($(VER),)\r
164$(error need VER)\r
165endif\r
166endif\r
4010330c 167CODE940 = code940/pico940_v3.bin\r
cb0316e4 168\r
4010330c 169rel: PicoDrive PicoDrive.gpe $(CODE940) readme.txt PicoDrive.png ../game_def.cfg \\r
490eb480 170 warm_2.4.25.o warm_2.4.26-open2x.o warm_2.6.24.ko\r
171 zip -9 -j ../../PicoDrive_$(VER).zip $^\r
a4f0cc86 172 zip -9 -r ../../PicoDrive_$(VER).zip skin -i \*.png -i \*.txt\r
c0fcf293 173 mkdir bin_to_cso_mp3\r
174 cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/\r
175 zip -9 -r ../../PicoDrive_$(VER).zip bin_to_cso_mp3\r
176 rm -rf bin_to_cso_mp3\r
cb0316e4 177\r
4010330c 178$(CODE940):\r
cb0316e4 179 make -C code940/\r
180\r