-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
407 lines (338 loc) · 13.4 KB
/
Makefile
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
ifeq (,$(wildcard Makefile.config.local))
include Makefile.config
else
include Makefile.config.local
endif
# some magic to handle windows vs linux, shamelessly stolen from olivers makefile
ifneq ($(shell echo),)
CMD_EXE = 1
endif
ifdef CMD_EXE
S = $(subst /,\,/)
NOT = - # Hack
NULLDEV = nul:
MKDIR = mkdir $(subst /,\,$1)
RMDIR = -rmdir /s /q $(subst /,\,$1)
DEL = del /f $(subst /,\,$1)
CP = copy
else
S = /
NOT = !
NULLDEV = /dev/null
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
DEL = $(RM) $1
CP = cp
endif
ifndef VERBOSE
.SILENT:
NULLOUT = >$(NULLDEV)
NULLERR = 2>$(NULLDEV)
endif
CL65=$(CC65HOME)cl65
CC65FLAGS+=-Osir
JOYDRV := $(shell $(CL65) --print-target-path)
# generic tools
DD=dd
###############################################################################
.PHONY: all clean nice targets cc65
CBMTARGETS=c64 c6480 c6480m c128 c128vdc pet plus4 cbm510 cbm610 vic c16exp geos
#vichacked vic40 gamate c16
CC65TARGETS=apple2 apple2enh atari atarixl nes pcengine atmos
CC65TARGETS+=$(CBMTARGETS) cbmloader cbmdisk geosdisk
help:
@echo available targets are:
@echo all clean cbm cc65 $(CC65TARGETS)
@echo look in the makefile for more.
all: clean targets nice
cc65targets: $(CC65TARGETS)
cc65: cc65targets
SOURCEFILES=\
blocks.c \
effects.c \
effects.h \
hiscore.c \
hiscore.h \
input.c \
input.h \
main.c \
output.c \
output.h \
portris.h \
target.h \
title.c \
title.h
###############################################################################
.PHONY: cbmloader c64 c128 c128vdc plus4 c16 vic20 cbm510 cbm610 pet atari apple2 apple2enh geos geosdic cbmdisk
cbmloader: loader.bas
@echo "cbm loader..."
$(PETCAT) -w2 -l 0401 loader.bas > loader.prg $(NULLERR)
cbm: cbmloader $(CBMTARGETS)
c64: $(SOURCEFILES)
@echo "c64..."
$(CL65) $(CC65FLAGS) -t c64 -o portris_c64.bin main.c
$(PUCRUNCH) -c64 -x2061 portris_c64.bin portris_c64.prg $(NULLOUT) $(NULLERR)
c6480: $(SOURCEFILES)
@echo "c64 + soft80..."
$(CL65) $(CC65FLAGS) -o portris_c64_80x25.bin -D__SOFT80__ main.c c64-soft80.o
$(PUCRUNCH) -c64 -x2061 portris_c64_80x25.bin portris_c64_80x25.prg $(NULLOUT) $(NULLERR)
c6480m: $(SOURCEFILES)
@echo "c64 + soft80 (mono)..."
$(CL65) $(CC65FLAGS) -o portris_c64_80x25m.bin -D__SOFT80__ main.c c64-soft80mono.o
$(PUCRUNCH) -c64 -x2061 portris_c64_80x25m.bin portris_c64_80x25m.prg $(NULLOUT) $(NULLERR)
c128: $(SOURCEFILES)
@echo "c128 ..."
$(CL65) $(CC65FLAGS) -t c128 -o portris_c128.bin main.c
$(PUCRUNCH) -c128 -x7181 portris_c128.bin portris_c128.prg $(NULLOUT) $(NULLERR)
c128vdc: $(SOURCEFILES)
@echo "c128 + vdc..."
$(CL65) $(CC65FLAGS) -o portris_c128_vdc.bin -t c128 -D__VDC__ main.c
$(PUCRUNCH) -c128 -x7181 portris_c128_vdc.bin portris_c128_vdc.prg $(NULLOUT) $(NULLERR)
plus4: $(SOURCEFILES)
@echo "plus4 ..."
$(CL65) $(CC65FLAGS) -o portris_plus4.bin -t plus4 main.c
$(PUCRUNCH) -c16 -x4109 portris_plus4.bin portris_plus4.prg $(NULLOUT) $(NULLERR)
c16: $(SOURCEFILES)
@echo "c16 ..."
$(CL65) $(CC65FLAGS) -o portris_c16.bin -t c16 main.c
$(PUCRUNCH) -c16 -x4109 portris_c16.bin portris_c16.prg $(NULLOUT) $(NULLERR)
c16exp: $(SOURCEFILES)
@echo "c16 (expanded) ..."
$(CL65) $(CC65FLAGS) -o portris_c16exp.bin -D__C16EXP__ -t c16 -C c16-32k.cfg main.c
$(PUCRUNCH) -c16 -x4109 portris_c16exp.bin portris_c16exp.prg $(NULLOUT) $(NULLERR)
# only works for expanded machines (NOT with default config for vic!)
vic: $(SOURCEFILES)
@echo "vic20 (expanded) ..."
$(CL65) $(CC65FLAGS) -o portris_vic20.bin -t vic20 -C vic20-32k.cfg main.c
$(PUCRUNCH) -c20 -x4621 portris_vic20.bin portris_vic20.prg $(NULLOUT) $(NULLERR)
# FIXME: needs not yet merged "hard26" hack
vichacked: $(SOURCEFILES)
@echo "vic20 (expanded) + hard26..."
$(CL65) $(CC65FLAGS) -o portris_vic20_26x25.bin -t vic20 \
-C $(PARCH)/vic20/vic20exp.x -D__VIC20HACKED__ main.c \
$(PLIB)/vic20hard26port.lib
$(PUCRUNCH) -c20 -x4621 portris_vic20_26x25.bin portris_vic20_26x25.prg $(NULLOUT) $(NULLERR)
# FIXME: needs not yet merged "soft40" lib
vic40: $(SOURCEFILES)
@echo "vic20 (expanded) + soft40..."
$(CL65) $(CC65FLAGS) -t vic20 -o portris_vic20_40x24.bin -D__SOFT40__ -C vic20-32k.cfg main.c vic20-soft40.o
# $(CL65) $(CC65FLAGS) -o portris_vic20_40x24.bin -t vic20 \
# -C $(PARCH)/vic20/soft40/vic20exp.x -D__SOFT40__ main.c \
# $(PLIB)/vic20soft40port.lib
@$(PUCRUNCH) -c20 -x5645 portris_vic20_40x24.bin portris_vic20_40x24.prg $(NULLOUT) $(NULLERR)
pet: $(SOURCEFILES)
@echo "pet ..."
$(CL65) $(CC65FLAGS) -o portris_pet.prg -t pet main.c
cbm510: $(SOURCEFILES)
@echo "cbm510 ..."
$(CL65) $(CC65FLAGS) -o portris_cbm510.prg -t cbm510 main.c
cbm610: $(SOURCEFILES)
@echo "cbm610 ..."
$(CL65) $(CC65FLAGS) -o portris_cbm610.prg -t cbm610 main.c
cbmdisk: $(CBMTARGETS) cbmloader
@echo "cbm disc ..."
$(C1541) -format portris,00 d64 portris.d64 \
-write loader.prg portris \
-write portris_c64.prg portris-c64 \
-write portris_c64_80x25.prg portris-c64-80 \
-write portris_c64_80x25m.prg portris-c64-80m \
-write portris_c128.prg portris-c128 \
-write portris_c128_vdc.prg portris-c128vdc \
-write portris_vic20.prg portris-vic20 \
-write portris_c16exp.prg portris-c16exp \
-write portris_plus4.prg portris-plus4 \
-write portris_pet.prg portris-pet \
-write portris_cbm510.prg portris-cbm510 \
-write portris_cbm610.prg portris-cbm610 \
-write $(JOYDRV)/c16/drv/joy/c16-stdjoy.joy c16-stdjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-stdjoy.joy c64-stdjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-ptvjoy.joy c64-ptvjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-hitjoy.joy c64-hitjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-numpad.joy c64-numpad.joy \
-write $(JOYDRV)/c128/drv/joy/c128-stdjoy.joy c128-stdjoy.joy \
-write $(JOYDRV)/c128/drv/joy/c128-ptvjoy.joy c128-ptvjoy.joy \
-write $(JOYDRV)/cbm510/drv/joy/cbm510-std.joy cbm510-std.joy \
-write $(JOYDRV)/pet/drv/joy/pet-stdjoy.joy pet-stdjoy.joy \
-write $(JOYDRV)/plus4/drv/joy/plus4-stdjoy.joy plus4-stdjoy.joy \
-write $(JOYDRV)/vic20/drv/joy/vic20-stdjoy.joy vic20-stdjoy.joy \
-write $(JOYDRV)/vic20/drv/joy/vic20-ptvjoy.joy vic20-ptvjoy.joy \
-list $(NULLOUT)
portris_geos.cvt: $(SOURCEFILES) portrisres.grc
@echo "geos ..."
$(CL65) $(CL65FLAGS) -t geos -o portris_geos.cvt portrisres.grc main.c
geos: portris_geos.cvt
geosdisk: geos
@echo "geosdisk ..."
$(CP) geos-template.d64 geos.d64
$(C1541) -attach geos.d64 -geoswrite portris_geos.cvt
apple2: $(SOURCEFILES)
@echo "apple2 ..."
# smaller programs
# $(CL65) $(CL65FLAGS) -o portris_apple2.sys -t apple2 -C apple2-system.cfg main.c
# $(CP) ProDOS_2_4_2.dsk portris_apple2.dsk
# java -jar $(AC) -as portris_apple2.dsk portris.system sys < portris_apple2.sys
# larger programs
$(CL65) $(CL65FLAGS) -o portris_apple2.bin -t apple2 main.c
$(CP) ProDOS_2_4_2.dsk portris_apple2.dsk
java -jar $(AC) -p portris_apple2.dsk portris.system sys < $(shell cl65 --print-target-path)/apple2/util/loader.system
java -jar $(AC) -as portris_apple2.dsk portris bin < portris_apple2.bin
java -jar $(AC) -p portris_apple2.dsk a2.stdjoy.joy rel < $(shell cl65 --print-target-path)/apple2/drv/joy/a2.stdjoy.joy
apple2enh: $(SOURCEFILES)
@echo "apple2enh ..."
# smaller programs
# $(CL65) $(CL65FLAGS) -o portris_apple2enh.sys -t apple2enh -C apple2-system.cfg main.c
# $(CP) ProDOS_2_4_2.dsk portris_apple2enh.dsk
# java -jar $(AC) -as portris_apple2enh.dsk portris.system sys < portris_apple2enh.sys
# larger programs
$(CL65) $(CL65FLAGS) -o portris_apple2enh.bin -t apple2enh main.c
$(CP) ProDOS_2_4_2.dsk portris_apple2enh.dsk
java -jar $(AC) -p portris_apple2enh.dsk portris.system sys < $(shell cl65 --print-target-path)/apple2enh/util/loader.system
java -jar $(AC) -as portris_apple2enh.dsk portris bin < portris_apple2enh.bin
java -jar $(AC) -p portris_apple2enh.dsk a2e.stdjoy.joy rel < $(shell cl65 --print-target-path)/apple2enh/drv/joy/a2e.stdjoy.joy
atari: $(SOURCEFILES)
@echo "atari800 ..."
$(CL65) $(CL65FLAGS) -o portris_atari.xex -t atari main.c
$(MKDIR) atr
$(CP) mydos-dos.sys atr/dos.sys
$(CP) mydos-dup.sys atr/dup.sys
$(CP) portris_atari.xex atr/portris.ar0
$(CP) $(JOYDRV)/atari/drv/joy/*.joy atr/
$(DIR2ATR) -m -b MyDos4534 portris_atari.atr atr $(NULLOUT) $(NULLERR)
$(RMDIR) atr
atarixl: $(SOURCEFILES)
@echo "atari800xl ..."
$(CL65) $(CL65FLAGS) -o portris_atarixl.xex -t atarixl main.c
$(MKDIR) atr
$(CP) mydos-dos.sys atr/dos.sys
$(CP) mydos-dup.sys atr/dup.sys
$(CP) portris_atarixl.xex atr/portris.ar0
$(CP) $(JOYDRV)/atarixl/drv/joy/*.joy atr/
$(DIR2ATR) -m -b MyDos4534 portris_atarixl.atr atr $(NULLOUT) $(NULLERR)
$(RMDIR) atr
.PHONY: nes osa65 atmos pcengine gamate
nes: $(SOURCEFILES)
@echo "nes ..."
$(CL65) $(CC65FLAGS) -o portris_nes.nes -t nes main.c
pcengine: $(SOURCEFILES)
@echo "pcengine ..."
# $(JOYDRV)/pce/drv/joy/pce-stdjoy.joy
$(CL65) $(CC65FLAGS) -Wl -D__CARTSIZE__=0x8000 -o portris_pcengine.bin -t pce main.c
# the first 8k block must be the last 8k block in the cartridge image
$(DD) if=portris_pcengine.bin bs=8K skip=3 > portris_pcengine.pce $(NULLERR)
$(DD) if=portris_pcengine.bin bs=8K count=3 >> portris_pcengine.pce $(NULLERR)
pce: pcengine
atmos: $(SOURCEFILES)
@echo "atmos ..."
$(CL65) $(CL65FLAGS) -o portris_atmos.tap -t atmos main.c
# -oric.header atmos.prg portris_atmos.tap --quiet-autostart
# FIXME: file too large
gamate: $(SOURCEFILES)
@echo "gamate ..."
$(CL65) -Osir -t gamate -o portris_gamate.bin main.c
$(GFIX) portris_gamate.bin
# dont compile (yet?!) due to missing library-support
osa65: $(SOURCEFILES)
@echo "osa65 ..."
$(CL65) $(CCFLAGS) -o portris_osa65.prg -t none -C osa65.x -D__OSA65__ main.c
lunix: $(SOURCEFILES)
@echo "lunix ..."
$(CL65) $(CCFLAGS) -o portris_lunix.prg -t lunix main.c
#########################################################################################
# cleanup
#########################################################################################
.PHONY: clean
clean:
$(DEL) loader.prg
$(DEL) portris*.prg
$(DEL) portris*.cvt
$(DEL) portris*.xex
$(DEL) portris*.bin
$(DEL) portris*.nes
$(DEL) portris*.pce
$(DEL) portris*.sav
$(DEL) portris*.mem
$(DEL) portris*.rst
$(DEL) portris*.ihx
$(DEL) portris*.sys
$(DEL) portris*.lnk
$(DEL) portris*.elf
$(DEL) portris*.gxb
$(DEL) portris*.tap
$(DEL) portris*.atr
$(DEL) portris*.d64
$(DEL) portris*.dsk
$(DEL) *.o
$(DEL) *.lst
$(DEL) *.map
#########################################################################################
# some stuff for lazy peeps like me :o)
#########################################################################################
runc64: c64
$(C1541) -format portris,00 d64 portris.d64 -write portris_c64.prg portris-c64 \
-write $(JOYDRV)/c64/drv/joy/c64-stdjoy.joy c64-stdjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-ptvjoy.joy c64-ptvjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-hitjoy.joy c64-hitjoy.joy \
-write $(JOYDRV)/c64/drv/joy/c64-numpad.joy c64-numpad.joy \
$(NULLOUT)
$(X64SC) --autostart portris.d64
# $(X64SC) --autostart portris_c64.prg
# $(X64SC) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runc6480: c6480
# $(X64SC) --autostart portris_c64_80x25.prg
$(X64SC) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
rungeos: geos geosdisk
$(X64SC) -joydev1 1 -joydev2 0 --autostart geos.d64
runc128: c128
# $(X128) --autostart portris_c128.prg > $(DEVNULL)
$(X128) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runc128vdc: c128vdc
# $(X128) -8 portris.d64 --autostart portris_c128_vdc.prg > $(DEVNULL)
$(X128) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runpet: pet
# $(XPET) --autostart portris_pet.prg
# $(XPET) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
$(XPET) +truedrive -virtualdev --autostart portris.d64
runvic20: vic
# $(XVIC) --autostart portris_vic20.prg > $(DEVNULL)
$(C1541) -format portris,00 d64 portris.d64 -write portris_vic20.prg portris-vic20
$(XVIC) -memory all -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runvichacked: vichacked
# $(XVIC) --autostart portris_vic20_26x25.prg
$(XVIC) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runvic40: vic40
# $(XVIC) --autostart portris_vic20_40x24.prg
$(XVIC) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runc16: c16
# $(XPLUS4) --autostart portris_c16.prg
$(XPLUS4) -model c232 -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runplus4: plus4
# $(XPLUS4) --autostart portris_plus4.prg
$(XPLUS4) -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runcbm510: cbm510
# $(XCBM5) --autostart portris_cbm510.prg
$(XCBM5) +truedrive -virtualdev -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runcbm610: cbm610
# $(XCBM6) --autostart portris_cbm610.prg
$(XCBM6) +truedrive -virtualdev -8 portris.d64 -keybuf \\x4c\\xcf\\x22\\x2a\\x22\\x2c\\x38\\x3a\\x83
runatari: atari
$(ATARI8EMU) portris_atari.xex
# $(ATARI8EMU) portris_atari.atr
# KLUDGES: the damn thing messes with key repeat :/
-@xset r on
runatarixl: atarixl
$(ATARI8XLEMU) portris_atarixl.xex
# $(ATARI8XLEMU) portris_atarixl.atr
# KLUDGES: the damn thing messes with key repeat :/
-@xset r on
runnes: nes
$(NESEMU) portris_nes.nes
# FIXME
runatmos: atmos
# xeuphoric -z 2; xset r on;rm printer.out
CWD=`pwd`; cd ~/Desktop/oricutron-master/ && ./oricutron -m atmos -t $$CWD/portris_atmos.tap
runpce: pcengine
$(PCEEMU) portris_pcengine.pce
runapple2: apple2
$(APPLE2EMU) portris_apple2.dsk
runapple2enh: apple2enh
$(APPLE2EMU) portris_apple2enh.dsk