diff options
-rw-r--r-- | sim/Makefile.am | 3 | ||||
-rw-r--r-- | sim/Makefile.in | 3 | ||||
-rwxr-xr-x | sim/common/gennltvals.py | 13 |
3 files changed, 10 insertions, 9 deletions
diff --git a/sim/Makefile.am b/sim/Makefile.am index 24d07c8..8f53aa8 100644 --- a/sim/Makefile.am +++ b/sim/Makefile.am @@ -55,8 +55,7 @@ SIM_ALL_RECURSIVE_DEPS = # An alternative is to slurp in the tables at runtime. .PHONY: nltvals nltvals: - $(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot) - $(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def + $(srcdir)/common/gennltvals.py --cpp "$(CPP)" pkginclude_HEADERS = \ $(srcroot)/include/sim/callback.h \ diff --git a/sim/Makefile.in b/sim/Makefile.in index bc5c276..7644a43 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -1747,8 +1747,7 @@ uninstall-am: uninstall-pkgincludeHEADERS # An alternative is to slurp in the tables at runtime. .PHONY: nltvals nltvals: - $(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot) - $(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def + $(srcdir)/common/gennltvals.py --cpp "$(CPP)" common/version.c: common/version.c-stamp ; @true common/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/common/create-version.sh diff --git a/sim/common/gennltvals.py b/sim/common/gennltvals.py index b3e558d..db3ff64 100755 --- a/sim/common/gennltvals.py +++ b/sim/common/gennltvals.py @@ -160,7 +160,7 @@ def get_parser() -> argparse.ArgumentParser: formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( '-o', '--output', type=Path, - help='write to the specified file instead of stdout') + help='write to the specified directory') parser.add_argument( '--cpp', type=str, default='cpp', help='the preprocessor to use') @@ -178,8 +178,14 @@ def parse_args(argv: List[str]) -> argparse.Namespace: parser = get_parser() opts = parser.parse_args(argv) + if opts.output is None: + # Default to where the script lives. + opts.output = Path(__file__).resolve().parent + if opts.srcroot is None: opts.srcroot = Path(__file__).resolve().parent.parent.parent + else: + opts.srcroot = opts.srcroot.resolve() if opts.newlib is None: # Try to find newlib relative to our source tree. @@ -202,10 +208,7 @@ def main(argv: List[str]) -> int: """The main entry point for scripts.""" opts = parse_args(argv) - if opts.output is not None: - output = open(opts.output, 'w', encoding='utf-8') - else: - output = sys.stdout + output = (opts.output / 'nltvals.def').open('w', encoding='utf-8') gen(output, opts.newlib, opts.cpp) return 0 |