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