refactoring z80 if code for sms preparation
[libpicofe.git] / linux / Makefile
CommitLineData
720ee7f6 1# settings
31d5892a 2use_musashi = 1
3#use_fame = 1
a52e1f62 4#use_mz80 = 1
24b24674 5#profile = 1
73a85369 6#fake_in_gp2x = 1
720ee7f6 7
73a85369 8-include Makefile.local
720ee7f6 9
10ifeq "$(profile)" "1"
73a85369 11CFLAGS += -O3 -Wall
12CFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math
13CFLAGS += -fprofile-generate
720ee7f6 14else
73a85369 15CFLAGS = -ggdb -Wall
720ee7f6 16endif
046c4540 17DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV
73a85369 18CFLAGS += -I../.. -I.
720ee7f6 19
20# gtk
73a85369 21CFLAGS += `pkg-config --cflags gtk+-2.0`
720ee7f6 22LDFLAGS += `pkg-config --libs gtk+-2.0`
73a85369 23CFLAGS += `pkg-config --cflags gthread-2.0`
720ee7f6 24LDFLAGS += `pkg-config --libs gthread-2.0`
25
26# frontend
046c4540 27OBJS += platform/gp2x/emu.o blit.o in_evdev.o plat.o sndout_oss.o gp2x.o log_io.o
c7a4ff64 28
29# common
046c4540 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
c7a4ff64 33
73a85369 34ifeq "$(fake_in_gp2x)" "1"
35DEFINES += IN_GP2X FAKE_IN_GP2X
36OBJS += platform/gp2x/in_gp2x.o
37endif
38
720ee7f6 39# Pico
f11bad75 40OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
c248cc08 41 pico/videoport.o pico/draw2.o pico/draw.o pico/z80if.o pico/patch.o pico/debug.o
720ee7f6 42# Pico - CD
f11bad75 43OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \
046c4540 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
9fe01b96 46# Pico - Pico
f11bad75 47OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o
720ee7f6 48# Pico - sound
f11bad75 49OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o
385a157e 50# Pico - carthw
f11bad75 51OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
046c4540 52 pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o
720ee7f6 53# zlib
93c0d147 54OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
6d741b32 55 zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
720ee7f6 56# unzip
93c0d147 57OBJS += unzip/unzip.o unzip/unzip_stream.o
720ee7f6 58# CPU cores
a52e1f62 59ifeq "$(use_musashi)" "1"
73a85369 60DEFINES += EMU_M68K
93c0d147 61OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
157a266e 62OBJS += cpu/musashi/m68kdasm.o
faffbf2d 63endif
64ifeq "$(use_fame)" "1"
73a85369 65DEFINES += EMU_F68K
93c0d147 66OBJS += cpu/fame/famec.o
2b90fc61 67endif
a52e1f62 68# z80
69ifeq "$(use_mz80)" "1"
73a85369 70DEFINES += _USE_MZ80
93c0d147 71OBJS += cpu/mz80/mz80.o
a52e1f62 72else
73a85369 73DEFINES += _USE_CZ80
93c0d147 74OBJS += cpu/cz80/cz80.o
a52e1f62 75endif
faffbf2d 76# misc
77ifeq "$(use_fame)" "1"
78ifeq "$(use_musashi)" "1"
f11bad75 79OBJS += pico/debugCPU.o
faffbf2d 80endif
81endif
720ee7f6 82
73a85369 83CFLAGS += $(addprefix -D,$(DEFINES))
84
93c0d147 85vpath %.c = ../..
73a85369 86
f11bad75 87DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \
385a157e 88 zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
720ee7f6 89
93c0d147 90all: mkdirs PicoDrive
720ee7f6 91clean: tidy
92 @$(RM) PicoDrive
93tidy:
93c0d147 94 $(RM) $(OBJS)
95 rm -rf $(DIRS)
720ee7f6 96 @make -C ../../cpu/mz80/ clean
703e4c7b 97 @make -C ../common/helix/ X86=1 clean
720ee7f6 98
703e4c7b 99PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
faffbf2d 100 @echo ">>>" $@
73a85369 101 $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
720ee7f6 102
93c0d147 103mkdirs:
104 mkdir -p $(DIRS)
720ee7f6 105
f11bad75 106pico/carthw/svp/compiler.o : ../../pico/carthw/svp/gen_arm.c
107pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h
108pico/memory.o pico/cd/memory.o : ../../pico/memory_cmn.c ../../pico/pico_int.h
5354c909 109platform/common/menu.o : revision.h
110
111revision.h:
112 @echo "#define REVISION \"`svn info | grep Revision | cut -c 11-`\"" > /tmp/r.tmp
113 @diff -q $@ /tmp/r.tmp > /dev/null 2>&1 || mv -f /tmp/r.tmp $@
bcf6c349 114
dc1782ad 115../../cpu/musashi/m68kops.c :
116 @make -C ../../cpu/musashi
117
93c0d147 118cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm
720ee7f6 119 @echo $@
120 @nasm -f elf $< -o $@
121
122../../cpu/mz80/mz80.asm :
123 @make -C ../../cpu/mz80/
124
703e4c7b 125../common/helix/helix_mp3_x86.a:
126 @make -C ../common/helix/ X86=1 clean all
d9a18943 127
720ee7f6 128.c.o:
faffbf2d 129 @echo ">>>" $<
73a85369 130 $(CC) $(CFLAGS) -c $< -o $@
720ee7f6 131.s.o:
faffbf2d 132 @echo ">>>" $<
73a85369 133 $(CC) $(CFLAGS) -c $< -o $@
720ee7f6 134
135
73a85369 136#pico/sound/ym2612.o : ../../pico/sound/ym2612.c
137# @echo ">>>" $@
138# $(CC) $(CFLAGS) -c $< -o $@
faffbf2d 139
93c0d147 140cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
faffbf2d 141 @echo ">>>" $<
73a85369 142 $(CC) $(CFLAGS) -Wno-unused -c $< -o $@
2b90fc61 143