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