Add all_source_host ninja target

Former-commit-id: 80d36b0deb
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-20 01:21:42 +03:00
parent 16ab1cf7fb
commit 80dfeb6c3b
1 changed files with 16 additions and 0 deletions

View File

@ -1134,6 +1134,10 @@ else:
description="AR $out") description="AR $out")
n.newline() n.newline()
n.rule(name="host_cc", command="clang -I include/ -o $out $in",
description="host_cc $out")
n.newline()
### ###
# Build # Build
### ###
@ -1172,6 +1176,11 @@ for lib in LIBS:
"basedir": os.path.dirname(f"$builddir/src/{object}"), "basedir": os.path.dirname(f"$builddir/src/{object}"),
"basefile": f"$builddir/src/{object}" "basefile": f"$builddir/src/{object}"
}) })
n.build(f"$builddir/host/{object}.o", "host_cc", c_file,
variables={
"basedir": os.path.dirname(f"$builddir/src/{object}"),
"basefile": f"$builddir/src/{object}"
})
if add_to_all: if add_to_all:
all_source_files.append(f"$builddir/src/{object}.o") all_source_files.append(f"$builddir/src/{object}.o")
if os.path.exists(os.path.join("asm", f"{object}.s")): if os.path.exists(os.path.join("asm", f"{object}.s")):
@ -1217,6 +1226,13 @@ n.comment("Adds a command for building all source files")
n.build("all_source", "phony", all_source_files) n.build("all_source", "phony", all_source_files)
n.newline() n.newline()
###
# Helper rule for building all source files, with a host compiler
###
n.comment("Adds a command for building all source files with a host compiler")
n.build("all_source_host", "phony", [s.replace("/src/", "/host/") for s in all_source_files])
n.newline()
### ###
# Generate DOL # Generate DOL
### ###