()
| 35 | # Main run() function |
| 36 | # |
| 37 | def run(): |
| 38 | if len(sys.argv) < 2 or sys.argv[1] in {'--version', '--help'}: |
| 39 | print('''\ |
| 40 | emmake is a helper for make, setting various environment |
| 41 | variables so that emcc etc. are used. Typical usage: |
| 42 | |
| 43 | emmake make [FLAGS] |
| 44 | |
| 45 | (but you can run any command instead of make)''', file=sys.stderr) |
| 46 | return 1 |
| 47 | |
| 48 | args = sys.argv[1:] |
| 49 | env = building.get_building_env() |
| 50 | |
| 51 | # On Windows prefer building with mingw32-make instead of make, if it exists. |
| 52 | if utils.WINDOWS: |
| 53 | if args[0] == 'make': |
| 54 | mingw32_make = shutil.which('mingw32-make') |
| 55 | if mingw32_make: |
| 56 | args[0] = mingw32_make |
| 57 | |
| 58 | # On Windows, run the execution through shell to get PATH expansion and |
| 59 | # executable extension lookup, e.g. 'make' will match with |
| 60 | # 'make.bat' in PATH. |
| 61 | print(f'emmake: "{shlex.join(args)}" in "{os.getcwd()}"', file=sys.stderr) |
| 62 | if utils.WINDOWS: |
| 63 | return utils.run_process(args, check=False, shell=True, env=env).returncode |
| 64 | else: |
| 65 | os.environ.update(env) |
| 66 | utils.exec(args) |
| 67 | |
| 68 | |
| 69 | if __name__ == '__main__': |
no test coverage detected