Add mdview markdown viewer, reorganize tests/examples and libc layout
- Split tests/ (libc feature tests) and examples/ (real apps); shared
app.mk in repo root, was examples/example.mk
- libc/io/* split into libc/{conio,env,errno,file,mouse,string,sys,
time,video}/ — clearer module boundaries
- New examples/mdview/: markdown viewer (Phases 1-5 + light nested
lists). Headers (H1-H4), HR, ulist/olist/quote with nesting via
leading spaces, fenced code blocks, inline emphasis (bold/italic/
underscore/code), wrap/unwrap mode with soft wrap (F2), horizontal
pan (← →) with '>' truncation indicator
- libc additions: scroll() in conio (ESTEX SCROLL), strlwr/strupr,
gets() test
- Makefile updates across tests/ for the new shared app.mk path
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,58 +1,41 @@
|
||||
# Sprinter C Compiler — top-level Makefile
|
||||
#
|
||||
# make build host tools, libc archive, and all examples
|
||||
# make build host tools, libc archive, all tests, all apps
|
||||
# make tools build only host tools (mkexe)
|
||||
# make lib build lib/sprinter.lib (libc archive used by sprinter-cc)
|
||||
# make examples build all examples
|
||||
# make floppy package every example + test files into mame/v306/IMG/mc.img
|
||||
# make tests build all libc feature tests under tests/
|
||||
# make examples build all real applications under examples/
|
||||
# make floppy package every .exe + test fixtures into mame/v306/IMG/mc.img
|
||||
# make check run mkexe unit tests
|
||||
# make clean remove all build artefacts
|
||||
# make sdcc download/extract vendored SDCC
|
||||
#
|
||||
# Most heavy lifting is delegated to sub-Makefiles.
|
||||
|
||||
EXAMPLES := hello banked bankedbg strtest cat seek malloc mem_test argv errno rt_test openenv ls conio attrprob timedir mouse banklocl stdlib assrtest ptime stattest filetest gfx_demo gfx_d16 gfx_text gfx_mous
|
||||
# Small libc-feature tests (one program per .c-language feature or libc API).
|
||||
TESTS := hello banked bankedbg strtest cat seek malloc mem_test argv errno \
|
||||
rt_test openenv ls conio attrprob timedir mouse banklocl stdlib \
|
||||
assrtest ptime stattest filetest gfx_demo gfx_d16 gfx_text gfx_mous
|
||||
|
||||
# Larger end-user applications under examples/.
|
||||
APPS := mdview
|
||||
|
||||
MAME_DIR := mame/v306
|
||||
FLOPPY_IMG := $(MAME_DIR)/IMG/mc.img
|
||||
MAKE_DISK := $(MAME_DIR)/make_disk.py
|
||||
|
||||
EXE_FILES := \
|
||||
examples/hello/hello.exe \
|
||||
examples/banked/banked.exe \
|
||||
examples/bankedbg/bankedbg.exe \
|
||||
examples/strtest/strtest.exe \
|
||||
examples/cat/cat.exe \
|
||||
examples/seek/seek.exe \
|
||||
examples/malloc/malloc.exe \
|
||||
examples/mem_test/mem_test.exe \
|
||||
examples/argv/argv.exe \
|
||||
examples/errno/errno.exe \
|
||||
examples/rt_test/rt_test.exe \
|
||||
examples/openenv/openenv.exe \
|
||||
examples/ls/ls.exe \
|
||||
examples/conio/conio.exe \
|
||||
examples/attrprob/attrprob.exe \
|
||||
examples/timedir/timedir.exe \
|
||||
examples/mouse/mouse.exe \
|
||||
examples/banklocl/banklocl.exe \
|
||||
examples/stdlib/stdlib.exe \
|
||||
examples/assrtest/assrtest.exe \
|
||||
examples/ptime/ptime.exe \
|
||||
examples/stattest/stattest.exe \
|
||||
examples/filetest/filetest.exe \
|
||||
examples/gfx_demo/gfx_demo.exe \
|
||||
examples/gfx_d16/gfx_d16.exe \
|
||||
examples/gfx_text/gfx_text.exe \
|
||||
examples/gfx_mous/gfx_mous.exe
|
||||
TEST_EXES := $(foreach t,$(TESTS),tests/$(t)/$(t).exe)
|
||||
APP_EXES := $(foreach a,$(APPS),examples/$(a)/$(a).exe)
|
||||
ALL_EXES := $(TEST_EXES) $(APP_EXES)
|
||||
|
||||
DATA_FILES := \
|
||||
examples/cat/test.txt \
|
||||
examples/seek/big.txt
|
||||
tests/cat/test.txt \
|
||||
tests/seek/big.txt \
|
||||
examples/mdview/SAMPLE.MD
|
||||
|
||||
.PHONY: all tools lib examples check clean sdcc floppy $(EXAMPLES)
|
||||
.PHONY: all tools lib tests examples check clean sdcc floppy $(TESTS) $(APPS)
|
||||
|
||||
all: tools lib examples
|
||||
all: tools lib tests examples
|
||||
|
||||
tools:
|
||||
$(MAKE) -C toolchain/mkexe
|
||||
@@ -63,18 +46,22 @@ lib:
|
||||
check: tools
|
||||
$(MAKE) -C toolchain/mkexe check
|
||||
|
||||
examples: $(EXAMPLES)
|
||||
tests: $(TESTS)
|
||||
examples: $(APPS)
|
||||
|
||||
$(EXAMPLES): tools lib
|
||||
$(TESTS): tools lib
|
||||
$(MAKE) -C tests/$@
|
||||
|
||||
$(APPS): tools lib
|
||||
$(MAKE) -C examples/$@
|
||||
|
||||
# Generate big.txt if missing (gen_bigfile.py creates 100 KB marker file).
|
||||
examples/seek/big.txt:
|
||||
cd examples/seek && python3 gen_bigfile.py big.txt 102400
|
||||
tests/seek/big.txt:
|
||||
cd tests/seek && python3 gen_bigfile.py big.txt 102400
|
||||
|
||||
# Re-pack the MAME floppy image with every built example + needed data files.
|
||||
floppy: examples examples/seek/big.txt
|
||||
python3 $(MAKE_DISK) $(FLOPPY_IMG) $(EXE_FILES) $(DATA_FILES)
|
||||
# Re-pack the MAME floppy image with every built exe + needed data files.
|
||||
floppy: tests examples tests/seek/big.txt
|
||||
python3 $(MAKE_DISK) $(FLOPPY_IMG) $(ALL_EXES) $(DATA_FILES)
|
||||
@echo
|
||||
@echo "Floppy ready: $(FLOPPY_IMG)"
|
||||
@echo "Run: cd $(MAME_DIR) && ./run_mame.sh"
|
||||
@@ -82,7 +69,8 @@ floppy: examples examples/seek/big.txt
|
||||
clean:
|
||||
$(MAKE) -C toolchain/mkexe clean
|
||||
$(MAKE) -C lib clean
|
||||
@for e in $(EXAMPLES); do $(MAKE) -C examples/$$e clean; done
|
||||
@for t in $(TESTS); do $(MAKE) -C tests/$$t clean; done
|
||||
@for a in $(APPS); do $(MAKE) -C examples/$$a clean; done
|
||||
|
||||
sdcc:
|
||||
bash third_party/setup-sdcc.sh
|
||||
|
||||
Reference in New Issue
Block a user