ddw3/tools/mkraw_exe_from_toml_deps.py
Filipe Rodrigues e90924b1f4
Elf building is now done in 2 steps.
The first step defines the layout of all the symbols and is relocatable, while the second step resolves all relocations.
This allows us to have recursive `link_with` in the future.
It also fixes some issues with certain symbols being unresolvable
2024-08-02 19:55:19 +01:00

35 lines
823 B
Python

"""
Generates dependencies for creating a `raw_exe` from a `toml` manifest.
"""
# Import
import argparse
from pathlib import Path
import toml
import util
def main(args):
"""
Main function
"""
config = toml.load(open(args.input_toml, encoding="utf-8"))
input_dir = Path(args.input_toml).parent
deps_file = open(args.deps_file, "w", encoding="utf-8")
deps_file.write(f"{args.output}: ")
lib_path = util.process_path(config["lib"], input_dir)
deps_file.write(f"{lib_path} ")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="`mkraw_exe` dependency creator")
parser.add_argument("input_toml", type=str)
parser.add_argument("-o", dest="output", type=str, required=True)
parser.add_argument("--deps", dest="deps_file", type=str, required=True)
args = parser.parse_args()
main(args)