-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.attic
371 lines (301 loc) · 12.2 KB
/
Makefile.attic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# this file contains all the old outdated stuff that was remove from the
# original makefile.
ARMTARGETS=gp32 gba
SDCCTARGETS=gameboy
armcctargets: $(ARMTARGETS)
sdcctargets: $(SDCCTARGETS)
arm: armcctargets
sdcc: sdcctargets
targets: cc65 sdcc arm
#########################################################################################
# Z80/SDCC
##########################################################################################
.PHONY: gameboy gb_sdcc
GBCCFLAGS+=-I $(PINC) -I $(PARCH) -I .
gameboy: gb_sdcc
gb_sdcc: $(SOURCEFILES)
@echo "gb(c) / sdcc ..."
@$(GBCC) $(GBCCFLAGS) -S main.c -o main.asm
@$(GBAS) $(GBASFLAGS) -o main.o main.asm
@$(GBLD) -- -z portris_gb.gb \
$(PLIB)/gbstart.o \
/usr/local/share/sdcc/lib/gbz80/crt0_rle.o \
\
main.o \
\
-k $(PARCH)/gb/ -l $(PARCH)/gb/gbport.lib \
\
/usr/local/share/sdcc/lib/gbz80/_strcat.o \
/usr/local/share/sdcc/lib/gbz80/_strcpy.o \
/usr/local/share/sdcc/lib/gbz80/_strlen.o \
/usr/local/share/sdcc/lib/gbz80/_memcpy.o \
/usr/local/share/sdcc/lib/gbz80/_memset.o \
/usr/local/share/sdcc/lib/gbz80/_modslong.o \
/usr/local/share/sdcc/lib/gbz80/_divslong.o \
/usr/local/share/sdcc/lib/gbz80/_modulong.o \
/usr/local/share/sdcc/lib/gbz80/_divulong.o \
/usr/local/share/sdcc/lib/gbz80/_mullong.o \
/usr/local/share/sdcc/lib/gbz80/shift.o \
/usr/local/share/sdcc/lib/gbz80/mul.o \
/usr/local/share/sdcc/lib/gbz80/div.o \
/usr/local/share/sdcc/lib/gbz80/stubs.o \
\
$(PARCH)/gb/conio.o \
$(PARCH)/gb/memmove.o \
$(PARCH)/gb/vsprintf.o \
$(PARCH)/gb/_oserror.o \
$(PARCH)/gb/ltostr.o \
$(PARCH)/gb/get_tv.o \
$(PARCH)/gb/joystick.o\
$(PARCH)/gb/font.o \
$(PARCH)/gb/init_tt.o\
$(PARCH)/gb/set_spr.o\
$(PARCH)/gb/mv_spr.o\
$(PARCH)/gb/arand.o\
$(PARCH)/gb/hiramcpy.o\
$(PARCH)/gb/cpy_data.o \
$(PARCH)/gb/delay.o \
$(PARCH)/gb/drawing.o\
$(PARCH)/gb/rand.o\
$(PARCH)/gb/scroll_b.o\
$(PARCH)/gb/scroll_s.o\
$(PARCH)/gb/get_bk_t.o \
$(PARCH)/gb/scroll_w.o\
$(PARCH)/gb/get_data.o \
$(PARCH)/gb/serial.o\
$(PARCH)/gb/get_prop.o \
$(PARCH)/gb/set_bk_t.o\
$(PARCH)/gb/set_data.o\
$(PARCH)/gb/get_wi_t.o \
$(PARCH)/gb/set_prop.o\
$(PARCH)/gb/get_xy_t.o \
$(PARCH)/gb/set_wi_t.o\
$(PARCH)/gb/set_xy_t.o\
$(PARCH)/gb/fontms.o
.PHONY: spectrum
Z80CFLAGS+=-I $(PINC) -I $(PARCH)
spectrum: $(SOURCEFILES)
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/conio.o $(PARCH)/spectrum/conio.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/memmove.o $(PARCH)/spectrum/memmove.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/fclose.o $(PARCH)/spectrum/fclose.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/open.o $(PARCH)/spectrum/open.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/ltostr.o $(PARCH)/spectrum/ltostr.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/vsprintf.o $(PARCH)/spectrum/vsprintf.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/close.o $(PARCH)/spectrum/close.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/printk.o $(PARCH)/spectrum/printk.c
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/crt0.o $(PARCH)/spectrum/crt0.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/puts_cons.o $(PARCH)/spectrum/puts_cons.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/rand.o $(PARCH)/spectrum/rand.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/getk.o $(PARCH)/spectrum/getk.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/fputc_cons.o $(PARCH)/spectrum/fputc_cons.s
$(Z80CC) $(Z80CFLAGS) -S -o main.asm test.c
$(Z80AS) $(Z80ASFLAGS) -o main.o main.asm
$(Z80CC) --code-loc 32768 $(Z80CFLAGS) test.c -o /temp/test.ihx
bla:
-Wl-l"$(PARCH)/spectrum/crt0.o" \
-Wl-l"main.o" -Wl-o,portris_spectrum.bin
-Wl-l, "$(PARCH)/spectrum/conio.o" \
-Wl-L, $(PARCH)/spectrum/memmove.o \
-Wl-L, $(PARCH)/spectrum/fclose.o \
-Wl-L, $(PARCH)/spectrum/open.o \
-Wl-L, $(PARCH)/spectrum/ltostr.o \
-Wl-L, $(PARCH)/spectrum/vsprintf.o \
-Wl-L, $(PARCH)/spectrum/puts_cons.o \
-Wl-L, $(PARCH)/spectrum/close.o \
-Wl-L, $(PARCH)/spectrum/rand.o \
-Wl-L, $(PARCH)/spectrum/getk.o \
-Wl-L, $(PARCH)/spectrum/printk.o \
-Wl-L, $(PARCH)/spectrum/fputc_cons.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_strcat.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_strcpy.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_strlen.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_memcpy.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_memset.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_modslong.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_divslong.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_modulong.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_divulong.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/_mullong.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/shift.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/mul.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/div.o \
-Wl-L, /usr/local/share/sdcc/lib/z80/stubs.o \
makebin < portris_spectrum.ihx > portris_spectrum.bin
bin2tap portris_spectrum.bin portris_spectrum.tap 32768
aspectrum: $(SOURCEFILES)
$(Z80CC) $(Z80CFLAGS) -S -o main.asm main.c
$(Z80AS) $(Z80ASFLAGS) -o main.o main.asm
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/conio.o $(PARCH)/spectrum/conio.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/memmove.o $(PARCH)/spectrum/memmove.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/fclose.o $(PARCH)/spectrum/fclose.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/open.o $(PARCH)/spectrum/open.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/ltostr.o $(PARCH)/spectrum/ltostr.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/vsprintf.o $(PARCH)/spectrum/vsprintf.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/close.o $(PARCH)/spectrum/close.c
$(Z80CC) $(Z80CFLAGS) -c -o $(PARCH)/spectrum/printk.o $(PARCH)/spectrum/printk.c
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/crt0.o $(PARCH)/spectrum/crt0.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/puts_cons.o $(PARCH)/spectrum/puts_cons.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/rand.o $(PARCH)/spectrum/rand.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/getk.o $(PARCH)/spectrum/getk.s
$(Z80AS) $(Z80ASFLAGS) -o $(PARCH)/spectrum/fputc_cons.o $(PARCH)/spectrum/fputc_cons.s
#$(Z80CFLAGS)
#bla:
$(Z80LD) -- -m -i portris_spectrum.bin \
$(PARCH)/spectrum/crt0.o \
main.o \
$(PARCH)/spectrum/conio.o \
$(PARCH)/spectrum/memmove.o \
$(PARCH)/spectrum/fclose.o \
$(PARCH)/spectrum/open.o \
$(PARCH)/spectrum/ltostr.o \
$(PARCH)/spectrum/vsprintf.o \
$(PARCH)/spectrum/puts_cons.o \
$(PARCH)/spectrum/close.o \
$(PARCH)/spectrum/rand.o \
$(PARCH)/spectrum/getk.o \
$(PARCH)/spectrum/printk.o \
$(PARCH)/spectrum/fputc_cons.o \
\
/usr/local/share/sdcc/lib/z80/_strcat.o \
/usr/local/share/sdcc/lib/z80/_strcpy.o \
/usr/local/share/sdcc/lib/z80/_strlen.o \
/usr/local/share/sdcc/lib/z80/_memcpy.o \
/usr/local/share/sdcc/lib/z80/_memset.o \
/usr/local/share/sdcc/lib/z80/_modslong.o \
/usr/local/share/sdcc/lib/z80/_divslong.o \
/usr/local/share/sdcc/lib/z80/_modulong.o \
/usr/local/share/sdcc/lib/z80/_divulong.o \
/usr/local/share/sdcc/lib/z80/_mullong.o \
/usr/local/share/sdcc/lib/z80/shift.o \
/usr/local/share/sdcc/lib/z80/mul.o \
/usr/local/share/sdcc/lib/z80/div.o \
/usr/local/share/sdcc/lib/z80/stubs.o
makebin -p < portris_spectrum.ihx > portris_spectrum.bin
bin2tap portris_spectrum.bin portris_spectrum.tap 32768
spectrum_z88dk: $(SOURCEFILES)
$(Z88DKCC) $(Z88DKCFLAGS) -o portris_spectrum.bin main.c \
$(PARCH)/spectrum/conio.c \
$(PARCH)/spectrum/memmove.c \
$(PARCH)/spectrum/fclose.c \
$(PARCH)/spectrum/open.c \
$(PARCH)/spectrum/ltostr.c \
$(PARCH)/spectrum/vsprintf.c \
$(PARCH)/spectrum/puts_cons.asm \
$(PARCH)/spectrum/close.c \
$(Z80CLIBS)
@bin2tap portris_spectrum.bin portris_spectrum.tap 32768
#########################################################################################
# Arm/GCC
##########################################################################################
.PHONY: gba gp32
gba: $(SOURCEFILES)
@echo "gba ..."
# -W -Wall
@$(ARMCC) -O6 -c -I $(PINC) -I $(PARCH) -I. -D__GBA__ \
main.c
@$(ARMLD) -nostdlib -o portris_gba.elf \
-T $(PARCH)/gba/arm-gbabin.x \
$(PLIB)/gbastart.o \
main.o \
/opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
-lc -lg -lm -lstdc++ \
$(PLIB)/gbaport.a \
/opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
-lc -lg -lm -lstdc++
@$(ARMOBJCOPY) -v -O binary portris_gba.elf portris_gba.gba >$(DEVNULL)
gp32: $(SOURCEFILES)
@echo "gp32 ..."
# -W -Wall
@$(ARMCC) -O6 -c -I $(PINC) -I $(PARCH) -D__GP32__ \
main.c
@$(ARMLD) -nostdlib -o portris_gp32.elf -T $(PARCH)/gp32/arm-gp32bin.x \
$(PLIB)/gp32start.o \
main.o \
/opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
-lc -lg -lm -lstdc++ \
$(PLIB)/gp32port.a \
/opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
-lc -lg -lm -lstdc++
@$(ARMOBJCOPY) -v -O binary portris_gp32.elf portris_gp32.gxb >$(DEVNULL)
#########################################################################################
# gamecube
#########################################################################################
DEVKITCUBE=/usr/local/devkitcube
PORTLIBROOT=~/groepaz/libs/portlib_gc
PATH+=:/usr/local/devkitcube/bin
#PATH+=:~/gamecube/tools
#export PATH
CC=$(DEVKITCUBE)/bin/powerpc-eabi-elf-gcc
CCFLAGS=-nostdlib -Wall -W
CCFLAGS+=-I $(PORTLIBROOT)/include -D__GAMECUBE__
OBJCOPY=$(DEVKITCUBE)/bin/powerpc-eabi-elf-objcopy
STRIP=$(DEVKITCUBE)/bin/powerpc-eabi-elf-strip
LD=$(DEVKITCUBE)/bin/powerpc-eabi-elf-ld
LDFLAGS=-T $(PORTLIBROOT)/ldscripts/ppc-ngcbin.x
AS=$(DEVKITCUBE)/bin/powerpc-eabi-elf-as
AR=$(DEVKITCUBE)/bin/powerpc-eabi-elf-ar
STARTUP=$(PORTLIBROOT)/lib/startup/crt0.o
LIBS= \
$(PORTLIBROOT)/lib/libngcport.a \
-lc -lnosys
gamecube: $(SOURCEFILES)
$(CC) -c $(CCFLAGS) main.c -o main.o
$(LD) $(LDFLAGS) -o portris_gc.elf $(STARTUP) main.o $(LIBS)
$(STRIP) --remove-section=".comment" --strip-all --strip-debug --strip-unneeded --discard-all --discard-locals portris_gc.elf
#strip portris_gc.elf
$(OBJCOPY) -O binary portris_gc.elf portris_gc.bin
#########################################################################################
# pc
#########################################################################################
# to make sure the mingw32 compiler is used
#export PATH=/cygdrive/g/devcpp/bin:$PATH
BASE=j:/groepaz3
INCLUDE=$(BASE)/include
LIB=$(BASE)/lib
MCC=g:/devcpp/bin/gcc
MCCFLAGS+=-I $(INCLUDE)
MCCFLAGS+=-L $(LIB)
#MCCFLAGS+=-O2 -Wall -W -D__MINGW32__ -fshort-double -fvtable-thunks -w -fno-exceptions
MCCFLAGS+=-O2 -Wall -W -fshort-double
MCCLIBS+=-lgcc -mconsole -lmsvcrt -lmingw32port -lmingw32port-con
#-D__MINGW32__ // automatically
mingw32: main.c
$(MCC) $(MCCFLAGS) main.c $(MCCLIBS) -o portris.exe
#BASE=~/groepaz4
BASE=~/groepaz/libs/portlib_pc
INCLUDE=$(BASE)/include
LIB=$(BASE)/lib
LINCC=gcc
LINCCFLAGS+=-I $(INCLUDE)
LINCCFLAGS+=-L $(LIB)
LINCCFLAGS+=-O2 -Wall -W -fshort-double
LINCCLIBS+=-lgcc -llinuxport -llinuxport-con -lncurses -D__LINUX__
linux: main.c
$(LINCC) $(LINCCFLAGS) main.c $(LINCCLIBS) -o portris
BASE=/Users/groepaz/groepaz/libs/portlib_pc
INCLUDE=$(BASE)/include
LIB=$(BASE)/lib
OSXCC=gcc
OSXCCFLAGS+=-I$(INCLUDE)
OSXCCFLAGS+=-L$(LIB)
OSXCCFLAGS+=-O2 -Wall -W -fshort-double
OSXCCLIBS+=-lgcc -lmacosport -lmacosport-con -lncurses -D__MACOS__
macos: main.c
$(OSXCC) $(OSXCCFLAGS) main.c $(OSXCCLIBS) -o portris
OSXSDLCCFLAGS+=-I$(INCLUDE) -I/opt/local/include
OSXSDLCCFLAGS+=-L$(LIB) -L/opt/local/lib
OSXSDLCCFLAGS+=-O2 -Wall -W -fshort-double
OSXSDLCCLIBS+= `sdl-config --static-libs`
OSXSDLCCLIBS+=-lmacosport -lmacosport-gcon -D__MACOS__ -D__SDL__
macos-sdl:
$(OSXCC) $(OSXSDLCCFLAGS) main.c $(OSXSDLCCLIBS) -o portris
################################################################################
rungb: gameboy
@xgnuboy --scale=2 portris_gb.gb
runspectrum: spectrum
#runspectrum: spectrum_z88dk
@xspect -quick-load -load-immed portris_spectrum.tap
rungba: gba
@VisualBoyAdvance -T 500000 -f 0 -1 -s 9 --ifb-none portris_gba.gba 2> $(DEVNULL)
rungp32: gp32
@~/geepee32/geepee32 /EXE=portris_gp32.gxb /RUN > $(DEVNULL)