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