Commit | Line | Data |
---|---|---|
d4d62665 | 1 | TARGET ?= PicoDrive |
2 | CFLAGS += -Wall -ggdb -falign-functions=2 | |
3 | CFLAGS += -I. | |
d4d62665 | 4 | ifndef DEBUG |
84162df4 | 5 | CFLAGS += -O3 -DNDEBUG |
f9020f35 | 6 | endif |
19886062 | 7 | #CFLAGS += -DEVT_LOG |
00faec9c | 8 | #CFLAGS += -DDRC_CMP |
12da51c2 | 9 | #cpu_cmp = 1 |
0219d379 | 10 | #drc_debug = 7 |
00faec9c | 11 | #profile = 1 |
12 | ||
e743be20 | 13 | |
d4d62665 | 14 | all: config.mak target_ |
15 | ||
16 | ifndef NO_CONFIG_MAK | |
17 | ifneq ($(wildcard config.mak),) | |
18 | config.mak: ./configure | |
19 | @echo $@ is out-of-date, running configure | |
20 | @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh | |
21 | include config.mak | |
22 | else | |
23 | config.mak: | |
24 | @echo "Please run ./configure before running make!" | |
25 | @exit 1 | |
26 | endif | |
27 | else # NO_CONFIG_MAK | |
28 | config.mak: | |
29 | endif | |
30 | ||
31 | # default settings | |
32 | ifeq "$(ARCH)" "arm" | |
33 | use_cyclone ?= 1 | |
34 | use_drz80 ?= 1 | |
35 | use_sh2drc ?= 1 | |
0a91c6e9 | 36 | use_svpdrc ?= 1 |
d4d62665 | 37 | |
0a91c6e9 | 38 | asm_memory ?= 1 |
39 | asm_render ?= 1 | |
40 | asm_ym2612 ?= 1 | |
41 | asm_misc ?= 1 | |
0a91c6e9 | 42 | asm_cdmemory ?= 1 |
43 | asm_mix ?= 1 | |
d4d62665 | 44 | else # if not arm |
d4d62665 | 45 | use_fame ?= 1 |
d4d62665 | 46 | use_cz80 ?= 1 |
d4d62665 | 47 | endif |
e743be20 | 48 | |
e743be20 | 49 | -include Makefile.local |
50 | ||
6ce90725 | 51 | ifneq "$(use_cyclone)" "1" |
2446536b | 52 | # due to CPU stop flag access |
d4d62665 | 53 | asm_cdmemory = 0 |
e743be20 | 54 | endif |
55 | ||
d4bea61c PC |
56 | ifeq "$(PLATFORM)" "opendingux" |
57 | opk: $(TARGET).opk | |
58 | ||
59 | $(TARGET).opk: $(TARGET) | |
60 | $(RM) -rf .opk_data | |
61 | cp -r platform/opendingux/data .opk_data | |
62 | cp $< .opk_data/PicoDrive | |
63 | $(STRIP) .opk_data/PicoDrive | |
64 | mksquashfs .opk_data $@ -all-root -noappend -no-exports -no-xattrs | |
65 | ||
66 | OBJS += platform/opendingux/inputmap.o | |
67 | ||
68 | # OpenDingux is a generic platform, really. | |
69 | PLATFORM := generic | |
70 | endif | |
8450a2f5 C |
71 | ifeq ("$(PLATFORM)",$(filter "$(PLATFORM)","rpi1" "rpi2")) |
72 | CFLAGS += -DHAVE_GLES -DRASPBERRY | |
73 | CFLAGS += -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads/ -I/opt/vc/include/interface/vmcs_host/linux/ | |
74 | LDFLAGS += -ldl -lbcm_host -L/opt/vc/lib -lEGL -lGLESv2 | |
75 | OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME | |
76 | OBJS += platform/common/plat_sdl.o | |
77 | OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o | |
78 | OBJS += platform/libpicofe/plat_dummy.o | |
79 | OBJS += platform/libpicofe/gl.o | |
80 | OBJS += platform/libpicofe/gl_platform.o | |
81 | USE_FRONTEND = 1 | |
82 | endif | |
2446536b | 83 | ifeq "$(PLATFORM)" "generic" |
84 | OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME | |
85 | OBJS += platform/common/plat_sdl.o | |
86 | OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o | |
87 | OBJS += platform/libpicofe/plat_dummy.o | |
88 | USE_FRONTEND = 1 | |
89 | endif | |
90 | ifeq "$(PLATFORM)" "pandora" | |
91 | platform/common/menu_pico.o: CFLAGS += -DPANDORA | |
fcdf2aff | 92 | platform/libpicofe/linux/plat.o: CFLAGS += -DPANDORA |
2446536b | 93 | OBJS += platform/pandora/plat.o |
94 | OBJS += platform/pandora/asm_utils.o | |
95 | OBJS += platform/common/arm_utils.o | |
96 | OBJS += platform/libpicofe/linux/fbdev.o | |
97 | OBJS += platform/libpicofe/linux/xenv.o | |
98 | OBJS += platform/libpicofe/pandora/plat.o | |
99 | USE_FRONTEND = 1 | |
100 | endif | |
75a30842 | 101 | ifeq "$(PLATFORM)" "gp2x" |
102 | OBJS += platform/common/arm_utils.o | |
103 | OBJS += platform/libpicofe/gp2x/in_gp2x.o | |
104 | OBJS += platform/libpicofe/gp2x/soc.o | |
105 | OBJS += platform/libpicofe/gp2x/soc_mmsp2.o | |
106 | OBJS += platform/libpicofe/gp2x/soc_pollux.o | |
107 | OBJS += platform/libpicofe/gp2x/plat.o | |
108 | OBJS += platform/libpicofe/gp2x/pollux_set.o | |
109 | OBJS += platform/gp2x/940ctl.o | |
110 | OBJS += platform/gp2x/plat.o | |
111 | OBJS += platform/gp2x/emu.o | |
112 | OBJS += platform/gp2x/vid_mmsp2.o | |
113 | OBJS += platform/gp2x/vid_pollux.o | |
114 | OBJS += platform/gp2x/warm.o | |
115 | USE_FRONTEND = 1 | |
116 | PLATFORM_MP3 = 1 | |
117 | endif | |
2446536b | 118 | ifeq "$(PLATFORM)" "libretro" |
119 | OBJS += platform/libretro.o | |
120 | endif | |
121 | ||
122 | ifeq "$(USE_FRONTEND)" "1" | |
123 | ||
e743be20 | 124 | # common |
d4d62665 | 125 | OBJS += platform/common/main.o platform/common/emu.o \ |
126 | platform/common/menu_pico.o platform/common/config_file.o | |
e743be20 | 127 | |
128 | # libpicofe | |
129 | OBJS += platform/libpicofe/input.o platform/libpicofe/readpng.o \ | |
130 | platform/libpicofe/fonts.o platform/libpicofe/linux/in_evdev.o \ | |
d4d62665 | 131 | platform/libpicofe/linux/plat.o |
e743be20 | 132 | |
d4d62665 | 133 | # libpicofe - sound |
134 | OBJS += platform/libpicofe/sndout.o | |
135 | ifneq ($(findstring oss,$(SOUND_DRIVERS)),) | |
136 | platform/libpicofe/sndout.o: CFLAGS += -DHAVE_OSS | |
137 | OBJS += platform/libpicofe/linux/sndout_oss.o | |
138 | endif | |
139 | ifneq ($(findstring alsa,$(SOUND_DRIVERS)),) | |
140 | platform/libpicofe/sndout.o: CFLAGS += -DHAVE_ALSA | |
141 | OBJS += platform/libpicofe/linux/sndout_alsa.o | |
142 | endif | |
143 | ifneq ($(findstring sdl,$(SOUND_DRIVERS)),) | |
144 | platform/libpicofe/sndout.o: CFLAGS += -DHAVE_SDL | |
145 | OBJS += platform/libpicofe/sndout_sdl.o | |
146 | endif | |
e743be20 | 147 | |
e743be20 | 148 | ifeq "$(ARCH)" "arm" |
d4d62665 | 149 | OBJS += platform/libpicofe/arm_linux.o |
d4d62665 | 150 | endif |
e743be20 | 151 | |
2446536b | 152 | endif # USE_FRONTEND |
153 | ||
fc11dd05 | 154 | OBJS += platform/common/mp3.o |
75a30842 | 155 | ifeq "$(PLATFORM_MP3)" "1" |
156 | else ifeq "$(HAVE_LIBAVCODEC)" "1" | |
fc11dd05 | 157 | OBJS += platform/common/mp3_libavcodec.o |
158 | else | |
2446536b | 159 | OBJS += platform/common/mp3_dummy.o |
fc11dd05 | 160 | endif |
2446536b | 161 | |
325ee167 | 162 | ifeq "$(PLATFORM)" "libretro" |
e743be20 | 163 | # zlib |
164 | OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ | |
165 | zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o | |
325ee167 | 166 | CFLAGS += -Izlib |
167 | endif | |
e743be20 | 168 | # unzip |
b4c2331e | 169 | OBJS += unzip/unzip.o |
e743be20 | 170 | |
d4d62665 | 171 | |
e743be20 | 172 | include platform/common/common.mak |
173 | ||
98dbc3ab | 174 | OBJS += $(OBJS_COMMON) |
175 | CFLAGS += $(addprefix -D,$(DEFINES)) | |
176 | ||
9aee8770 | 177 | ifneq ($(findstring gcc,$(CC)),) |
178 | LDFLAGS += -Wl,-Map=$(TARGET).map | |
179 | endif | |
180 | ||
181 | ||
d4d62665 | 182 | target_: $(TARGET) |
e743be20 | 183 | |
184 | clean: | |
d4d62665 | 185 | $(RM) $(TARGET) $(OBJS) |
d4bea61c | 186 | $(RM) -r .opk_data |
e743be20 | 187 | |
d4d62665 | 188 | $(TARGET): $(OBJS) |
9aee8770 | 189 | $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) |
e743be20 | 190 | |
191 | pprof: platform/linux/pprof.c | |
192 | $(CC) -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@ | |
d4d62665 | 193 | |
98dbc3ab | 194 | tools/textfilter: tools/textfilter.c |
195 | make -C tools/ textfilter | |
196 | ||
197 | .s.o: | |
198 | $(CC) $(CFLAGS) -c $< -o $@ | |
199 | ||
ae7830aa | 200 | .S.o: |
201 | $(CC) $(CFLAGS) -c $< -o $@ | |
202 | ||
895d1512 | 203 | # special flags - perhaps fix this someday instead? |
204 | pico/draw.o: CFLAGS += -fno-strict-aliasing | |
205 | pico/draw2.o: CFLAGS += -fno-strict-aliasing | |
206 | pico/mode4.o: CFLAGS += -fno-strict-aliasing | |
207 | pico/cd/memory.o: CFLAGS += -fno-strict-aliasing | |
208 | pico/cd/cd_file.o: CFLAGS += -fno-strict-aliasing | |
209 | pico/cd/pcm.o: CFLAGS += -fno-strict-aliasing | |
210 | pico/cd/LC89510.o: CFLAGS += -fno-strict-aliasing | |
211 | pico/cd/gfx_cd.o: CFLAGS += -fno-strict-aliasing | |
212 | ||
0bc48495 | 213 | # fame needs ~2GB of RAM to compile on gcc 4.8 |
214 | # on x86, this is reduced by ~300MB when debug info is off (but not on ARM) | |
0270424f | 215 | # not using O3 and -fno-expensive-optimizations seems to also help, but you may |
216 | # want to remove this stuff for better performance if your compiler can handle it | |
c6e1e977 | 217 | ifndef DEBUG |
0270424f | 218 | cpu/fame/famec.o: CFLAGS += -g0 -O2 -fno-expensive-optimizations |
c6e1e977 | 219 | endif |
0bc48495 | 220 | |
40d22a8e | 221 | pico/carthw_cfg.c: pico/carthw.cfg |
222 | tools/make_carthw_c $< $@ | |
223 | ||
98dbc3ab | 224 | # random deps |
225 | pico/carthw/svp/compiler.o : cpu/drc/emit_$(ARCH).c | |
226 | cpu/sh2/compiler.o : cpu/drc/emit_$(ARCH).c | |
227 | cpu/sh2/mame/sh2pico.o : cpu/sh2/mame/sh2.c | |
89dbbf2b | 228 | pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c pico/pico_int.h |
fa8fb754 | 229 | pico/memory.o pico/cd/memory.o pico/32x/memory.o : pico/pico_int.h pico/memory.h |
98dbc3ab | 230 | cpu/fame/famec.o: cpu/fame/famec.c cpu/fame/famec_opcodes.h |