Files
Sprinter-SDCC/Makefile
T
Александр Петров 3d8b81c9f6 build: examples вне регрессной сборки; эталон размеров пересобран
`make all` собирал и examples/, из-за чего цикл «правка libc -> проверка»
упирался в mdview (компилируется минутами) и ничего нового про libc не
показывал.  Регресс ловит разжирение библиотеки, а для этого хватает
мелких tests/ — каждый тянет свой кусок libc и пересобирается за секунды.

- `make all` = tools lib tests; examples собираются явно (`make examples`,
  и как зависимость `make floppy`);
- size_check.py смотрит только tests/*.

Эталон принят заново.  Разбор расхождения, чтобы оно не выглядело
необъяснённым: эталон стоял с 30 июля (0280b05), а libc менялась 1 и 3
августа (b56f2b4 kbd_raw_poll, 1f16e8f fake shift) — _irq_tramp вырос
267 -> 336 Б и не был перебазирован, отсюда +33 Б у всех, кто линкует
трамплин (cbl*, irqtest, rt_test), и +22 у gfx_dbuf (gfx_set_idle_hook в
libbgi из того же KBD-1).  Текущий фикс BUG-KBD-5 вернул 36 Б из этих 69.
Заодно выкинуты мёртвые строки эталона (rpgprof/rpgwalk/scroll/space —
их давно нет в APPS, mdview/mdview2 — теперь вне регресса).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 12:33:34 +03:00

105 lines
4.0 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Sprinter C Compiler — top-level Makefile
#
# make build host tools, libc archive, all tests
# make tools build only host tools (mkexe)
# make lib build lib/sprinter.lib (libc) + lib/bgi256.lib (libbgi)
# make tests build all libc feature tests under tests/
# make examples build all real applications under examples/ (НЕ входит
# в `make all`: это регрессная сборка, а examples/ —
# крупные приложения, которые её только замедляют
# (mdview компилируется минутами) и ничего нового про
# libc не показывают. Собирать явно перед `make floppy`.)
# 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.
# Small libc-feature tests (one program per .c-language feature or libc API).
TESTS := hello hello2 simple banked bankedbg banktest strtest cat seek \
malloc mem_test argv errno rt_test openenv ls conio conio2 \
attrprob timedir mouse banklocl stdlib assrtest ptime stattest \
filetest fdmax fbench solidt irqtest cbltest cblwav cblstream dec_test gets stest2 winrest \
bios_text text_palette \
gfx_demo gfx_dbuf bgitest bgi_img accfill
# gfx_d16 / gfx_text / gfx_mous — 16-цветные; убраны до Фазы 2 (bgi16.lib
# ещё не собирается). Вернуть мигрированными на BGI --gfx 16.
# Larger end-user applications under examples/.
APPS := mdview mdview2
MAME_DIR := mame/v306
FLOPPY_IMG := $(MAME_DIR)/IMG/mc.img
MAKE_DISK := $(MAME_DIR)/make_disk.py
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 := \
tests/cat/test.txt \
tests/seek/big.txt \
tests/cblwav/speech.pcm \
examples/mdview/SAMPLE.MD
.PHONY: all tools lib tests examples check clean sdcc floppy \
size-check size-baseline host-tests $(TESTS) $(APPS)
all: tools lib tests
tools:
$(MAKE) -C toolchain/mkexe
lib:
$(MAKE) -C libc
$(MAKE) -C libbgi
check: tools
$(MAKE) -C toolchain/mkexe check
tests: $(TESTS)
examples: $(APPS)
$(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).
tests/seek/big.txt:
cd tests/seek && python3 gen_bigfile.py big.txt 102400
# 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"
# Модульные тесты под ucsim_z80. Обвязка — testkit/, сами наборы лежат
# рядом с кодом, который проверяют. MAME не нужна, идут за секунды;
# ucsim идёт в комплекте нашего SDCC.
HOST_TEST_DIRS := testkit applications/PoP/roomtest/tests-host
host-tests:
@for d in $(HOST_TEST_DIRS); do $(MAKE) -C $$d || exit 1; done
# Размерный регресс: сверить _CODE всех программ с docs/size_baseline.tsv.
size-check:
python3 toolchain/size_check.py
# Принять текущие размеры как эталон (после осознанных изменений).
size-baseline:
python3 toolchain/size_check.py --update
clean:
$(MAKE) -C toolchain/mkexe clean
$(MAKE) -C libc clean
$(MAKE) -C libbgi clean
@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