Drop bs4 dependency, update docs, minor improvements
[jackhill/qmk/firmware.git] / docs / getting_started_make_guide.md
CommitLineData
7b0356d1 1# More Detailed `make` Instructions
f9a7dd6c 2
800ec55d
JH
3The full syntax of the `make` command is `<keyboard_folder>:<keymap>:<target>`, where:
4
5* `<keyboard_folder>` is the path of the keyboard, for example `planck`
6 * Use `all` to compile all keyboards
bb53635f 7 * Specify the path to compile a revision, for example `planck/rev4` or `planck/rev3`
800ec55d
JH
8 * If the keyboard doesn't have any folders, it can be left out
9 * To compile the default folder, you can leave it out
f9a7dd6c 10* `<keymap>` is the name of the keymap, for example `algernon`
800ec55d 11 * Use `all` to compile all keymaps
f9a7dd6c 12* `<target>` will be explained in more detail below.
13
f9a7dd6c 14The `<target>` means the following
15* If no target is given, then it's the same as `all` below
7b51f050 16* `all` compiles as many keyboard/revision/keymap combinations as specified. For example, `make planck/rev4:default` will generate a single .hex, while `make planck/rev4:all` will generate a hex for every keymap available to the planck.
0e6f7854
DJ
17* `flash`, `dfu`, `teensy`, `avrdude`, `dfu-util`, or `bootloadHID` compile and upload the firmware to the keyboard. If the compilation fails, then nothing will be uploaded. The programmer to use depends on the keyboard. For most keyboards it's `dfu`, but for ChibiOS keyboards you should use `dfu-util`, and `teensy` for standard Teensys. To find out which command you should use for your keyboard, check the keyboard specific readme.
18 * **Note**: some operating systems need root access for these commands to work, so in that case you need to run for example `sudo make planck/rev4:default:flash`.
f9a7dd6c 19* `clean`, cleans the build output folders to make sure that everything is built from scratch. Run this before normal compilation if you have some unexplainable problems.
20
f9a7dd6c 21You can also add extra options at the end of the make command line, after the target
22
23* `make COLOR=false` - turns off color output
24* `make SILENT=true` - turns off output besides errors/warnings
25* `make VERBOSE=true` - outputs all of the gcc stuff (not interesting, unless you need to debug)
26* `make EXTRAFLAGS=-E` - Preprocess the code without doing any compiling (useful if you are trying to debug #define commands)
27
28The make command itself also has some additional options, type `make --help` for more information. The most useful is probably `-jx`, which specifies that you want to compile using more than one CPU, the `x` represents the number of CPUs that you want to use. Setting that can greatly reduce the compile times, especially if you are compiling many keyboards/keymaps. I usually set it to one less than the number of CPUs that I have, so that I have some left for doing other things while it's compiling. Note that not all operating systems and make versions supports that option.
29
30Here are some examples commands
31
800ec55d 32* `make all:all` builds everything (all keyboard folders, all keymaps). Running just `make` from the `root` will also run this.
bb53635f 33* `make ergodox_infinity:algernon:clean` will clean the build output of the Ergodox Infinity keyboard.
0e6f7854 34* `make planck/rev4:default:flash COLOR=false` builds and uploads the keymap without color output.
f9a7dd6c 35
7b0356d1 36## `rules.mk` Options
f9a7dd6c 37
38Set these variables to `no` to disable them, and `yes` to enable them.
39
40`BOOTMAGIC_ENABLE`
41
42This allows you to hold a key and the salt key (space by default) and have access to a various EEPROM settings that persist over power loss. It's advised you keep this disabled, as the settings are often changed by accident, and produce confusing results that makes it difficult to debug. It's one of the more common problems encountered in help sessions.
43
f9a7dd6c 44`MOUSEKEY_ENABLE`
45
46This gives you control over cursor movements and clicks via keycodes/custom functions.
47
48`EXTRAKEY_ENABLE`
49
50This allows you to use the system and audio control key codes.
51
52`CONSOLE_ENABLE`
53
bb53635f 54This allows you to print messages that can be read using [`hid_listen`](https://www.pjrc.com/teensy/hid_listen.html).
f9a7dd6c 55
bb53635f 56By default, all debug (*dprint*) print (*print*, *xprintf*), and user print (*uprint*) messages will be enabled. This will eat up a significant portion of the flash and may make the keyboard .hex file too big to program.
f9a7dd6c 57
58To disable debug messages (*dprint*) and reduce the .hex file size, include `#define NO_DEBUG` in your `config.h` file.
59
60To disable print messages (*print*, *xprintf*) and user print messages (*uprint*) and reduce the .hex file size, include `#define NO_PRINT` in your `config.h` file.
61
380e05ad 62To disable print messages (*print*, *xprintf*) and **KEEP** user print messages (*uprint*), include `#define USER_PRINT` in your `config.h` file (do not also include `#define NO_PRINT` in this case).
f9a7dd6c 63
64To see the text, open `hid_listen` and enjoy looking at your printed messages.
65
bb53635f 66**NOTE:** Do not include *uprint* messages in anything other than your keymap code. It must not be used within the QMK system framework. Otherwise, you will bloat other people's .hex files.
f9a7dd6c 67
f9a7dd6c 68`COMMAND_ENABLE`
69
70This enables magic commands, typically fired with the default magic key combo `LSHIFT+RSHIFT+KEY`. Magic commands include turning on debugging messages (`MAGIC+D`) or temporarily toggling NKRO (`MAGIC+N`).
71
72`SLEEP_LED_ENABLE`
73
74Enables your LED to breath while your computer is sleeping. Timer1 is being used here. This feature is largely unused and untested, and needs updating/abstracting.
75
76`NKRO_ENABLE`
77
78This allows the keyboard to tell the host OS that up to 248 keys are held down at once (default without NKRO is 6). NKRO is off by default, even if `NKRO_ENABLE` is set. NKRO can be forced by adding `#define FORCE_NKRO` to your config.h or by binding `MAGIC_TOGGLE_NKRO` to a key and then hitting the key.
79
80`BACKLIGHT_ENABLE`
81
4d72aa42 82This enables the in-switch LED backlighting. You can specify the backlight pin by putting this in your `config.h`:
f9a7dd6c 83
84 #define BACKLIGHT_PIN B7
85
86`MIDI_ENABLE`
87
88This enables MIDI sending and receiving with your keyboard. To enter MIDI send mode, you can use the keycode `MI_ON`, and `MI_OFF` to turn it off. This is a largely untested feature, but more information can be found in the `quantum/quantum.c` file.
89
90`UNICODE_ENABLE`
91
cd9262d7 92This allows you to send Unicode characters using `UC(<code point>)` in your keymap. Code points up to `0x7FFF` are supported. This covers characters for most modern languages, as well as symbols, but it doesn't cover emoji.
f9a7dd6c 93
94`UNICODEMAP_ENABLE`
95
28929ad0 96This allows you to send Unicode characters using `X(<map index>)` in your keymap. You will need to maintain a mapping table in your keymap file. All possible code points (up to `0x10FFFF`) are supported.
f9a7dd6c 97
cd9262d7 98`UCIS_ENABLE`
f9a7dd6c 99
cd9262d7
100This allows you to send Unicode characters by inputting a mnemonic corresponding to the character you want to send. You will need to maintain a mapping table in your keymap file. All possible code points (up to `0x10FFFF`) are supported.
101
102For further details, as well as limitations, see the [Unicode page](feature_unicode.md).
f9a7dd6c 103
104`BLUETOOTH_ENABLE`
105
106This allows you to interface with a Bluefruit EZ-key to send keycodes wirelessly. It uses the D2 and D3 pins.
107
108`AUDIO_ENABLE`
109
9d1a08e3 110This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information.
f9a7dd6c 111
112`FAUXCLICKY_ENABLE`
113
cd9262d7 114Uses buzzer to emulate clicky switches. A cheap imitation of the Cherry blue switches. By default, uses the C6 pin, same as `AUDIO_ENABLE`.
f9a7dd6c 115
116`VARIABLE_TRACE`
117
9d1a08e3 118Use this to debug changes to variable values, see the [tracing variables](unit_testing.md#tracing-variables) section of the Unit Testing page for more information.
f9a7dd6c 119
120`API_SYSEX_ENABLE`
121
122This enables using the Quantum SYSEX API to send strings (somewhere?)
123
5fc4a664
FS
124`KEY_LOCK_ENABLE`
125
b23f6011 126This enables [key lock](feature_key_lock.md).
5fc4a664 127
0fab3bbd
TC
128`SPLIT_KEYBOARD`
129
130This enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common
131
28929ad0
JC
132`SPLIT_TRANSPORT`
133
134As there is no standard split communication driver for ARM-based split keyboards yet, `SPLIT_TRANSPORT = custom` must be used for these. It will prevent the standard split keyboard communication code (which is AVR-specific) from being included, allowing a custom implementation to be used.
135
136`CUSTOM_MATRIX`
137
6e710426 138Lets you replace the default matrix scanning routine with your own code. For further details, see the [Custom Matrix page](custom_matrix.md).
28929ad0 139
c7c4937e 140`DEBOUNCE_TYPE`
28929ad0 141
c7c4937e 142Lets you replace the default key debouncing routine with an alternative one. If `custom` you will need to provide your own implementation.
28929ad0 143
7b0356d1 144## Customizing Makefile Options on a Per-Keymap Basis
f9a7dd6c 145
4cdcbdb8 146If your keymap directory has a file called `rules.mk` any options you set in that file will take precedence over other `rules.mk` options for your particular keyboard.
f9a7dd6c 147
4cdcbdb8 148So let's say your keyboard's `rules.mk` has `BACKLIGHT_ENABLE = yes`. You want your particular keyboard to not have the backlight, so you make a file called `rules.mk` and specify `BACKLIGHT_ENABLE = no`.