
    7j                        d Z ddlmZ ddlmZ ddlZddlmZm	Z	 ddl
mZ ddlmZmZmZ ddlmZmZ dd	lmZmZ  ej,                  d
ddej.                  j1                  d       ed      d       ej,                  ddeed       ej,                  dded       ej,                  ddddd       ej,                  dded d!"       ej,                  d#d$dd%g d&'       ej,                  d(d)ddd*       ej,                  d+d,edd-"       ej,                  d.ddd/       ej6                  d0      ee	d1                                                                                     Zy)2zjCompile a QMK Firmware.

You can compile a keymap already in the repo or using a QMK Configurator export.
    )FilesCompleter)cliN)automagic_keyboardautomagic_keymap)build_environment)keyboard_completerkeyboard_folder_or_allis_all_keyboards)keymap_completerlocate_keymap)KeyboardKeymapBuildTargetJsonKeymapBuildTargetfilename?Trz.jsonz"The configurator export to compile)nargsarg_onlytype	completerhelpz-kbz
--keyboardzUThe keyboard to build a firmware for. Ignored when a configurator export is supplied.)r   r   r   z-kmz--keymapzSThe keymap to build a firmware for. Ignored when a configurator export is supplied.)r   r   z-nz	--dry-run
store_truez;Don't actually build, just show the make command to be run.)r   actionr   z-jz
--parallel   z8Set the number of parallel make jobs; 0 means unlimited.)r   defaultr   z-ez--envappendzBSet a variable to be passed to make. May be passed multiple times.)r   r   r   r   z-cz--cleanz%Remove object files before compiling.z-tz--targetzaIntended alternative build target, such as `production` in `make planck/rev4:default:production`.z--compiledbzMGenerates the clang compile_commands.json file during build. Implies --clean.zCompile a QMK Firmware.c                 z   t        | j                  j                        rddlm} g | j                  _        g | j                  _        | j                  j                  j                  | j                  j                  _        | j                  j                  j                  | j                  j                  _	        d| j                  _
         ||       S | j                  j                  dk(  rddlm} | j                  j                  j                   dg| j                  _        g | j                  _        d| j                  j                  _        | j                  j                  j                  | j                  j                  _	        d| j                  _
         ||       S t        | j                  j                        }d}| j                  j                  r t        | j                  j                        }n| j                  j                  j                  r| j                  j                  j                  rt        | j                  j                  j                  | j                  j                  j                        s-| j                   j#                  d        | j$                          yt'        | j                  j                  j                  | j                  j                  j                        }|s-| j                   j#                  d        | j$                          y|j)                  | j                  j                  j                  | j                  j*                  | j                  j,                  	        |j                  | j                  j.                  fd
| j                  j0                  i|S )zCompile a QMK Firmware.

    If a Configurator export is supplied this command will create a new keymap, overwriting an existing keymap if one exists.

    If a keyboard and keymap are provided this command will build a firmware based on that.
    r   )mass_compileFallz:allNzInvalid keymap argument.zwYou must supply a configurator export, both `--keyboard` and `--keymap`, or be in a directory for a keyboard or keymap.)parallelclean	compiledbdry_run)r
   argskeyboardr   buildsfilterconfigcompilekeymapr   no_tempr   envr   r   r   logerror
print_helpr   	configurer    r!   targetr"   )r   r   envsr0   s       H/home/hanthebot/chat/keyboard/qmk_firmware/lib/python/qmk/cli/compile.pyr(   r(      s   * ))*.),););)B)B

&+.::+=+=+F+F

( C   xx%.!jj0099:$?@)-

&+.::+=+=+F+F

( C   SXX\\*D F
xx&sxx'8'89				$	$););)B)BSZZ//88#**:L:L:S:STGGMM45CNN +3::+=+=+F+F

HZHZHaHab  P  	Q
cjj0099[^[c[c[m[mn6>>#((//L3883C3CLtLL    )__doc__argcomplete.completersr   milcr   qmk.pathqmkqmk.decoratorsr   r   qmk.commandsr   qmk.keyboardr   r	   r
   
qmk.keymapr   r   qmk.build_targetsr   r   argumentpathFileTypeintstr
subcommandr(    r3   r2   <module>rE      s   2   ? * U U 6 N jd9J9J39O[ijq[r  z^  _e\(>J\  d{  |eZ+;  CX  YdK$|  KH  IdLsA<vwdGd8R  OS  TdI\HopdJS$  >a  bmd<  GV  W)*6M   + W b q T x I Y | _6Mr3   