move select from evdev to upper level
[picodrive.git] / platform / linux / Makefile
1
2 # settings
3 use_musashi = 1
4 #use_fame = 1
5 #use_mz80 = 1
6
7 # profile = 1
8
9
10 DEFINC = -I../.. -I. -D__GP2X__ -D_UNZIP_SUPPORT -DIO_STATS -DIN_EVDEV # -DBENCHMARK
11 GCC = gcc
12 STRIP = strip
13 AS = gcc
14
15 ifeq "$(profile)" "1"
16 COPT_COMMON = -s -O3 -ftracer -fstrength-reduce -Wall -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math -fprofile-generate
17 COPT = $(COPT_COMMON)
18 else
19 COPT = -ggdb -Wall -fno-strict-aliasing # -pg -O3  -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -ffast-math
20 COPT_COMMON = $(COPT)
21 endif
22
23 # gtk
24 COPT    += `pkg-config --cflags gtk+-2.0`
25 LDFLAGS += `pkg-config --libs gtk+-2.0`
26 COPT    += `pkg-config --cflags gthread-2.0`
27 LDFLAGS += `pkg-config --libs gthread-2.0`
28
29 # frontend
30 OBJS += platform/gp2x/main.o platform/gp2x/menu.o platform/gp2x/emu.o usbjoy.o blit.o \
31                 in_evdev.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
32
33 # common
34 OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \
35                 platform/common/readpng.o platform/common/input.o platform/common/mp3_helix.o
36
37 # Pico
38 OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
39                 pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o
40 # Pico - CD
41 OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \
42                 pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \
43                 pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.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 DEFINC += -DEMU_M68K
59 OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
60 endif
61 ifeq "$(use_fame)" "1"
62 DEFINC += -DEMU_F68K
63 OBJS += cpu/fame/famec.o
64 endif
65 # z80
66 ifeq "$(use_mz80)" "1"
67 DEFINC += -D_USE_MZ80
68 OBJS += cpu/mz80/mz80.o
69 else
70 DEFINC += -D_USE_CZ80
71 OBJS += cpu/cz80/cz80.o
72 endif
73 # misc
74 ifeq "$(use_fame)" "1"
75 ifeq "$(use_musashi)" "1"
76 OBJS += pico/debugCPU.o
77 OBJS += cpu/musashi/m68kdasm.o
78 endif
79 endif
80 OBJS += cpu/musashi/m68kdasm.o
81
82 vpath %.c = ../..
83 DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \
84         zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
85
86 all: mkdirs PicoDrive
87 clean: tidy
88         @$(RM) PicoDrive
89 tidy:
90         $(RM) $(OBJS)
91         rm -rf $(DIRS)
92         @make -C ../../cpu/mz80/ clean
93         @make -C ../common/helix/ X86=1 clean
94
95 PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
96         @echo ">>>" $@
97         $(GCC) $(COPT) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
98
99 mkdirs:
100         mkdir -p $(DIRS)
101
102 pico/carthw/svp/compiler.o : ../../pico/carthw/svp/gen_arm.c
103 pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h
104 pico/memory.o pico/cd/memory.o : ../../pico/memory_cmn.c ../../pico/pico_int.h
105
106 ../../cpu/musashi/m68kops.c :
107         @make -C ../../cpu/musashi
108
109 cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm
110         @echo $@
111         @nasm -f elf $< -o $@
112
113 ../../cpu/mz80/mz80.asm :
114         @make -C ../../cpu/mz80/
115
116 ../common/helix/helix_mp3_x86.a:
117         @make -C ../common/helix/ X86=1 clean all
118
119 .c.o:
120         @echo ">>>" $<
121         $(GCC) $(COPT) $(DEFINC) -c $< -o $@
122 .s.o:
123         @echo ">>>" $<
124         $(GCC) $(COPT) $(DEFINC) -c $< -o $@
125
126
127 pico/sound/ym2612.o : ../../pico/sound/ym2612.c
128         @echo ">>>" $@
129         $(GCC) $(COPT_COMMON) $(DEFINC) -c $< -o $@
130
131 cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
132         @echo ">>>" $<
133         $(GCC) $(COPT) $(DEFINC) -Wno-unused -c $< -o $@
134
135