don't crash on bad timing
[picodrive.git] / Makefile
CommitLineData
d4d62665 1TARGET ?= PicoDrive
2CFLAGS += -Wall -ggdb -falign-functions=2
3CFLAGS += -I.
4# FIXME
5CFLAGS += -Iplatform/linux/
6ifndef DEBUG
7CFLAGS += -O2 -DNDEBUG
8endif
e743be20 9
d4d62665 10all: config.mak target_
11
12ifndef NO_CONFIG_MAK
13ifneq ($(wildcard config.mak),)
14config.mak: ./configure
15 @echo $@ is out-of-date, running configure
16 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
17include config.mak
18else
19config.mak:
20 @echo "Please run ./configure before running make!"
21 @exit 1
22endif
23else # NO_CONFIG_MAK
24config.mak:
25endif
26
27# default settings
28ifeq "$(ARCH)" "arm"
29use_cyclone ?= 1
30use_drz80 ?= 1
31use_sh2drc ?= 1
0a91c6e9 32use_svpdrc ?= 1
d4d62665 33
0a91c6e9 34asm_memory ?= 1
35asm_render ?= 1
36asm_ym2612 ?= 1
37asm_misc ?= 1
38asm_cdpico ?= 1
39asm_cdmemory ?= 1
40asm_mix ?= 1
d4d62665 41else # if not arm
d4d62665 42use_fame ?= 1
d4d62665 43use_cz80 ?= 1
44use_sh2mame ?= 1
45endif
e743be20 46
47#drc_debug = 3
48#drc_debug_interp = 1
49#profile = 1
50
51-include Makefile.local
52
d4d62665 53ifeq "$(use_musashi)" "1"
2446536b 54# due to CPU stop flag access
d4d62665 55asm_cdpico = 0
56asm_cdmemory = 0
e743be20 57endif
58
2446536b 59# frontend
60ifeq "$(PLATFORM)" "generic"
61OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
62OBJS += platform/common/plat_sdl.o
63OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
64OBJS += platform/libpicofe/plat_dummy.o
65USE_FRONTEND = 1
66endif
67ifeq "$(PLATFORM)" "pandora"
68platform/common/menu_pico.o: CFLAGS += -DPANDORA
69OBJS += platform/pandora/plat.o
70OBJS += platform/pandora/asm_utils.o
71OBJS += platform/common/arm_utils.o
72OBJS += platform/libpicofe/linux/fbdev.o
73OBJS += platform/libpicofe/linux/xenv.o
74OBJS += platform/libpicofe/pandora/plat.o
75USE_FRONTEND = 1
76endif
77ifeq "$(PLATFORM)" "libretro"
78OBJS += platform/libretro.o
79endif
80
81ifeq "$(USE_FRONTEND)" "1"
82
e743be20 83# common
d4d62665 84OBJS += platform/common/main.o platform/common/emu.o \
85 platform/common/menu_pico.o platform/common/config_file.o
e743be20 86
87# libpicofe
88OBJS += platform/libpicofe/input.o platform/libpicofe/readpng.o \
89 platform/libpicofe/fonts.o platform/libpicofe/linux/in_evdev.o \
d4d62665 90 platform/libpicofe/linux/plat.o
e743be20 91
d4d62665 92# libpicofe - sound
93OBJS += platform/libpicofe/sndout.o
94ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
95platform/libpicofe/sndout.o: CFLAGS += -DHAVE_OSS
96OBJS += platform/libpicofe/linux/sndout_oss.o
97endif
98ifneq ($(findstring alsa,$(SOUND_DRIVERS)),)
99platform/libpicofe/sndout.o: CFLAGS += -DHAVE_ALSA
100OBJS += platform/libpicofe/linux/sndout_alsa.o
101endif
102ifneq ($(findstring sdl,$(SOUND_DRIVERS)),)
103platform/libpicofe/sndout.o: CFLAGS += -DHAVE_SDL
104OBJS += platform/libpicofe/sndout_sdl.o
105endif
e743be20 106
e743be20 107ifeq "$(ARCH)" "arm"
d4d62665 108OBJS += platform/libpicofe/arm_linux.o
d4d62665 109endif
e743be20 110
2446536b 111endif # USE_FRONTEND
112
fc11dd05 113OBJS += platform/common/mp3.o
114ifeq "$(HAVE_LIBAVCODEC)" "1"
115OBJS += platform/common/mp3_libavcodec.o
116else
2446536b 117OBJS += platform/common/mp3_dummy.o
fc11dd05 118endif
2446536b 119
e743be20 120# zlib
121OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
122 zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
123# unzip
124OBJS += unzip/unzip.o unzip/unzip_stream.o
125
d4d62665 126
e743be20 127include platform/common/common.mak
128
98dbc3ab 129OBJS += $(OBJS_COMMON)
130CFLAGS += $(addprefix -D,$(DEFINES))
131
9aee8770 132ifneq ($(findstring gcc,$(CC)),)
133LDFLAGS += -Wl,-Map=$(TARGET).map
134endif
135
136
d4d62665 137target_: $(TARGET)
e743be20 138
139clean:
d4d62665 140 $(RM) $(TARGET) $(OBJS)
e743be20 141
d4d62665 142$(TARGET): $(OBJS)
9aee8770 143 $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS)
e743be20 144
145pprof: platform/linux/pprof.c
146 $(CC) -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@
d4d62665 147
98dbc3ab 148tools/textfilter: tools/textfilter.c
149 make -C tools/ textfilter
150
151.s.o:
152 $(CC) $(CFLAGS) -c $< -o $@
153
154# random deps
155pico/carthw/svp/compiler.o : cpu/drc/emit_$(ARCH).c
156cpu/sh2/compiler.o : cpu/drc/emit_$(ARCH).c
157cpu/sh2/mame/sh2pico.o : cpu/sh2/mame/sh2.c
158pico/pico.o pico/cd/pico.o : pico/pico_cmn.c pico/pico_int.h
159pico/memory.o pico/cd/memory.o : pico/pico_int.h pico/memory.h
160cpu/fame/famec.o: cpu/fame/famec.c cpu/fame/famec_opcodes.h
161
d4d62665 162# ----------- release -----------
163
164VER ?= $(shell head -n 1 platform/common/version.h | \
165 sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g')
166
167ifeq "$(PLATFORM)" "pandora"
168
169PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
170
171/tmp/readme.txt: tools/textfilter platform/base_readme.txt
172 tools/textfilter platform/base_readme.txt $@ PANDORA
173
174/tmp/PicoDrive.pxml: platform/pandora/PicoDrive.pxml.template
175 platform/pandora/make_pxml.sh $^ $@
176
177rel: PicoDrive platform/pandora/PicoDrive.run platform/pandora/picorestore \
178 pico/carthw.cfg /tmp/readme.txt platform/pandora/skin \
179 platform/pandora/PicoDrive.png platform/pandora/PicoDrive_p.png \
180 /tmp/PicoDrive.pxml
181 rm -rf out
182 mkdir out
183 cp -r $^ out/
184 $(PND_MAKE) -p PicoDrive_$(VER).pnd -d out -x out/PicoDrive.pxml -i out/PicoDrive.png -c
185
186endif