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