cc68a136 |
1 | \r |
2 | # you may or may not need to change this\r |
3 | #devkit_path = x:/stuff/dev/devkitgp2x/\r |
da42200b |
4 | export CROSS = arm-linux-\r |
cc68a136 |
5 | #CROSS = $(devkit_path)bin/arm-linux-\r |
6 | \r |
7 | # settings\r |
cc68a136 |
8 | #mz80 = 1\r |
0af33fe0 |
9 | #debug_cyclone = 1\r |
66fdc0f0 |
10 | asm_memory = 1\r |
cc68a136 |
11 | asm_render = 1\r |
12 | asm_ym2612 = 1\r |
3a81ecde |
13 | asm_misc = 1\r |
7336a99a |
14 | asm_cdpico = 1\r |
4ff2d527 |
15 | asm_cdmemory = 1\r |
e8151fd5 |
16 | amalgamate = 0\r |
cc68a136 |
17 | #profile = 1\r |
18 | #use_musashi = 1\r |
19 | #up = 1\r |
20 | \r |
2d0b15bb |
21 | \r |
22 | ifeq "$(debug_cyclone)" "1"\r |
23 | use_cyclone = 1\r |
24 | use_musashi = 1\r |
2270612a |
25 | endif\r |
26 | ifeq "$(use_musashi)" "1"\r |
27 | asm_cdpico = 0\r |
2d0b15bb |
28 | asm_memory = 0\r |
29 | asm_cdmemory = 0\r |
2270612a |
30 | else\r |
2d0b15bb |
31 | use_cyclone = 1\r |
32 | endif\r |
33 | \r |
3ec29f01 |
34 | DEFINC = -I../.. -I. -DARM -D__GP2X__ # -DBENCHMARK\r |
1dceadae |
35 | COPT_COMMON = -static -Wall -Winline\r |
36 | ifeq ($(DEBUG),)\r |
ca61ee42 |
37 | COPT_COMMON += -O3 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math\r |
1dceadae |
38 | else\r |
39 | COPT_COMMON += -ggdb\r |
40 | endif\r |
cc68a136 |
41 | ifeq "$(profile)" "1"\r |
42 | COPT_COMMON += -fprofile-generate\r |
43 | endif\r |
44 | ifeq "$(profile)" "2"\r |
45 | COPT_COMMON += -fprofile-use\r |
46 | endif\r |
47 | COPT = $(COPT_COMMON) -mtune=arm920t\r |
48 | ASOPT = -mcpu=arm920t -mfloat-abi=soft\r |
49 | GCC = $(CROSS)gcc\r |
50 | STRIP = $(CROSS)strip\r |
51 | AS = $(CROSS)as\r |
52 | LD = $(CROSS)ld\r |
53 | OBJCOPY = $(CROSS)objcopy\r |
54 | \r |
55 | # frontend\r |
e5f426aa |
56 | OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o\r |
cc68a136 |
57 | # 940 core control\r |
85f8e929 |
58 | OBJS += 940ctl.o\r |
eff55556 |
59 | \r |
e5f426aa |
60 | # common\r |
58c86d00 |
61 | OBJS += ../common/emu.o ../common/menu.o ../common/fonts.o ../common/config.o ../common/arm_utils.o \\r |
da42200b |
62 | ../common/readpng.o ../common/mp3_helix.o\r |
e5f426aa |
63 | \r |
cc68a136 |
64 | # Pico\r |
eff55556 |
65 | ifeq "$(amalgamate)" "1"\r |
66 | OBJS += ../../PicoAll.o\r |
67 | else\r |
68 | OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \\r |
b67ef287 |
69 | ../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \\r |
70 | ../../Pico/Patch.o\r |
8c1952f0 |
71 | # Pico - CD\r |
72 | OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \\r |
9037e45d |
73 | ../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/cue.o ../../Pico/cd/gfx_cd.o \\r |
0a051f55 |
74 | ../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o\r |
eff55556 |
75 | endif\r |
c9e1affc |
76 | # Pico - Pico\r |
4b9c5888 |
77 | OBJS += ../../Pico/Pico/Pico.o ../../Pico/Pico/Memory.o ../../Pico/Pico/xpcm.o\r |
0ffefdb8 |
78 | # Pico - carthw\r |
14565041 |
79 | OBJS += ../../Pico/carthw/carthw.o ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o \\r |
80 | ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/compiler.o ../../Pico/carthw/svp/stub_arm.o\r |
eff55556 |
81 | \r |
cc68a136 |
82 | # asm stuff\r |
83 | ifeq "$(asm_render)" "1"\r |
84 | DEFINC += -D_ASM_DRAW_C\r |
85 | OBJS += ../../Pico/draw_asm.o ../../Pico/draw2_asm.o\r |
86 | endif\r |
87 | ifeq "$(asm_memory)" "1"\r |
88 | DEFINC += -D_ASM_MEMORY_C\r |
89 | OBJS += ../../Pico/memory_asm.o\r |
90 | endif\r |
91 | ifeq "$(asm_ym2612)" "1"\r |
92 | DEFINC += -D_ASM_YM2612_C\r |
93 | OBJS += ../../Pico/sound/ym2612_asm.o\r |
94 | endif\r |
cea65903 |
95 | ifeq "$(asm_misc)" "1"\r |
96 | DEFINC += -D_ASM_MISC_C\r |
97 | OBJS += ../../Pico/misc_asm.o\r |
6cadc2da |
98 | OBJS += ../../Pico/cd/misc_asm.o\r |
cea65903 |
99 | endif\r |
7336a99a |
100 | ifeq "$(asm_cdpico)" "1"\r |
101 | DEFINC += -D_ASM_CD_PICO_C\r |
102 | OBJS += ../../Pico/cd/pico_asm.o\r |
103 | endif\r |
4ff2d527 |
104 | ifeq "$(asm_cdmemory)" "1"\r |
105 | DEFINC += -D_ASM_CD_MEMORY_C\r |
106 | OBJS += ../../Pico/cd/memory_asm.o\r |
107 | endif\r |
eff55556 |
108 | \r |
cc68a136 |
109 | # Pico - sound\r |
eff55556 |
110 | ifneq "$(amalgamate)" "1"\r |
111 | OBJS += ../../Pico/sound/sound.o\r |
112 | endif\r |
4f265db7 |
113 | OBJS += ../../Pico/sound/mix_asm.o\r |
eff55556 |
114 | OBJS += ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o\r |
cc68a136 |
115 | # zlib\r |
116 | OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \\r |
117 | ../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o\r |
118 | # unzip\r |
83bd0b76 |
119 | OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o\r |
2d0b15bb |
120 | # debug\r |
121 | ifeq "$(debug_cyclone)" "1"\r |
99464b62 |
122 | OBJS += ../../Pico/Debug.o ../../cpu/musashi/m68kdasm.o\r |
2d0b15bb |
123 | endif\r |
cc68a136 |
124 | # CPU cores\r |
125 | ifeq "$(use_musashi)" "1"\r |
126 | DEFINC += -DEMU_M68K\r |
2270612a |
127 | OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o\r |
2d0b15bb |
128 | endif\r |
129 | ifeq "$(use_cyclone)" "1"\r |
cc68a136 |
130 | DEFINC += -DEMU_C68K\r |
053fd9b4 |
131 | OBJS += ../../cpu/Cyclone/proj/Cyclone.o ../../cpu/Cyclone/tools/idle.o\r |
cc68a136 |
132 | endif\r |
133 | # drz80/mz80\r |
134 | ifeq "$(mz80)" "1"\r |
135 | DEFINC += -D_USE_MZ80\r |
136 | OBJS += ../../cpu/mz80/mz80.o\r |
137 | else\r |
138 | DEFINC += -D_USE_DRZ80\r |
139 | OBJS += ../../cpu/DrZ80/drz80.o\r |
140 | endif\r |
141 | \r |
cb0316e4 |
142 | \r |
42c7b147 |
143 | all: PicoDrive.gpe\r |
cc68a136 |
144 | \r |
da42200b |
145 | PicoDrive.gpe : $(OBJS) ../common/helix/helix_mp3.a\r |
b542be46 |
146 | @echo ">>>" $@\r |
147 | $(GCC) -o $@ $(COPT) $^ -lm -lpng -Wl,-Map=PicoDrive.map\r |
7336a99a |
148 | ifeq ($(DEBUG),)\r |
b542be46 |
149 | $(STRIP) $@\r |
cc68a136 |
150 | endif\r |
151 | \r |
4f265db7 |
152 | up: PicoDrive.gpe\r |
d5d11924 |
153 | @cp -v PicoDrive.gpe /mnt/gp2x/mnt/sd/emus/PicoDrive/\r |
672ad671 |
154 | \r |
155 | # @cmd //C copy PicoDrive.gpe \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\\r |
156 | \r |
cc68a136 |
157 | \r |
cc68a136 |
158 | .c.o:\r |
b542be46 |
159 | @echo ">>>" $<\r |
160 | $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
cc68a136 |
161 | .s.o:\r |
b542be46 |
162 | @echo ">>>" $<\r |
163 | $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
e807ac75 |
164 | .S.o:\r |
165 | @echo ">>>" $<\r |
166 | $(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
cc68a136 |
167 | \r |
5c129565 |
168 | ../../Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c\r |
169 | \r |
cc68a136 |
170 | ../../Pico/draw_asm.o : ../../Pico/Draw.s\r |
b542be46 |
171 | @echo ">>>" $<\r |
172 | $(AS) $(ASOPT) $< -o $@\r |
cc68a136 |
173 | ../../Pico/draw2_asm.o : ../../Pico/Draw2.s\r |
b542be46 |
174 | @echo ">>>" $<\r |
175 | $(AS) $(ASOPT) $< -o $@\r |
cc68a136 |
176 | ../../Pico/memory_asm.o : ../../Pico/Memory.s\r |
b542be46 |
177 | @echo ">>>" $<\r |
178 | $(AS) $(ASOPT) $< -o $@\r |
cc68a136 |
179 | ../../Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s\r |
b542be46 |
180 | @echo ">>>" $<\r |
181 | $(AS) $(ASOPT) $< -o $@\r |
4f265db7 |
182 | ../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s\r |
b542be46 |
183 | @echo ">>>" $<\r |
184 | $(AS) $(ASOPT) $< -o $@\r |
ea8c405f |
185 | ../../Pico/misc_asm.o : ../../Pico/Misc.s\r |
b542be46 |
186 | @echo ">>>" $<\r |
187 | $(AS) $(ASOPT) $< -o $@\r |
7336a99a |
188 | ../../Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s\r |
b542be46 |
189 | @echo ">>>" $<\r |
190 | $(AS) $(ASOPT) $< -o $@\r |
4ff2d527 |
191 | ../../Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s\r |
b542be46 |
192 | @echo ">>>" $<\r |
193 | $(AS) $(ASOPT) $< -o $@\r |
ea8c405f |
194 | ../../Pico/cd/misc_asm.o : ../../Pico/cd/Misc.s\r |
b542be46 |
195 | @echo ">>>" $<\r |
196 | $(AS) $(ASOPT) $< -o $@\r |
cc68a136 |
197 | \r |
198 | # build Cyclone\r |
199 | ../../cpu/Cyclone/proj/Cyclone.s :\r |
200 | @echo building Cyclone...\r |
0af33fe0 |
201 | @make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h\r |
2270612a |
202 | \r |
203 | ../../cpu/musashi/m68kops.c :\r |
204 | @make -C ../../cpu/musashi\r |
205 | \r |
e352c3af |
206 | ../../Pico/Pico.o ../../Pico/cd/Pico.o: ../../Pico/PicoFrameHints.c ../../Pico/PicoInt.h\r |
4b9c5888 |
207 | ../../Pico/Memory.o Pico/cd/Memory.o : ../../Pico/MemoryCmn.c ../../Pico/PicoInt.h\r |
cc68a136 |
208 | \r |
cb0316e4 |
209 | # build helix libs\r |
da42200b |
210 | ../common/helix/helix_mp3.a:\r |
211 | make -C ../common/helix\r |
cb0316e4 |
212 | \r |
7eed09b3 |
213 | readme.txt: ../../tools/textfilter ../base_readme.txt\r |
214 | ../../tools/textfilter ../base_readme.txt $@ GP2X\r |
215 | \r |
216 | ../../tools/textfilter: ../../tools/textfilter.c\r |
217 | make -C ../../tools/ textfilter\r |
218 | \r |
cc68a136 |
219 | \r |
cc68a136 |
220 | # cleanup\r |
42c7b147 |
221 | clean: tidy\r |
8022f53d |
222 | $(RM) PicoDrive.gpe\r |
42c7b147 |
223 | tidy:\r |
8022f53d |
224 | $(RM) $(OBJS)\r |
cc68a136 |
225 | # @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean\r |
226 | \r |
cc68a136 |
227 | \r |
228 | clean_prof:\r |
229 | find ../.. -name '*.gcno' -delete\r |
230 | find ../.. -name '*.gcda' -delete\r |
231 | \r |
cb0316e4 |
232 | # ----------- release -----------\r |
233 | ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r |
234 | ifeq ($(VER),)\r |
235 | $(error need VER)\r |
236 | endif\r |
237 | endif\r |
238 | \r |
f9d3ee9d |
239 | rel: PicoDrive.gpe code940/pico940_v2.bin readme.txt PicoDrive.man.txt PicoDrive.png ../game_def.cfg\r |
cb0316e4 |
240 | zip -9 -j ../../PicoDrive_$(VER).zip $^ mmuhack.o\r |
a4f0cc86 |
241 | zip -9 -r ../../PicoDrive_$(VER).zip skin -i \*.png -i \*.txt\r |
c0fcf293 |
242 | mkdir bin_to_cso_mp3\r |
243 | cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/\r |
244 | zip -9 -r ../../PicoDrive_$(VER).zip bin_to_cso_mp3\r |
245 | rm -rf bin_to_cso_mp3\r |
cb0316e4 |
246 | \r |
247 | code940/code940.bin:\r |
248 | make -C code940/\r |
249 | \r |