Skip to content

Commit

Permalink
Build lots more stuff, including libcuss programs. Fix some commit bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Sep 8, 2024
1 parent 149b6a7 commit 3adec94
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.obj
.vscode
__pycache__
.*\.orig

16 changes: 8 additions & 8 deletions arch/brother/pn8510/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@
bootfile=".+bootfile_img",
map={
"-readme.txt": ".+readme",
#"dump.com": "cpmtools+dump",
#"stat.com": "cpmtools+stat",
#"asm.com": "cpmtools+asm",
#"copy.com": "cpmtools+copy",
#"submit.com": "cpmtools+submit",
"dump.com": "cpmtools+dump",
"stat.com": "cpmtools+stat",
"asm.com": "cpmtools+asm",
"copy.com": "cpmtools+copy",
"submit.com": "cpmtools+submit",
#"asm80.com": "third_party/dr/asm80",
#"camel80.com": "third_party/camelforth",
#"bbcbasic.com": "third_party/bbcbasic+bbcbasic_ADM3A",
#"mkfs.com": "cpmtools+mkfs",
#"rawdisk.com": "cpmtools+rawdisk",
#"qe.com": "cpmtools+qe_BROTHER_POWERNOTE",
"mkfs.com": "cpmtools+mkfs",
"rawdisk.com": "cpmtools+rawdisk",
"qe.com": "cpmtools+qe_BROTHER_POWERNOTE",
#"z8e.com": "third_party/z8e+z8e_POWERNOTE",
#"ted.com": "third_party/ted+ted_POWERNOTE",
},
Expand Down
54 changes: 54 additions & 0 deletions build/ab.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ifeq ($(findstring 4.,$(MAKE_VERSION)),)
$(error You need GNU Make 4.x for this (if you're on OSX, use gmake).)
endif

OBJ ?= .obj
PYTHON ?= python3
CC ?= gcc
CXX ?= g++
AR ?= ar
CFLAGS ?= -g -Og
LDFLAGS ?= -g
PKG_CONFIG ?= pkg-config
ECHO ?= echo
TARGETS ?= +all

ifdef VERBOSE
hide =
else
ifdef V
hide =
else
hide = @
endif
endif

ifeq ($(OS), Windows_NT)
EXT ?= .exe
endif
EXT ?=

include $(OBJ)/build.mk

MAKEFLAGS += -r
.DELETE_ON_ERROR:

.PHONY: update-ab
update-ab:
@echo "Press RETURN to update ab from the repository, or CTRL+C to cancel." \
&& read a \
&& (curl -L https://github.com/davidgiven/ab/releases/download/dev/distribution.tar.xz | tar xvJf -) \
&& echo "Done."

.PHONY: clean
clean::
@echo CLEAN
$(hide) rm -rf $(OBJ)

export PYTHONHASHSEED = 1
build-files = $(shell find . -name 'build.py') $(wildcard build/*.py) $(wildcard config.py)
$(OBJ)/build.mk: Makefile $(build-files)
@echo "AB"
@mkdir -p $(OBJ)
$(hide) $(PYTHON) -X pycache_prefix=$(OBJ) build/ab.py -o $@ build.py \
|| rm -f $@
28 changes: 21 additions & 7 deletions build/ack.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
from build.c import cprogram
from build.ab import emit
from build.c import cprogram, clibrary

emit(
"""
ACKCC ?= ack
ACKAAL ?= aal
"""
)


class AckToolchain:
label = "ACK"
cfile = ["$(CC) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"]
cxxfile = ["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"]
clibrary = ["$(AR) cqs {outs[0]} {ins}"]
cxxlibrary = ["$(AR) cqs {outs[0]} {ins}"]
cprogram = ["$(CC) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"]
cxxprogram = ["$(CXX) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"]
cfile = ["$(ACKCC) -mcpm -c -o {outs[0]} {ins[0]} $(ACKCFLAGS) {cflags}"]
cxxfile = (["false"],)
clibrary = ["$(ACKAAL) cq {outs[0]} {ins}"]
cxxlibrary = (["false"],)
cprogram = ["$(ACKCC) -mcpm -.c -o {outs[0]} {ins} {ldflags} $(ACKLDFLAGS)"]
cxxprogram = (["false"],)


def acklibrary(**kwargs):
return clibrary(**kwargs, toolchain=AckToolchain)


def ackprogram(**kwargs):
return cprogram(**kwargs, toolchain=AckToolchain)
31 changes: 31 additions & 0 deletions cpmtools/libcuss/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from build.ack import acklibrary, ackprogram
from glob import glob

libcuss_terminals = [
"KAYPROII",
"NC200",
"BROTHEROP2",
"BROTHER_WP1",
"BROTHER_WP2450DS",
"BROTHER_POWERNOTE",
"SPECTRUM_PLUS_THREE",
"SPECTRUM_NEXT",
]

for terminal in libcuss_terminals:
acklibrary(
name="libcuss_" + terminal,
cflags=["-DLIBCUSS_" + terminal],
srcs=glob("cpmtools/libcuss/*.c"),
hdrs={"libcuss.h": "./libcuss.h"},
)


def libcuss_ackprogram(name, deps=[], cflags=[], **kwargs):
for terminal in libcuss_terminals:
ackprogram(
name=name + "_" + terminal,
deps=deps + ["cpmtools/libcuss+libcuss_" + terminal],
cflags=["-DLIBCUSS_"+terminal] + cflags,
**kwargs
)
1 change: 1 addition & 0 deletions third_party/ld80/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def ld80(self, name, address=0x0100, objs: ListOfTargetsMap = {}):
+ (" ".join(args)),
f"tail -c+{address+1} {{outs[0]}}.all > {{outs[0]}}",
],
label="LD80",
)


Expand Down

0 comments on commit 3adec94

Please sign in to comment.