| 1 | # settings |
| 2 | use_musashi = 1 |
| 3 | #use_fame = 1 |
| 4 | #use_mz80 = 1 |
| 5 | #profile = 1 |
| 6 | #fake_in_gp2x = 1 |
| 7 | |
| 8 | -include Makefile.local |
| 9 | |
| 10 | ifeq "$(profile)" "1" |
| 11 | CFLAGS += -O3 -Wall |
| 12 | CFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math |
| 13 | CFLAGS += -fprofile-generate |
| 14 | else |
| 15 | CFLAGS = -ggdb -Wall -falign-functions=2 |
| 16 | endif |
| 17 | DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV |
| 18 | CFLAGS += -I../.. -I. |
| 19 | LDFLAGS += -lX11 -lpthread |
| 20 | |
| 21 | # frontend |
| 22 | OBJS += platform/gp2x/emu.o blit.o in_evdev.o plat.o sndout_oss.o gp2x.o log_io.o |
| 23 | |
| 24 | # common |
| 25 | OBJS += platform/common/main.o platform/common/emu.o platform/common/menu.o \ |
| 26 | platform/common/config.o platform/common/fonts.o platform/common/readpng.o \ |
| 27 | platform/common/input.o |
| 28 | |
| 29 | ifeq "$(fake_in_gp2x)" "1" |
| 30 | DEFINES += IN_GP2X FAKE_IN_GP2X |
| 31 | OBJS += platform/gp2x/in_gp2x.o |
| 32 | endif |
| 33 | |
| 34 | # Pico |
| 35 | OBJS += pico/area.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o \ |
| 36 | pico/videoport.o pico/draw2.o pico/draw.o pico/z80if.o pico/patch.o \ |
| 37 | pico/mode4.o pico/sms.o pico/misc.o pico/eeprom.o pico/debug.o |
| 38 | # Pico - CD |
| 39 | OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ |
| 40 | pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ |
| 41 | pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o |
| 42 | # Pico - 32X |
| 43 | OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o |
| 44 | # Pico - Pico |
| 45 | OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o |
| 46 | # Pico - sound |
| 47 | OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o |
| 48 | # Pico - carthw |
| 49 | OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \ |
| 50 | pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o |
| 51 | # zlib |
| 52 | OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ |
| 53 | zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o |
| 54 | # unzip |
| 55 | OBJS += unzip/unzip.o unzip/unzip_stream.o |
| 56 | # CPU cores |
| 57 | ifeq "$(use_musashi)" "1" |
| 58 | DEFINES += EMU_M68K |
| 59 | OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o |
| 60 | #OBJS += cpu/musashi/m68kdasm.o |
| 61 | endif |
| 62 | ifeq "$(use_fame)" "1" |
| 63 | DEFINES += EMU_F68K |
| 64 | OBJS += cpu/fame/famec.o |
| 65 | endif |
| 66 | # z80 |
| 67 | ifeq "$(use_mz80)" "1" |
| 68 | DEFINES += _USE_MZ80 |
| 69 | OBJS += cpu/mz80/mz80.o |
| 70 | else |
| 71 | DEFINES += _USE_CZ80 |
| 72 | OBJS += cpu/cz80/cz80.o |
| 73 | endif |
| 74 | # sh2 |
| 75 | OBJS += cpu/sh2mame/sh2pico.o |
| 76 | # misc |
| 77 | ifeq "$(use_fame)" "1" |
| 78 | ifeq "$(use_musashi)" "1" |
| 79 | OBJS += pico/debugCPU.o |
| 80 | endif |
| 81 | endif |
| 82 | |
| 83 | CFLAGS += $(addprefix -D,$(DEFINES)) |
| 84 | |
| 85 | vpath %.c = ../.. |
| 86 | |
| 87 | DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \ |
| 88 | pico/32x zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80 cpu/sh2mame |
| 89 | |
| 90 | all: mkdirs PicoDrive |
| 91 | clean: tidy |
| 92 | @$(RM) PicoDrive |
| 93 | tidy: |
| 94 | $(RM) $(OBJS) |
| 95 | rm -rf $(DIRS) |
| 96 | @make -C ../../cpu/mz80/ clean |
| 97 | |
| 98 | PicoDrive : $(OBJS) |
| 99 | @echo ">>>" $@ |
| 100 | $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@ |
| 101 | |
| 102 | mkdirs: |
| 103 | @mkdir -p $(DIRS) |
| 104 | |
| 105 | include ../common/revision.mak |
| 106 | |
| 107 | pico/carthw/svp/compiler.o : ../../pico/carthw/svp/gen_arm.c |
| 108 | pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h |
| 109 | pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h |
| 110 | |
| 111 | ../../cpu/musashi/m68kops.c : |
| 112 | @make -C ../../cpu/musashi |
| 113 | |
| 114 | cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm |
| 115 | @echo $@ |
| 116 | @nasm -f elf $< -o $@ |
| 117 | |
| 118 | ../../cpu/mz80/mz80.asm : |
| 119 | @make -C ../../cpu/mz80/ |
| 120 | |
| 121 | .c.o: |
| 122 | @echo ">>>" $< |
| 123 | $(CC) $(CFLAGS) -c $< -o $@ |
| 124 | .s.o: |
| 125 | @echo ">>>" $< |
| 126 | $(CC) $(CFLAGS) -c $< -o $@ |
| 127 | |
| 128 | |
| 129 | cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h |
| 130 | @echo ">>>" $< |
| 131 | $(CC) $(CFLAGS) -Wno-unused -c $< -o $@ |
| 132 | |