720ee7f6 |
1 | \r |
2 | # you may or may not need to change this\r |
3 | #devkit_path = x:/stuff/dev/devkitgp2x/\r |
720ee7f6 |
4 | CROSS = arm-linux-\r |
5 | #CROSS = $(devkit_path)bin/arm-linux-\r |
6 | \r |
7 | # settings\r |
720ee7f6 |
8 | #mz80 = 1\r |
35a9cf0f |
9 | debug_cyclone = 0\r |
dfa4c846 |
10 | asm_memory = 1\r |
720ee7f6 |
11 | asm_render = 1\r |
12 | asm_ym2612 = 1\r |
01939b3b |
13 | asm_misc = 1\r |
2fb6c387 |
14 | asm_cdpico = 1\r |
d032c15a |
15 | asm_cdmemory = 1\r |
720ee7f6 |
16 | #profile = 1\r |
17 | #use_musashi = 1\r |
18 | #up = 1\r |
19 | \r |
35a9cf0f |
20 | \r |
21 | ifeq "$(debug_cyclone)" "1"\r |
22 | use_cyclone = 1\r |
23 | use_musashi = 1\r |
e52fb441 |
24 | endif\r |
25 | ifeq "$(use_musashi)" "1"\r |
26 | asm_cdpico = 0\r |
35a9cf0f |
27 | asm_memory = 0\r |
28 | asm_cdmemory = 0\r |
e52fb441 |
29 | else\r |
35a9cf0f |
30 | use_cyclone = 1\r |
31 | endif\r |
32 | \r |
b30a8e67 |
33 | DEFINC = -I../.. -I. -DARM -D__GP2X__ -D_UNZIP_SUPPORT # -DBENCHMARK\r |
35a9cf0f |
34 | COPT_COMMON = -static -Wall -O3 -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math # -s\r |
720ee7f6 |
35 | ifeq "$(profile)" "1"\r |
36 | COPT_COMMON += -fprofile-generate\r |
37 | endif\r |
38 | ifeq "$(profile)" "2"\r |
39 | COPT_COMMON += -fprofile-use\r |
40 | endif\r |
41 | COPT = $(COPT_COMMON) -mtune=arm920t\r |
42 | ASOPT = -mcpu=arm920t -mfloat-abi=soft\r |
43 | GCC = $(CROSS)gcc\r |
44 | STRIP = $(CROSS)strip\r |
45 | AS = $(CROSS)as\r |
46 | LD = $(CROSS)ld\r |
47 | OBJCOPY = $(CROSS)objcopy\r |
48 | \r |
49 | # frontend\r |
0805b5b4 |
50 | OBJS += main.o menu.o fonts.o gp2x.o usbjoy.o emu.o squidgehack.o asmutils.o cpuctrl.o\r |
720ee7f6 |
51 | # 940 core control\r |
4dfd9f42 |
52 | OBJS += 940ctl.o\r |
720ee7f6 |
53 | # Pico\r |
54 | OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory.o ../../Pico/Misc.o \\r |
70d2ecc5 |
55 | ../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \\r |
56 | ../../Pico/Patch.o\r |
25fced50 |
57 | # Pico - CD\r |
58 | OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \\r |
979ba09f |
59 | ../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \\r |
5f9922e6 |
60 | ../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o\r |
720ee7f6 |
61 | # asm stuff\r |
62 | ifeq "$(asm_render)" "1"\r |
63 | DEFINC += -D_ASM_DRAW_C\r |
64 | OBJS += ../../Pico/draw_asm.o ../../Pico/draw2_asm.o\r |
65 | endif\r |
66 | ifeq "$(asm_memory)" "1"\r |
67 | DEFINC += -D_ASM_MEMORY_C\r |
68 | OBJS += ../../Pico/memory_asm.o\r |
69 | endif\r |
70 | ifeq "$(asm_ym2612)" "1"\r |
71 | DEFINC += -D_ASM_YM2612_C\r |
72 | OBJS += ../../Pico/sound/ym2612_asm.o\r |
73 | endif\r |
3294e5d9 |
74 | ifeq "$(asm_misc)" "1"\r |
75 | DEFINC += -D_ASM_MISC_C\r |
76 | OBJS += ../../Pico/misc_asm.o\r |
6ab2f79c |
77 | OBJS += ../../Pico/cd/misc_asm.o\r |
3294e5d9 |
78 | endif\r |
2fb6c387 |
79 | ifeq "$(asm_cdpico)" "1"\r |
80 | DEFINC += -D_ASM_CD_PICO_C\r |
81 | OBJS += ../../Pico/cd/pico_asm.o\r |
82 | endif\r |
d032c15a |
83 | ifeq "$(asm_cdmemory)" "1"\r |
84 | DEFINC += -D_ASM_CD_MEMORY_C\r |
85 | OBJS += ../../Pico/cd/memory_asm.o\r |
86 | endif\r |
720ee7f6 |
87 | # Pico - sound\r |
49fe50f0 |
88 | OBJS += ../../Pico/sound/mix_asm.o\r |
720ee7f6 |
89 | OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o\r |
90 | # zlib\r |
91 | OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \\r |
92 | ../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o\r |
93 | # unzip\r |
af6e9c49 |
94 | OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o\r |
598e7c06 |
95 | # mp3\r |
96 | OBJS += mp3.o\r |
35a9cf0f |
97 | # debug\r |
98 | ifeq "$(debug_cyclone)" "1"\r |
99 | OBJS += ../../Pico/_cyclone_debug.o ../../cpu/musashi/m68kdasm.o\r |
100 | endif\r |
720ee7f6 |
101 | # CPU cores\r |
102 | ifeq "$(use_musashi)" "1"\r |
103 | DEFINC += -DEMU_M68K\r |
e52fb441 |
104 | OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o\r |
35a9cf0f |
105 | endif\r |
106 | ifeq "$(use_cyclone)" "1"\r |
720ee7f6 |
107 | DEFINC += -DEMU_C68K\r |
108 | OBJS += ../../cpu/Cyclone/proj/Cyclone.o\r |
109 | endif\r |
110 | # drz80/mz80\r |
111 | ifeq "$(mz80)" "1"\r |
112 | DEFINC += -D_USE_MZ80\r |
113 | OBJS += ../../cpu/mz80/mz80.o\r |
114 | else\r |
115 | DEFINC += -D_USE_DRZ80\r |
116 | OBJS += ../../cpu/DrZ80/drz80.o\r |
117 | endif\r |
118 | \r |
598e7c06 |
119 | \r |
b30a8e67 |
120 | all: PicoDrive.gpe\r |
720ee7f6 |
121 | \r |
598e7c06 |
122 | PicoDrive.gpe : $(OBJS) helix/helix_mp3.a\r |
720ee7f6 |
123 | @echo $@\r |
2fb6c387 |
124 | @$(GCC) -o $@ $(COPT) $^ -lm -Wl,-Map=PicoDrive.map\r |
125 | ifeq ($(DEBUG),)\r |
720ee7f6 |
126 | @$(STRIP) $@\r |
2fb6c387 |
127 | endif\r |
598e7c06 |
128 | # @$(GCC) $(COPT) $(OBJS) -lm -o PicoDrive_.gpe\r |
720ee7f6 |
129 | # @gpecomp PicoDrive_.gpe $@\r |
130 | ifeq "$(up)" "1"\r |
131 | @cmd //C copy $@ \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\\r |
132 | endif\r |
133 | \r |
49fe50f0 |
134 | up: PicoDrive.gpe\r |
fb88e614 |
135 | @cp -v PicoDrive.gpe /mnt/gp2x/mnt/sd/emus/PicoDrive/\r |
5111820c |
136 | \r |
137 | # @cmd //C copy PicoDrive.gpe \\\\10.0.1.2\\gp2x\\mnt\\sd\\games\\PicoDrive\\\r |
138 | \r |
720ee7f6 |
139 | \r |
140 | testrefr.gpe : test.o gp2x.o asmutils.o\r |
141 | @echo $@\r |
598e7c06 |
142 | @$(GCC) $(COPT) $^ -o $@\r |
720ee7f6 |
143 | @$(STRIP) $@\r |
144 | \r |
145 | .c.o:\r |
146 | @echo $<\r |
147 | @$(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
148 | .s.o:\r |
149 | @echo $<\r |
150 | @$(GCC) $(COPT) $(DEFINC) -c $< -o $@\r |
151 | \r |
152 | ../../Pico/draw_asm.o : ../../Pico/Draw.s\r |
153 | @echo $<\r |
154 | @$(AS) $(ASOPT) $< -o $@\r |
155 | ../../Pico/draw2_asm.o : ../../Pico/Draw2.s\r |
156 | @echo $<\r |
157 | @$(AS) $(ASOPT) $< -o $@\r |
158 | ../../Pico/memory_asm.o : ../../Pico/Memory.s\r |
159 | @echo $<\r |
160 | @$(AS) $(ASOPT) $< -o $@\r |
161 | ../../Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s\r |
162 | @echo $<\r |
163 | @$(AS) $(ASOPT) $< -o $@\r |
49fe50f0 |
164 | ../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s\r |
165 | @echo $<\r |
166 | @$(AS) $(ASOPT) $< -o $@\r |
3294e5d9 |
167 | ../../Pico/misc_asm.o : ../../Pico/misc.s\r |
168 | @echo $<\r |
169 | @$(AS) $(ASOPT) $< -o $@\r |
2fb6c387 |
170 | ../../Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s\r |
171 | @echo $<\r |
172 | @$(AS) $(ASOPT) $< -o $@\r |
d032c15a |
173 | ../../Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s\r |
174 | @echo $<\r |
175 | @$(AS) $(ASOPT) $< -o $@\r |
6ab2f79c |
176 | ../../Pico/cd/misc_asm.o : ../../Pico/cd/misc.s\r |
177 | @echo $<\r |
178 | @$(AS) $(ASOPT) $< -o $@\r |
720ee7f6 |
179 | \r |
180 | # build Cyclone\r |
181 | ../../cpu/Cyclone/proj/Cyclone.s :\r |
182 | @echo building Cyclone...\r |
e52fb441 |
183 | @make -C ../../cpu/Cyclone/proj\r |
184 | \r |
185 | ../../cpu/musashi/m68kops.c :\r |
186 | @make -C ../../cpu/musashi\r |
187 | \r |
720ee7f6 |
188 | \r |
598e7c06 |
189 | # build helix libs\r |
190 | helix/helix_mp3.a:\r |
191 | make -C helix\r |
192 | \r |
720ee7f6 |
193 | \r |
720ee7f6 |
194 | # cleanup\r |
b30a8e67 |
195 | clean: tidy\r |
720ee7f6 |
196 | @$(RM) PicoDrive.gpe\r |
b30a8e67 |
197 | tidy:\r |
720ee7f6 |
198 | @$(RM) $(OBJS)\r |
199 | # @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean\r |
200 | \r |
720ee7f6 |
201 | \r |
202 | clean_prof:\r |
203 | find ../.. -name '*.gcno' -delete\r |
204 | find ../.. -name '*.gcda' -delete\r |
205 | \r |
598e7c06 |
206 | # ----------- release -----------\r |
207 | ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r |
208 | ifeq ($(VER),)\r |
209 | $(error need VER)\r |
210 | endif\r |
211 | endif\r |
212 | \r |
b49ec748 |
213 | rel: PicoDrive.gpe code940/code940.bin ../readme.txt config.txt PicoDrive.man.txt PicoDrive.png\r |
598e7c06 |
214 | zip -9 -j ../../PicoDrive_$(VER).zip $^ mmuhack.o\r |
215 | \r |
216 | code940/code940.bin:\r |
217 | make -C code940/\r |
218 | \r |
219 | \r |
720ee7f6 |
220 | # test\r |
b49ec748 |
221 | #usbjoy.o : usbjoy.c\r |
222 | # @echo $<\r |
223 | # @$(GCC) $(COPT) $(DEFINC) -fno-profile-generate -c $< -o $@\r |
224 | #\r |
225 | #../../Pico/Cart.o : ../../Pico/Cart.c\r |
226 | # @echo $<\r |
227 | # @$(GCC) $(COPT) $(DEFINC) -fno-profile-generate -c $< -o $@\r |
228 | #\r |
229 | #../../zlib/trees.o : ../../zlib/trees.c\r |
230 | # @echo $<\r |
231 | # @$(GCC) $(COPT) $(DEFINC) -fno-profile-generate -c $< -o $@\r |
720ee7f6 |
232 | \r |