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