| 1 | # settings |
| 2 | CROSS=i586-mingw32msvc- |
| 3 | |
| 4 | #use_musashi = 1 |
| 5 | use_fame = 1 |
| 6 | #use_mz80 = 1 |
| 7 | |
| 8 | -include Makefile.local |
| 9 | |
| 10 | CC = $(CROSS)gcc |
| 11 | CXX = $(CROSS)g++ |
| 12 | LD = $(CROSS)ld |
| 13 | STRIP = $(CROSS)strip |
| 14 | |
| 15 | DEFINES = _UNZIP_SUPPORT IN_VK |
| 16 | CFLAGS += -O2 -Wall -falign-functions=2 -ffast-math |
| 17 | CFLAGS += -I../.. -I. -I../../zlib/ -Idirectx/include/ |
| 18 | LDFLAGS += -mwindows -L. -Ldirectx/lib/ -lgdi32 -lcomdlg32 -lddraw -ldsound -ldxguid |
| 19 | |
| 20 | # frontend |
| 21 | OBJS += main.o plat.o direct.o dsnd.o in_vk.o |
| 22 | |
| 23 | # common |
| 24 | OBJS += platform/common/emu.o platform/common/menu.o \ |
| 25 | platform/common/config.o platform/common/fonts.o platform/common/readpng.o \ |
| 26 | platform/common/input.o |
| 27 | |
| 28 | # Pico |
| 29 | OBJS += pico/area.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o \ |
| 30 | pico/videoport.o pico/draw2.o pico/draw.o pico/z80if.o pico/patch.o \ |
| 31 | pico/mode4.o pico/sms.o pico/misc.o pico/eeprom.o pico/debug.o |
| 32 | # Pico - CD |
| 33 | OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ |
| 34 | pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ |
| 35 | pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o |
| 36 | # Pico - 32X |
| 37 | OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o |
| 38 | # Pico - Pico |
| 39 | OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o |
| 40 | # Pico - sound |
| 41 | OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o |
| 42 | # Pico - carthw |
| 43 | OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \ |
| 44 | pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o |
| 45 | # zlib |
| 46 | OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ |
| 47 | zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o |
| 48 | # unzip |
| 49 | OBJS += unzip/unzip.o unzip/unzip_stream.o |
| 50 | # CPU cores |
| 51 | ifeq "$(use_musashi)" "1" |
| 52 | DEFINES += EMU_M68K |
| 53 | OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o |
| 54 | #OBJS += cpu/musashi/m68kdasm.o |
| 55 | endif |
| 56 | ifeq "$(use_fame)" "1" |
| 57 | DEFINES += EMU_F68K |
| 58 | OBJS += cpu/fame/famec.o |
| 59 | endif |
| 60 | # z80 |
| 61 | ifeq "$(use_mz80)" "1" |
| 62 | DEFINES += _USE_MZ80 |
| 63 | OBJS += cpu/mz80/mz80.o |
| 64 | else |
| 65 | DEFINES += _USE_CZ80 |
| 66 | OBJS += cpu/cz80/cz80.o |
| 67 | endif |
| 68 | # sh2 |
| 69 | OBJS += cpu/sh2mame/sh2pico.o |
| 70 | # misc |
| 71 | ifeq "$(use_fame)" "1" |
| 72 | ifeq "$(use_musashi)" "1" |
| 73 | OBJS += pico/debugCPU.o |
| 74 | endif |
| 75 | endif |
| 76 | |
| 77 | CFLAGS += $(addprefix -D,$(DEFINES)) |
| 78 | CXXFLAGS = $(CFLAGS) |
| 79 | |
| 80 | vpath %.c = ../.. |
| 81 | |
| 82 | DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \ |
| 83 | pico/32x zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80 cpu/sh2mame |
| 84 | |
| 85 | TARGET = PicoDrive.exe |
| 86 | |
| 87 | all: mkdirs $(TARGET) |
| 88 | clean: tidy |
| 89 | @$(RM) $(TARGET) |
| 90 | tidy: |
| 91 | $(RM) $(OBJS) $(TARGET).map |
| 92 | rm -rf $(DIRS) |
| 93 | |
| 94 | $(TARGET) : $(OBJS) |
| 95 | @echo ">>>" $@ |
| 96 | $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=$(TARGET).map -o $@ |
| 97 | $(STRIP) $@ |
| 98 | |
| 99 | mkdirs: |
| 100 | @mkdir -p $(DIRS) |
| 101 | |
| 102 | include ../common/revision.mak |
| 103 | |
| 104 | pico/carthw/svp/compiler.o : ../../pico/carthw/svp/gen_arm.c |
| 105 | pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h |
| 106 | pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h |
| 107 | |
| 108 | ../../cpu/musashi/m68kops.c : |
| 109 | @make -C ../../cpu/musashi |
| 110 | |
| 111 | cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm |
| 112 | @echo $@ |
| 113 | @nasm -f elf $< -o $@ |
| 114 | |
| 115 | ../../cpu/mz80/mz80.asm : |
| 116 | @make -C ../../cpu/mz80/ |
| 117 | |
| 118 | .c.o: |
| 119 | @echo ">>>" $< |
| 120 | $(CC) $(CFLAGS) -c $< -o $@ |
| 121 | .s.o: |
| 122 | @echo ">>>" $< |
| 123 | $(CC) $(CFLAGS) -c $< -o $@ |
| 124 | |
| 125 | |
| 126 | cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h |
| 127 | @echo ">>>" $< |
| 128 | $(CC) $(CFLAGS) -Wno-unused -c $< -o $@ |
| 129 | |
| 130 | # ----------- release ----------- |
| 131 | ifneq ($(findstring rel,$(MAKECMDGOALS)),) |
| 132 | ifeq ($(VER),) |
| 133 | $(error need VER) |
| 134 | endif |
| 135 | endif |
| 136 | |
| 137 | rel: $(TARGET) readme.txt carthw.cfg |
| 138 | zip -9 -j ../../PicoDrive_win32_$(VER).zip $^ |
| 139 | |