@@ -535,16 +535,24 @@ def make_emscripten_python(context, working_dir):
535535 subprocess .check_call ([exec_script , "--version" ])
536536
537537
538- def build_all (context ):
539- """Build everything."""
540- steps = [
541- configure_build_python ,
542- make_build_python ,
543- make_emscripten_libffi ,
544- make_mpdec ,
545- configure_emscripten_python ,
546- make_emscripten_python ,
547- ]
538+ def build_target (context ):
539+ """Build one or more targets."""
540+ steps = []
541+ if context .target in {"all" }:
542+ steps .append (install_emscripten )
543+ if context .target in {"build" , "all" }:
544+ steps .extend ([
545+ configure_build_python ,
546+ make_build_python ,
547+ make_emscripten_libffi ,
548+ make_mpdec ,
549+ ])
550+ if context .target in {"host" , "all" }:
551+ steps .extend ([
552+ configure_emscripten_python ,
553+ make_emscripten_python ,
554+ ])
555+
548556 for step in steps :
549557 step (context )
550558
@@ -579,6 +587,17 @@ def main():
579587 help = "Install the appropriate version of Emscripten" ,
580588 )
581589 build = subcommands .add_parser ("build" , help = "Build everything" )
590+ build .add_argument (
591+ "target" ,
592+ nargs = "?" ,
593+ default = "all" ,
594+ choices = ["all" , "host" , "build" ],
595+ help = (
596+ "What should be built. 'build' for just the build platform, or "
597+ "'host' for the host platform, or 'all' for both. Defaults to 'all'."
598+ ),
599+ )
600+
582601 configure_build = subcommands .add_parser (
583602 "configure-build-python" , help = "Run `configure` for the build Python"
584603 )
@@ -690,7 +709,7 @@ def main():
690709 "make-build-python" : make_build_python ,
691710 "configure-host" : configure_emscripten_python ,
692711 "make-host" : make_emscripten_python ,
693- "build" : build_all ,
712+ "build" : build_target ,
694713 "clean" : clean_contents ,
695714 }
696715
0 commit comments