-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (74 loc) · 2.28 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
# Makefile for Chase H.Q. disassembly
#
NAME="Chase H.Q."
GAME=ChaseHQ
BUILD?=build
OPTIONS=--hex
CTL=$(GAME).ctl
ASM=$(BUILD)/$(GAME).asm
BIN=$(BUILD)/$(GAME).bin
PRISTINEZ80=$(BUILD)/$(GAME).pristine.z80
SKOOL=$(GAME).skool
REF=$(GAME).ref
TAP=$(BUILD)/$(GAME).tap
Z80=$(BUILD)/$(GAME).z80
GENERATED_CTL=$(BUILD)/$(GAME).ctl
.PHONY: usage
usage:
@echo "Supported targets:"
@echo " usage Show this help"
@echo " all Build virtually everything"
@echo " pristine Fetch a tape image of $(NAME) and convert it into a pristine Z80 snapshot"
@echo " skool Build a skool file from the control file and the snapshot"
@echo " disasm Build the $(NAME) disassembly"
@echo " asm Build assembly sources from the skool file"
@echo " z80 Build a Z80 snapshot from the skool file"
@echo " tap Build a TAP file from the skool file"
@echo " ctl Build a new control file from the skool file"
@echo " commit Rebuild the main control file from the skool file"
@echo " clean Clean a previous build"
@echo ""
@echo "Environment variables:"
@echo " BUILD directory in which to build the disassemblies (default: build)"
# .PHONY rules are always run.
.PHONY: all
all: pristine skool disasm asm z80 tap
.PHONY: pristine
pristine: $(PRISTINEZ80)
$(PRISTINEZ80):
tap2sna.py --output-dir $(BUILD) @$(GAME).t2s && mv $(BUILD)/$(GAME).z80 $(PRISTINEZ80)
.PHONY: skool
skool: $(SKOOL)
$(SKOOL): $(PRISTINEZ80) $(CTL)
mkdir -p $(BUILD)
sna2skool.py $(OPTIONS) --ctl $(CTL) $(PRISTINEZ80) > $@
.PHONY: disasm
disasm: $(SKOOL)
skool2html.py $(OPTIONS) --asm-labels --rebuild-images --output-dir $(BUILD) $(SKOOL) $(REF)
.PHONY: asm
asm: $(ASM)
$(ASM): $(SKOOL)
mkdir -p $(BUILD)
skool2asm.py $(OPTIONS) --create-labels --no-warnings --ssub $< > $@
.PHONY: z80
z80: $(Z80)
$(Z80): $(SKOOL)
skool2bin.py $< - | bin2sna.py --org 16384 --stack 23550 --start 23372 - $@
.PHONY: tap
tap: $(TAP)
$(TAP): $(SKOOL)
skool2bin.py $< - | bin2tap.py --org 16384 --stack 23550 --start 23372 - $@
.PHONY: ctl
ctl: $(GENERATED_CTL)
$(GENERATED_CTL): $(SKOOL)
mkdir -p $(BUILD)
skool2ctl.py $(OPTIONS) $(SKOOL) > $@
# Brings changes from .skool back to .ctl
# Use when ready for commit
.PHONY: commit
commit: ctl
cp $(GENERATED_CTL) $(BUILD)/../
.PHONY: clean
clean:
@echo 'Cleaning...'
-rm -rf $(BUILD)