Add all_source_host ninja target

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-20 01:21:42 +03:00
parent 83fe50ee1f
commit 80d36b0deb
No known key found for this signature in database
GPG Key ID: E224F951761145F8
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
### ###