| 1 | export CROSS = arm-none-linux-gnueabi-\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 -DPANDORA\r |
| 31 | COPT_COMMON = -static -Wall -Winline\r |
| 32 | ifeq ($(DEBUG),)\r |
| 33 | COPT_COMMON += -O3 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math\r |
| 34 | else\r |
| 35 | COPT_COMMON += -ggdb\r |
| 36 | endif\r |
| 37 | ifeq "$(profile)" "1"\r |
| 38 | COPT_COMMON += -fprofile-generate\r |
| 39 | endif\r |
| 40 | ifeq "$(profile)" "2"\r |
| 41 | COPT_COMMON += -fprofile-use\r |
| 42 | endif\r |
| 43 | COPT = $(COPT_COMMON)\r |
| 44 | ASOPT =\r |
| 45 | GCC = $(CROSS)gcc\r |
| 46 | STRIP = $(CROSS)strip\r |
| 47 | AS = $(CROSS)as\r |
| 48 | LD = $(CROSS)ld\r |
| 49 | OBJCOPY = $(CROSS)objcopy\r |
| 50 | \r |
| 51 | # frontend\r |
| 52 | OBJS += pandora.o main.o emu.o platform/gp2x/menu.o platform/gp2x/usbjoy.o\r |
| 53 | \r |
| 54 | # common\r |
| 55 | OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r |
| 56 | platform/common/arm_utils.o platform/common/mp3_helix.o # platform/common/readpng.o\r |
| 57 | \r |
| 58 | # Pico\r |
| 59 | ifeq "$(amalgamate)" "1"\r |
| 60 | OBJS += ../../PicoAll.o\r |
| 61 | else\r |
| 62 | OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o Pico/Pico.o Pico/Sek.o \\r |
| 63 | Pico/VideoPort.o Pico/Draw2.o Pico/Draw.o Pico/Patch.o Pico/Debug.o\r |
| 64 | # Pico - CD\r |
| 65 | OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \\r |
| 66 | Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/cue.o Pico/cd/gfx_cd.o \\r |
| 67 | Pico/cd/Area.o Pico/cd/Misc.o Pico/cd/pcm.o Pico/cd/buffering.o\r |
| 68 | endif\r |
| 69 | # Pico - Pico\r |
| 70 | OBJS += Pico/Pico/Pico.o Pico/Pico/Memory.o Pico/Pico/xpcm.o\r |
| 71 | # Pico - carthw\r |
| 72 | OBJS += Pico/carthw/carthw.o Pico/carthw/svp/svp.o Pico/carthw/svp/Memory.o \\r |
| 73 | Pico/carthw/svp/ssp16.o Pico/carthw/svp/compiler.o Pico/carthw/svp/stub_arm.o\r |
| 74 | \r |
| 75 | # asm stuff\r |
| 76 | ifeq "$(asm_render)" "1"\r |
| 77 | DEFINC += -D_ASM_DRAW_C\r |
| 78 | OBJS += Pico/draw_asm.o Pico/draw2_asm.o\r |
| 79 | endif\r |
| 80 | ifeq "$(asm_memory)" "1"\r |
| 81 | DEFINC += -D_ASM_MEMORY_C\r |
| 82 | OBJS += Pico/memory_asm.o\r |
| 83 | endif\r |
| 84 | ifeq "$(asm_ym2612)" "1"\r |
| 85 | DEFINC += -D_ASM_YM2612_C\r |
| 86 | OBJS += Pico/sound/ym2612_asm.o\r |
| 87 | endif\r |
| 88 | ifeq "$(asm_misc)" "1"\r |
| 89 | DEFINC += -D_ASM_MISC_C\r |
| 90 | OBJS += Pico/misc_asm.o\r |
| 91 | OBJS += Pico/cd/misc_asm.o\r |
| 92 | endif\r |
| 93 | ifeq "$(asm_cdpico)" "1"\r |
| 94 | DEFINC += -D_ASM_CD_PICO_C\r |
| 95 | OBJS += Pico/cd/pico_asm.o\r |
| 96 | endif\r |
| 97 | ifeq "$(asm_cdmemory)" "1"\r |
| 98 | DEFINC += -D_ASM_CD_MEMORY_C\r |
| 99 | OBJS += Pico/cd/memory_asm.o\r |
| 100 | endif\r |
| 101 | \r |
| 102 | # Pico - sound\r |
| 103 | ifneq "$(amalgamate)" "1"\r |
| 104 | OBJS += Pico/sound/sound.o\r |
| 105 | endif\r |
| 106 | OBJS += Pico/sound/mix_asm.o\r |
| 107 | OBJS += Pico/sound/sn76496.o Pico/sound/ym2612.o\r |
| 108 | # zlib\r |
| 109 | OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \\r |
| 110 | zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o\r |
| 111 | # unzip\r |
| 112 | OBJS += unzip/unzip.o unzip/unzip_stream.o\r |
| 113 | # debug\r |
| 114 | ifeq "$(debug_cyclone)" "1"\r |
| 115 | OBJS += Pico/DebugCPU.o cpu/musashi/m68kdasm.o\r |
| 116 | endif\r |
| 117 | # CPU cores\r |
| 118 | ifeq "$(use_musashi)" "1"\r |
| 119 | DEFINC += -DEMU_M68K\r |
| 120 | OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o\r |
| 121 | endif\r |
| 122 | ifeq "$(use_cyclone)" "1"\r |
| 123 | DEFINC += -DEMU_C68K\r |
| 124 | OBJS += cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o\r |
| 125 | endif\r |
| 126 | # drz80/mz80\r |
| 127 | ifeq "$(mz80)" "1"\r |
| 128 | DEFINC += -D_USE_MZ80\r |
| 129 | OBJS += cpu/mz80/mz80.o\r |
| 130 | else\r |
| 131 | DEFINC += -D_USE_DRZ80\r |
| 132 | OBJS += cpu/DrZ80/drz80.o\r |
| 133 | endif\r |
| 134 | \r |
| 135 | vpath %.c = ../..\r |
| 136 | vpath %.s = ../..\r |
| 137 | vpath %.S = ../..\r |
| 138 | DIRS = platform platform/gp2x platform/common Pico Pico/cd Pico/Pico Pico/sound Pico/carthw/svp \\r |
| 139 | zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80\r |
| 140 | \r |
| 141 | \r |
| 142 | all: mkdirs PicoDrive\r |
| 143 | \r |
| 144 | PicoDrive : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a\r |
| 145 | @echo ">>>" $@\r |
| 146 | $(GCC) -o $@ $(COPT) $^ -lm -Wl,-Map=PicoDrive.map # -lpng\r |
| 147 | ifeq ($(DEBUG),)\r |
| 148 | $(STRIP) $@\r |
| 149 | endif\r |
| 150 | \r |
| 151 | \r |
| 152 | # cleanup\r |
| 153 | clean: tidy\r |
| 154 | $(RM) PicoDrive\r |
| 155 | tidy:\r |
| 156 | $(RM) $(OBJS)\r |
| 157 | # rm -rf $(DIRS) # don't clean, gcda may be there\r |
| 158 | # @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean\r |
| 159 | \r |
| 160 | \r |
| 161 | clean_prof:\r |
| 162 | find ../.. -name '*.gcno' -delete\r |
| 163 | find ../.. -name '*.gcda' -delete\r |
| 164 | \r |
| 165 | \r |
| 166 | mkdirs:\r |
| 167 | mkdir -p $(DIRS)\r |
| 168 | \r |
| 169 | .c.o:\r |
| 170 | @echo ">>>" $<\r |
| 171 | $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
| 172 | .s.o:\r |
| 173 | @echo ">>>" $<\r |
| 174 | $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
| 175 | .S.o:\r |
| 176 | @echo ">>>" $<\r |
| 177 | $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
| 178 | \r |
| 179 | Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c\r |
| 180 | \r |
| 181 | Pico/draw_asm.o : ../../Pico/Draw.s\r |
| 182 | @echo ">>>" $<\r |
| 183 | $(AS) $(ASOPT) $< -o $@\r |
| 184 | Pico/draw2_asm.o : ../../Pico/Draw2.s\r |
| 185 | @echo ">>>" $<\r |
| 186 | $(AS) $(ASOPT) $< -o $@\r |
| 187 | Pico/memory_asm.o : ../../Pico/Memory.s\r |
| 188 | @echo ">>>" $<\r |
| 189 | $(AS) $(ASOPT) $< -o $@\r |
| 190 | Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s\r |
| 191 | @echo ">>>" $<\r |
| 192 | $(AS) $(ASOPT) $< -o $@\r |
| 193 | Pico/sound/mix_asm.o : ../../Pico/sound/mix.s\r |
| 194 | @echo ">>>" $<\r |
| 195 | $(AS) $(ASOPT) $< -o $@\r |
| 196 | Pico/misc_asm.o : ../../Pico/Misc.s\r |
| 197 | @echo ">>>" $<\r |
| 198 | $(AS) $(ASOPT) $< -o $@\r |
| 199 | Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s\r |
| 200 | @echo ">>>" $<\r |
| 201 | $(AS) $(ASOPT) $< -o $@\r |
| 202 | Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s\r |
| 203 | @echo ">>>" $<\r |
| 204 | $(AS) $(ASOPT) $< -o $@\r |
| 205 | Pico/cd/misc_asm.o : ../../Pico/cd/Misc.s\r |
| 206 | @echo ">>>" $<\r |
| 207 | $(AS) $(ASOPT) $< -o $@\r |
| 208 | \r |
| 209 | # build Cyclone\r |
| 210 | ../../cpu/Cyclone/proj/Cyclone.s :\r |
| 211 | @echo building Cyclone...\r |
| 212 | @make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h\r |
| 213 | \r |
| 214 | ../../cpu/musashi/m68kops.c :\r |
| 215 | @make -C ../../cpu/musashi\r |
| 216 | \r |
| 217 | Pico/Pico.o Pico/cd/Pico.o: ../../Pico/PicoFrameHints.c ../../Pico/PicoInt.h\r |
| 218 | Pico/Memory.o Pico/cd/Memory.o : ../../Pico/MemoryCmn.c ../../Pico/PicoInt.h\r |
| 219 | \r |
| 220 | # build helix libs\r |
| 221 | ../common/helix/$(CROSS)helix-mp3.a:\r |
| 222 | make -C ../common/helix clean all\r |
| 223 | \r |
| 224 | readme.txt: ../../tools/textfilter ../base_readme.txt\r |
| 225 | ../../tools/textfilter ../base_readme.txt $@ GP2X\r |
| 226 | \r |
| 227 | ../../tools/textfilter: ../../tools/textfilter.c\r |
| 228 | make -C ../../tools/ textfilter\r |
| 229 | \r |
| 230 | \r |
| 231 | # ----------- release -----------\r |
| 232 | ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r |
| 233 | $(error TODO)\r |
| 234 | ifeq ($(VER),)\r |
| 235 | $(error need VER)\r |
| 236 | endif\r |
| 237 | endif\r |
| 238 | \r |