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