# vim: ft=python # Normally I prefer listing every source file so that ninja can pick # up on added files and regenerate appropriately, but libc has _so_ # many files that it's unweildy. So if a file is added or removed in # libc, remember to run configure again. def glob(ext): from glob import glob def resolve(path): from pathlib import Path return str(Path(path).relative_to(module_root)) return list(map(resolve, glob(f"{module_root}/**/*.{ext}", recursive=True))) sources = [] for ext in ("c", "cpp", "s", "inc"): sources += glob(ext) + glob(ext + ".cog") headers = [] for ext in ("h",): headers += glob(ext) + glob(ext + ".cog") libc = module("libc", kind = "lib", deps = [ "j6" ], output = "libc.a", include_phase = "late", sources = sources, public_headers = headers, ) libc.variables["ccflags"] = [ "${ccflags}", "-DPRINTF_SUPPORT_DECIMAL_SPECIFIERS=0", "-DPRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS=0", ]