Merge pull request #814 from davidgiven/build

Update ab.
This commit is contained in:
David Given
2025-07-28 13:36:21 +02:00
committed by GitHub
8 changed files with 32 additions and 13 deletions

View File

@@ -34,7 +34,6 @@ else
else
LDFLAGS += -pthread -Wl,--no-as-needed
endif
endif
HOSTCC = gcc
@@ -85,7 +84,7 @@ binaries: all
tests: all
README.md: $(OBJ)/scripts/+mkdocindex/mkdocindex$(EXT)
@echo $(PROGRESSINFO) MKDOC $@
@echo $(PROGRESSINFO)MKDOC $@
@csplit -s -f$(OBJ)/README. README.md '/<!-- FORMATSSTART -->/' '%<!-- FORMATSEND -->%'
@(cat $(OBJ)/README.00 && $< && cat $(OBJ)/README.01) > README.md

View File

@@ -125,6 +125,7 @@ choices because they can store multiple types of file system.
| [`hplif`](doc/disk-hplif.md) | Hewlett-Packard LIF: a variety of disk formats used by HP | 🦄 | 🦄 | LIF |
| [`ibm`](doc/disk-ibm.md) | IBM PC: Generic PC 3.5"/5.25" disks | 🦄 | 🦄 | FATFS |
| [`icl30`](doc/disk-icl30.md) | ICL Model 30: CP/M; 263kB 35-track DSSD | 🦖 | | CPMFS |
| [`juku`](doc/disk-juku.md) | Juku E5104: CP/M | | | CPMFS |
| [`mac`](doc/disk-mac.md) | Macintosh: 400kB/800kB 3.5" GCR | 🦄 | 🦄 | MACHFS |
| [`micropolis`](doc/disk-micropolis.md) | Micropolis: 100tpi MetaFloppy disks | 🦄 | 🦄 | |
| [`ms2000`](doc/disk-ms2000.md) | : MS2000 Microdisk Development System | | | MICRODOS |

View File

@@ -7,6 +7,11 @@ from glob import glob
import config
import re
# Hack for building on Fedora/WSL; executables get the .exe extension,
# build the build system detects it as Linux.
import build.toolchain
toolchain.Toolchain.EXE = "$(EXT)"
package(name="protobuf_lib", package="protobuf")
package(name="z_lib", package="zlib")
package(name="fmt_lib", package="fmt", fallback="dep/fmt")

View File

@@ -26,7 +26,7 @@ def main():
print("link", sf)
os.makedirs(dirname(sf), exist_ok=True)
try:
os.link(abspath(f), sf)
os.symlink(abspath(f), sf)
except PermissionError:
shutil.copy(f, sf)
@@ -38,6 +38,11 @@ def main():
df = dirname(f)
if df:
os.makedirs(df, exist_ok=True)
try:
os.remove(f)
except FileNotFoundError:
pass
os.rename(sf, f)

View File

@@ -501,15 +501,17 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
emit(f"OUTS_{outsn}", "=", *fouts, into=lines)
emit(f"INS_{insn}", "=", *fins, into=lines)
emit(name, ":", f"$(OUTS_{outsn})", into=lines)
emit(hashfile, ":", into=lines)
emit(f"\t@mkdir -p {self.dir}", into=lines)
emit(f"\t@touch {hashfile}", into=lines)
emit(
name,
":",
hashfile,
f"$(OUTS_{outsn})",
"&:" if len(fouts) > 1 else ":",
f"$(INS_{insn})",
hashfile,
into=lines,
)
emit(f"$(OUTS_{outsn})", ":", hashfile, into=lines)
emit(hashfile, ":", f"$(INS_{insn})", into=lines)
if label:
emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines)
@@ -537,9 +539,6 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
emit(name, ":", *fins, into=lines)
outputFp.write("".join(lines))
if outs:
emit(f"\t$(hide) touch {hashfile}")
emit("")

View File

@@ -444,7 +444,7 @@ def programimpl(
simplerule(
replaces=self,
ins=cfiles + libs,
outs=[f"={self.localname}$(EXT)"],
outs=[f"={self.localname}{toolchain.EXE}"],
deps=deps,
label=label,
commands=commands,

View File

@@ -1,5 +1,10 @@
import platform
_is_windows = (platform.system() == "Windows")
class Toolchain:
PREFIX = ""
EXE = ".exe" if _is_windows else ""
class HostToolchain(Toolchain):

View File

@@ -30,7 +30,12 @@ def protoencode_single(self, name, srcs: Targets, proto, symbol):
ins=srcs,
outs=[f"={name}.cc"],
deps=[r],
commands=["$[deps[0]] $[ins] $[outs] " + symbol],
commands=[
# Materialise symbolic links (for Windows).
"cp -L $[ins[0]] $[ins[0]].real",
"mv $[ins[0]].real $[ins[0]]",
"$[deps[0]] $[ins] $[outs] " + symbol
],
label="PROTOENCODE",
)