clean.py 533 B

12345678910111213141516
  1. """Clean the QMK firmware folder of build artifacts.
  2. """
  3. from qmk.commands import run
  4. from milc import cli
  5. import shutil
  6. @cli.argument('-a', '--all', arg_only=True, action='store_true', help='Remove *.hex and *.bin files in the QMK root as well.')
  7. @cli.subcommand('Clean the QMK firmware folder of build artifacts.')
  8. def clean(cli):
  9. """Runs `make clean` (or `make distclean` if --all is passed)
  10. """
  11. make_cmd = 'gmake' if shutil.which('gmake') else 'make'
  12. run([make_cmd, 'distclean' if cli.args.all else 'clean'])