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