Skip to content

Commit c21d902

Browse files
committed
create separate cc65-fs-*.zip files
1 parent af68b4e commit c21d902

1 file changed

Lines changed: 35 additions & 4 deletions

File tree

‎Makefile‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,47 @@ cc65.wasi: copy.cc65
100100

101101
# src/Makefile honors CC/AR/USER_CFLAGS/EXE_SUFFIX overrides; LLVM ar is
102102
# required (host ar corrupts wasm object archives). Compile-time data dirs
103-
# default to /share/cc65/{include,asminc,cfg,lib,target}, so the fs zip uses
103+
# default to /share/cc65/{include,asminc,cfg,lib,target}, so the fs zips use
104104
# that layout (absolute paths resolve against the preopened WASI root).
105+
106+
# Per-platform fs packages, like the old Emscripten fs65-<platform>.js/.data
107+
# but as WASI zips named cc65-fs-<platform>.zip (IDE loads
108+
# src/worker/fs/<name>.zip and unpacks it at the WASI root). Each zip carries
109+
# the shared include/asminc plus only that platform's cfg/lib/target data; the
110+
# glob patterns are chosen so they don't bleed across platforms (e.g.
111+
# cfg/atari* would also match atari2600.cfg).
112+
CC65_PLATFORMS=none nes pce atari2600 atari8 vic20 apple2 c64
113+
114+
# The monolithic zip (every platform) - handy for tests / other tooling.
105115
$(BUILDDIR)/cc65/fsroot: cc65.wasi
106-
mkdir -p $@/share/cc65/cfg $@/share/cc65/lib $@/share/cc65/target
116+
rm -rf $@ && mkdir -p $@/share/cc65/cfg $@/share/cc65/lib $@/share/cc65/target
107117
cp -rp $(BUILDDIR)/cc65/include $(BUILDDIR)/cc65/asminc $@/share/cc65/
108118
cp -rp $(BUILDDIR)/cc65/cfg/* $@/share/cc65/cfg/
109119
cp -rp $(BUILDDIR)/cc65/lib/* $@/share/cc65/lib/
110120
cp -rpf $(BUILDDIR)/cc65/target/* $@/share/cc65/target/
111121

112-
cc65: cc65.wasi $(FSDIR)/cc65-fs.zip
122+
$(BUILDDIR)/fs65-%/fsroot: cc65.wasi
123+
rm -rf $@ && mkdir -p $@/share/cc65/cfg $@/share/cc65/lib $@/share/cc65/target
124+
cp -rp $(BUILDDIR)/cc65/include $(BUILDDIR)/cc65/asminc $@/share/cc65/
125+
cd $(BUILDDIR)/cc65 && \
126+
case $* in \
127+
nes) c="cfg/nes*"; l="lib/nes*"; t="target/nes";; \
128+
pce) c="cfg/pce*"; l="lib/pce*"; t="target/pce";; \
129+
c64) c="cfg/c64*"; l="lib/c64*"; t="target/c64";; \
130+
vic20) c="cfg/vic20*"; l="lib/vic20*"; t="target/vic20";; \
131+
apple2) c="cfg/apple2*"; l="lib/apple2*"; t="target/apple2 target/apple2enh";; \
132+
atari8) c="cfg/atari.cfg cfg/atari-*.cfg cfg/atarixl*"; l="lib/atari.lib lib/atarixl.lib"; t="target/atari target/atarixl";; \
133+
atari2600) c="cfg/atari2600*"; l="lib/atari2600*"; t="";; \
134+
none) c=""; l="lib/none.lib"; t="";; \
135+
esac; \
136+
for f in $$c; do cp -rp $$f $@/share/cc65/cfg/; done; \
137+
for f in $$l; do cp -rp $$f $@/share/cc65/lib/; done; \
138+
for f in $$t; do cp -rp $$f $@/share/cc65/target/; done
139+
140+
$(FSDIR)/cc65-fs-%.zip: $(BUILDDIR)/fs65-%/fsroot
141+
cd $< && zip -qr $(abspath $@) .
142+
143+
cc65: cc65.wasi $(FSDIR)/cc65-fs.zip $(CC65_PLATFORMS:%=$(FSDIR)/cc65-fs-%.zip)
113144
cp $(BUILDDIR)/cc65/bin/cc65.wasm $(WASMDIR)/cc65.wasm
114145
cp $(BUILDDIR)/cc65/bin/ca65.wasm $(WASMDIR)/ca65.wasm
115146
cp $(BUILDDIR)/cc65/bin/ld65.wasm $(WASMDIR)/ld65.wasm
@@ -419,7 +450,7 @@ test.nesasm: nesasm
419450
test.cc65: cc65
420451
rm -fr $(BUILDDIR)/test-cc65 && mkdir -p $(BUILDDIR)/test-cc65
421452
cp $(WASMDIR)/cc65.wasm $(WASMDIR)/ca65.wasm $(WASMDIR)/ld65.wasm tests/cc65/*.c $(BUILDDIR)/test-cc65/
422-
unzip -oq $(FSDIR)/cc65-fs.zip -d $(BUILDDIR)/test-cc65
453+
unzip -oq $(FSDIR)/cc65-fs-nes.zip -d $(BUILDDIR)/test-cc65
423454
cd $(BUILDDIR)/test-cc65 && $(WASIRUN) --dir=.::/ cc65.wasm -t nes -T -o test.s test.c
424455
cd $(BUILDDIR)/test-cc65 && $(WASIRUN) --dir=.::/ ca65.wasm -o test.o test.s
425456
cd $(BUILDDIR)/test-cc65 && $(WASIRUN) --dir=.::/ ld65.wasm -t nes -o test.nes test.o /share/cc65/lib/nes.lib

0 commit comments

Comments
 (0)