-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
172 lines (137 loc) · 4.71 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
export PATH := /opt/psn00bsdk/bin:$(PATH)
export PSN00BSDK_LIBS := /opt/psn00bsdk/lib/libpsn00b
MAP16SRC := $(shell ls ./assets/levels/**/map16.json)
COL16SRC := $(shell ls ./assets/levels/**/tiles16.tsx)
MAP128SRC := $(shell ls ./assets/levels/**/tilemap128.tmx)
LVLSRC := $(shell ls ./assets/levels/**/Z*.tmx)
MDLSRC := $(shell ls ./assets/models/**/*.rsd)
PRLSRC := $(shell ls ./assets/levels/**/parallax.toml)
MAP16OUT := $(addsuffix MAP16.MAP,$(dir $(MAP16SRC)))
COL16OUT := $(addsuffix MAP16.COL,$(dir $(COL16SRC)))
MAP128OUT := $(addsuffix MAP128.MAP,$(dir $(COL16SRC)))
LVLOUT := $(addsuffix .LVL,$(basename $(LVLSRC)))
OMPOUT := $(addsuffix .OMP,$(basename $(LVLSRC)))
MDLOUT := $(addsuffix .mdl,$(basename $(MDLSRC)))
PRLOUT := $(addsuffix PRL.PRL,$(dir $(PRLSRC)))
.PHONY: clean ./build/engine.cue run configure chd cook iso elf debug cooktest purge rebuild repack packrun
# Final product is CUE+BIN files
all: iso
# Targets for producing ELF, CUE+BIN and CHD files
elf: ./build/engine.elf
iso: ./build/engine.cue
chd: engine.chd
# Target for running the image
run: ./build/engine.cue
pcsx-redux-appimage \
-run -interpreter -fastboot -stdout \
-iso $<
# Target for running the image on Mednafen
run-mednafen: ./build/engine.cue
mednafen $<
# Target for running the image on PCSX-ReARMed
run-rearmed: ./build/engine.cue
pcsx -cdfile $<
# Run debugger
debug:
gdb-multiarch
# Build on release target
release: purge cook
cmake --preset release .
cd build && make iso
tochd -d . -- ./build/engine.cue
# =======================================
# Targets for executable building
# =======================================
# Target directory
./build: configure
# ELF PSX executable
./build/engine.elf: ./build
cd build && make engine
# .CUE + .BIN (needs ELF and cooked assets)
./build/engine.cue: cook ./build/engine.elf
cd build && make iso
# .CHD file (single-file CD image)
engine.chd: ./build/engine.cue
tochd -d . -- $<
# =======================================
# Utilitary targets
# =======================================
# Create build directory and generate CMake config from preset
configure:
# cmake --preset default .
cmake --preset release .
# Clean build directory
clean:
rm -rf ./build
# Clean build directory and purge cooked assets
purge: clean cleancook
rm -rf *.chd
# Clean everything and recreate iso
rebuild: purge cook elf iso
# Clean binaries and recreate iso
repack: clean cook elf iso
# Repack and run
packrun: repack run
# =======================================
# ASSET COOKING TARGETS
# =======================================
mdls: $(MDLOUT)
map16: $(MAP16OUT) $(COL16OUT)
map128: $(MAP128OUT)
lvl: $(LVLOUT)
prl: $(PRLOUT)
objs: $(OMPOUT)
cook: mdls map16 map128 lvl objs prl
cleancook:
rm -rf assets/models/**/*.mdl \
assets/levels/**/*.COL \
assets/levels/**/*.MAP \
assets/levels/**/*.LVL \
assets/levels/**/*.OMP \
assets/levels/**/*.OTD \
assets/levels/**/*.PRL \
assets/levels/**/collision16.json \
assets/levels/**/tilemap128.csv \
assets/levels/**/tilemap128_solid.csv \
assets/levels/**/tilemap128_oneway.csv \
assets/levels/**/tilemap128_front.csv
# Object models
%.mdl: %.rsd %.ply %.mat
./tools/convrsd/convrsd.py $<
# 16x16 tile mapping
# (Depends on mapping generated on Aseprite)
%/MAP16.MAP: %/map16.json
./tools/framepacker.py --tilemap $< $@
# 16x16 collision
# (Depends on tiles16.tsx tile map with collision data, generated on Tiled).
%/MAP16.COL: %/tiles16.tsx
tiled --export-tileset $< "$(dir $<)collision16.json"
./tools/cookcollision.py "$(dir $<)collision16.json" $@
rm "$(dir $@)collision16.json"
# 128x128 tile mapping
# Also generates 128.png to create a 128x128 tileset (should be done manually)
# (Depends on tilemap128.tmx map generated on Tiled)
%/MAP128.MAP: %/tilemap128.tmx
tiled --export-map $< "$(basename $<).psxcsv"
tmxrasterizer $< "$(dir $<)128.png"
./tools/chunkgen.py "$(basename $<).psxcsv" $@
rm -f "$(basename $<).psxcsv"
rm -f "$(basename $<)_solid.psxcsv"
rm -f "$(basename $<)_oneway.psxcsv"
rm -f "$(basename $<)_none.psxcsv"
rm -f "$(basename $<)_front.psxcsv"
# Level maps
# These maps should use a tileset generated from "128.png".
# (Depends on files such as Z1.tmx, Z2.tmx, etc., generated on Tiled)
%.LVL: %.tmx
tiled --export-map $< "$(basename $@).psxlvl"
./tools/cooklvl.py "$(basename $@).psxlvl" $@
rm "$(basename $@).psxlvl"
# Object level placement
# (Depends on files such as Z1.tmx, Z2.tmx, etc., generated on Tiled)
%.OMP: %.tmx
./tools/cookobj/cookobj.py $<
# Level parallax data
# (Depends on a specific file named parallax.toml within level directory)
%/PRL.PRL: %/parallax.toml
./tools/buildprl/buildprl.py $<