diff --git a/configure.py b/configure.py index a62f1c8..f39dfca 100755 --- a/configure.py +++ b/configure.py @@ -105,10 +105,16 @@ parser.add_argument( action="store_true", help="print verbose output", ) +parser.add_argument( + "--non-matching", + dest="non_matching", + action="store_true", + help="builds equivalent (but non-matching) or modded objects", +) args = parser.parse_args() config = ProjectConfig() -config.version = args.version +config.version = str(args.version) version_num = VERSIONS.index(config.version) # Apply arguments @@ -118,6 +124,7 @@ config.binutils_path = args.binutils config.compilers_path = args.compilers config.debug = args.debug config.generate_map = args.map +config.non_matching = args.non_matching config.sjiswrap_path = args.sjiswrap if not is_windows(): config.wrapper = args.wrapper @@ -146,6 +153,8 @@ config.ldflags = [ "-nodefaults", # "-listclosure", # Uncomment for Wii linkers ] +# Use for any additional files that should cause a re-configure when modified +config.reconfig_deps = [] # Base flags, common to most GC/Wii games. # Generally leave untouched, with overrides added below. @@ -220,8 +229,9 @@ def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]: } -Matching = True -NonMatching = False +Matching = True # Object matches and should be linked +NonMatching = False # Object does not match and should not be linked +Equivalent = config.non_matching # Object should be linked when configured with --non-matching config.warn_missing_config = True config.warn_missing_source = False diff --git a/tools/project.py b/tools/project.py index bf61890..4e2263d 100644 --- a/tools/project.py +++ b/tools/project.py @@ -71,6 +71,7 @@ class ProjectConfig: self.sjiswrap_path: Optional[Path] = None # If None, download # Project config + self.non_matching: bool = False self.build_rels: bool = True # Build REL files self.check_sha_path: Optional[Path] = None # Path to version.sha1 self.config_path: Optional[Path] = None # Path to config.yml @@ -90,6 +91,9 @@ class ProjectConfig: self.shift_jis = ( True # Convert source files from UTF-8 to Shift JIS automatically ) + self.reconfig_deps: Optional[List[Path]] = ( + None # Additional re-configuration dependency files + ) # Progress output and progress.json config self.progress_all: bool = True # Include combined "all" category @@ -553,6 +557,7 @@ def generate_build_ninja( ) n.newline() + link_outputs: List[Path] = [] if build_config: link_steps: List[LinkStep] = [] used_compiler_versions: Set[str] = set() @@ -760,6 +765,7 @@ def generate_build_ninja( ### for step in link_steps: step.write(n) + link_outputs.append(step.output()) n.newline() ### @@ -861,7 +867,7 @@ def generate_build_ninja( outputs=ok_path, rule="check", inputs=config.check_sha_path, - implicit=[dtk, *map(lambda step: step.output(), link_steps)], + implicit=[dtk, *link_outputs], ) n.newline() @@ -961,6 +967,7 @@ def generate_build_ninja( configure_script, python_lib, python_lib_dir / "ninja_syntax.py", + *(config.reconfig_deps or []) ], ) n.newline() @@ -970,7 +977,10 @@ def generate_build_ninja( ### n.comment("Default rule") if build_config: - n.default(progress_path) + if config.non_matching: + n.default(link_outputs) + else: + n.default(progress_path) else: n.default(build_config_path)