Skip to content

Commit 7db49ae

Browse files
authored
Merge pull request #814 from davidgiven/build
Update ab.
2 parents dfff5d7 + b5eaec0 commit 7db49ae

File tree

8 files changed

+32
-13
lines changed

8 files changed

+32
-13
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ else
3434
else
3535
LDFLAGS += -pthread -Wl,--no-as-needed
3636
endif
37-
3837
endif
3938

4039
HOSTCC = gcc
@@ -85,7 +84,7 @@ binaries: all
8584
tests: all
8685

8786
README.md: $(OBJ)/scripts/+mkdocindex/mkdocindex$(EXT)
88-
@echo $(PROGRESSINFO) MKDOC $@
87+
@echo $(PROGRESSINFO)MKDOC $@
8988
@csplit -s -f$(OBJ)/README. README.md '/<!-- FORMATSSTART -->/' '%<!-- FORMATSEND -->%'
9089
@(cat $(OBJ)/README.00 && $< && cat $(OBJ)/README.01) > README.md
9190

README.md

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

build.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import config
88
import re
99

10+
# Hack for building on Fedora/WSL; executables get the .exe extension,
11+
# build the build system detects it as Linux.
12+
import build.toolchain
13+
toolchain.Toolchain.EXE = "$(EXT)"
14+
1015
package(name="protobuf_lib", package="protobuf")
1116
package(name="z_lib", package="zlib")
1217
package(name="fmt_lib", package="fmt", fallback="dep/fmt")

build/_sandbox.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def main():
2626
print("link", sf)
2727
os.makedirs(dirname(sf), exist_ok=True)
2828
try:
29-
os.link(abspath(f), sf)
29+
os.symlink(abspath(f), sf)
3030
except PermissionError:
3131
shutil.copy(f, sf)
3232

@@ -38,6 +38,11 @@ def main():
3838
df = dirname(f)
3939
if df:
4040
os.makedirs(df, exist_ok=True)
41+
42+
try:
43+
os.remove(f)
44+
except FileNotFoundError:
45+
pass
4146
os.rename(sf, f)
4247

4348

build/ab.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,17 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
501501

502502
emit(f"OUTS_{outsn}", "=", *fouts, into=lines)
503503
emit(f"INS_{insn}", "=", *fins, into=lines)
504+
emit(name, ":", f"$(OUTS_{outsn})", into=lines)
505+
emit(hashfile, ":", into=lines)
506+
emit(f"\t@mkdir -p {self.dir}", into=lines)
507+
emit(f"\t@touch {hashfile}", into=lines)
504508
emit(
505-
name,
506-
":",
507-
hashfile,
508509
f"$(OUTS_{outsn})",
510+
"&:" if len(fouts) > 1 else ":",
511+
f"$(INS_{insn})",
512+
hashfile,
509513
into=lines,
510514
)
511-
emit(f"$(OUTS_{outsn})", ":", hashfile, into=lines)
512-
emit(hashfile, ":", f"$(INS_{insn})", into=lines)
513515

514516
if label:
515517
emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines)
@@ -537,9 +539,6 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
537539
emit(name, ":", *fins, into=lines)
538540

539541
outputFp.write("".join(lines))
540-
541-
if outs:
542-
emit(f"\t$(hide) touch {hashfile}")
543542
emit("")
544543

545544

build/c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def programimpl(
444444
simplerule(
445445
replaces=self,
446446
ins=cfiles + libs,
447-
outs=[f"={self.localname}$(EXT)"],
447+
outs=[f"={self.localname}{toolchain.EXE}"],
448448
deps=deps,
449449
label=label,
450450
commands=commands,

build/toolchain.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import platform
2+
3+
_is_windows = (platform.system() == "Windows")
4+
15
class Toolchain:
26
PREFIX = ""
7+
EXE = ".exe" if _is_windows else ""
38

49

510
class HostToolchain(Toolchain):

scripts/build.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ def protoencode_single(self, name, srcs: Targets, proto, symbol):
3030
ins=srcs,
3131
outs=[f"={name}.cc"],
3232
deps=[r],
33-
commands=["$[deps[0]] $[ins] $[outs] " + symbol],
33+
commands=[
34+
# Materialise symbolic links (for Windows).
35+
"cp -L $[ins[0]] $[ins[0]].real",
36+
"mv $[ins[0]].real $[ins[0]]",
37+
"$[deps[0]] $[ins] $[outs] " + symbol
38+
],
3439
label="PROTOENCODE",
3540
)
3641

0 commit comments

Comments
 (0)