Skip to content

Commit

Permalink
Remove all Makefiles from the keyboards directory. (qmk#1660)
Browse files Browse the repository at this point in the history
* Remove all Makefiles from the keyboards directory.

* update keymaps added in the last 8 days

* Ignore keyboard/keymap makefiles

* update hand_wire to reflect our new Makefile-less reality

* Update the make guide to reflect the new reality

* move planck keymap options to rules.mk

* update planck keymaps 4real

* trigger travis

* add back build_keyboard.mk

* restore changes to build_keyboard
  • Loading branch information
skullydazed authored and jackhumbert committed Sep 8, 2017
1 parent cf8e105 commit 4cdcbdb
Show file tree
Hide file tree
Showing 224 changed files with 4,078 additions and 210 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ CMakeLists.txt
.DS_STORE
/util/wsl_downloaded
/util/win_downloaded
/keyboards/*/Makefile
/keyboards/*/*/Makefile
/keyboards/*/keymaps/Makefile

# Eclipse/PyCharm/Other IDE Settings
.cproject
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ifeq ($(CURRENT_PATH_ELEMENT),keyboards)
endif

# Only consider folders with makefiles, to prevent errors in case there are extra folders
KEYBOARDS := $(notdir $(patsubst %/Makefile,%,$(wildcard $(ROOT_DIR)/keyboards/*/Makefile)))
KEYBOARDS := $(notdir $(patsubst %/rules.mk,%,$(wildcard $(ROOT_DIR)/keyboards/*/rules.mk)))

#Compatibility with the old make variables, anything you specify directly on the command line
# always overrides the detected folders
Expand Down Expand Up @@ -261,7 +261,7 @@ endef
define PARSE_KEYBOARD
CURRENT_KB := $1
# A subproject is any keyboard subfolder with a makefile
SUBPROJECTS := $$(notdir $$(patsubst %/Makefile,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/*/Makefile)))
SUBPROJECTS := $$(notdir $$(patsubst %/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/*/rules.mk)))
# if the rule starts with allsp, then continue with looping over all subprojects
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allsp),true)
$$(eval $$(call PARSE_ALL_SUBPROJECTS))
Expand Down Expand Up @@ -300,7 +300,9 @@ define PARSE_SUBPROJECT
endif
ifeq ($$(CURRENT_SP),defaultsp)
SUBPROJECT_DEFAULT=
$$(eval include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/Makefile)
ifneq ("$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/subproject.mk)","")
$$(eval include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/subproject.mk)
endif
CURRENT_SP := $$(SUBPROJECT_DEFAULT)
endif
# If current subproject is empty (the default was not defined), and we have a list of subproject
Expand Down Expand Up @@ -503,7 +505,7 @@ if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
endef

# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
SUBPROJECTS := $(notdir $(patsubst %/Makefile,%,$(wildcard ./*/Makefile)))
SUBPROJECTS := $(notdir $(patsubst %/rules.mk,%,$(wildcard ./*/rules.mk)))
.PHONY: $(SUBPROJECTS)
$(SUBPROJECTS): %: %-allkm

Expand Down
5 changes: 2 additions & 3 deletions build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ MAIN_KEYMAP_C := $(MAIN_KEYMAP_PATH)/keymap.c
SUBPROJ_KEYMAP_PATH := $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
SUBPROJ_KEYMAP_C := $(SUBPROJ_KEYMAP_PATH)/keymap.c
ifneq ("$(wildcard $(SUBPROJ_KEYMAP_C))","")
-include $(SUBPROJ_KEYMAP_PATH)/Makefile
-include $(SUBPROJ_KEYMAP_PATH)/rules.mk
KEYMAP_C := $(SUBPROJ_KEYMAP_C)
KEYMAP_PATH := $(SUBPROJ_KEYMAP_PATH)
else ifneq ("$(wildcard $(MAIN_KEYMAP_C))","")
-include $(MAIN_KEYMAP_PATH)/Makefile
-include $(MAIN_KEYMAP_PATH)/rules.mk
KEYMAP_C := $(MAIN_KEYMAP_C)
KEYMAP_PATH := $(MAIN_KEYMAP_PATH)
else ifneq ($(LAYOUTS),)
Expand Down Expand Up @@ -181,4 +181,3 @@ build: elf hex


include $(TMK_PATH)/rules.mk

48 changes: 9 additions & 39 deletions docs/getting_started_make_guide.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# More detailed make instruction

The full syntax of the `make` command is the following, but parts of the command can be left out if you run it from other directories than the `root` (as you might already have noticed by reading the simple instructions).

`<keyboard>-<subproject>-<keymap>-<target>`, where:
The full syntax of the `make` command is `<keyboard>-<subproject>-<keymap>-<target>`, where:

* `<keyboard>` is the name of the keyboard, for example `planck`
* Use `allkb` to compile all keyboards
Expand All @@ -14,24 +12,13 @@ The full syntax of the `make` command is the following, but parts of the command
* Use `allkm` to compile all keymaps
* `<target>` will be explained in more detail below.

**Note:** When you leave some parts of the command out, you should also remove the dash (`-`).

As mentioned above, there are some shortcuts, when you are in a:

* `keyboard` folder, the command will automatically fill the `<keyboard>` part. So you only need to type `<subproject>-<keymap>-<target>`
* `subproject` folder, it will fill in both `<keyboard>` and `<subproject>`
* `keymap` folder, then `<keyboard>` and `<keymap>` will be filled in. If you need to specify the `<subproject>` use the following syntax `<subproject>-<target>`
* Note in order to support this shortcut, the keymap needs its own Makefile
* `keymap` folder of a `subproject`, then everything except the `<target>` will be filled in

The `<target>` means the following
* If no target is given, then it's the same as `all` below
* `all` compiles the keyboard and generates a `<keyboard>_<keymap>.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests.
* `dfu`, `teensy` or `dfu-util`, 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 Infinity 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. **Note** that some operating systems needs root access for these commands to work, so in that case you need to run for example `sudo make dfu`.
* `all` compiles as many keyboard/revision/keymap combinations as specified. For example, `make planck-rev4-default-all` will generate a single .hex, while `make planck-rev-all` will generate a hex for every keymap available to the planck.
* `dfu`, `teensy` or `dfu-util`, 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.
* **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-dfu`.
* `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.

Some other targets are supported but, but not important enough to be documented here. Check the source code of the make files for more information.

You can also add extra options at the end of the make command line, after the target

* `make COLOR=false` - turns off color output
Expand All @@ -44,25 +31,10 @@ The make command itself also has some additional options, type `make --help` for
Here are some examples commands

* `make allkb-allsp-allkm` builds everything (all keyboards, all subprojects, all keymaps). Running just `make` from the `root` will also run this.
* `make` from within a `keyboard` directory, is the same as `make keyboard-allsp-allkm`, which compiles all subprojects and keymaps of the keyboard. **NOTE** that this behaviour has changed. Previously it compiled just the default keymap.
* `make ergodox-infinity-algernon-clean` will clean the build output of the Ergodox Infinity keyboard. This example uses the full syntax and can be run from any folder with a `Makefile`
* `make dfu COLOR=false` from within a keymap folder, builds and uploads the keymap, but without color output.

# The `Makefile`
* `make ergodox-infinity-algernon-clean` will clean the build output of the Ergodox Infinity keyboard.
* `make planck-rev4-default-dfu COLOR=false` builds and uploads the keymap without color output.

There are 5 different `make` and `Makefile` locations:

* root (`/`)
* keyboard (`/keyboards/<keyboard>/`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
* subproject (`/keyboards/<keyboard>/<subproject>`)
* subproject keymap (`/keyboards/<keyboard>/<subproject>/keymaps/<keymap>`)

The root contains the code used to automatically figure out which keymap or keymaps to compile based on your current directory and commandline arguments. It's considered stable, and shouldn't be modified. The keyboard one will contain the MCU set-up and default settings for your keyboard, and shouldn't be modified unless you are the producer of that keyboard. The keymap Makefile can be modified by users, and is optional. It is included automatically if it exists. You can see an example [here](https://github.com/qmk/qmk_firmware/blob/master/doc/keymap_makefile_example.mk) - the last few lines are the most important. The settings you set here will override any defaults set in the keyboard Makefile. **The file is required if you want to run `make` in the keymap folder.**

For keyboards and subprojects, the make files are split in two parts `Makefile` and `rules.mk`. All settings can be found in the `rules.mk` file, while the `Makefile` is just there for support and including the root `Makefile`. Keymaps contain just one `Makefile` for simplicity.

## Makefile options
## `rules.mk` options

Set these variables to `no` to disable them, and `yes` to enable them.

Expand Down Expand Up @@ -164,8 +136,6 @@ This enables [key lock](key_lock.md). This consumes an additional 260 bytes.

## Customizing Makefile options on a per-keymap basis

If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard.

So let's say your keyboard's makefile has `BACKLIGHT_ENABLE = yes` (or maybe doesn't even list the `BACKLIGHT_ENABLE` option, which would cause it to be off). You want your particular keymap to not have the debug console, so you make a file called `Makefile` and specify `BACKLIGHT_ENABLE = no`.
If 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.

You can use the `docs/keymap_makefile_example.md` as a template/starting point.
So 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`.
4 changes: 2 additions & 2 deletions docs/hand_wire.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ This would require our `KEYMAP` definition to look like this:

Notice how the `k11` and `KC_NO` switched places to represent the wiring, and the unused final column on the bottom row. Sometimes it'll make more sense to put a keyswitch on a particular column, but in the end, it won't matter, as long as all of them are accounted for. You can use this process to write out the `KEYMAP` for your entire keyboard - be sure to remember that your keyboard is actually backwards when looking at the underside of it.

### keymaps/default.c
### keymaps/<variant>/default.c

This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make KEYMAP=<variant>`, which will pull `keymaps/<variant>.c`.
This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make handwired-<keyboard>-<variant>`, which will pull `keymaps/<variant>/keymap.c`.

The basis of a keymap is its layers - by default, layer 0 is active. You can activate other layers, the highest of which will be referenced first. Let's start with our base layer.

Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions keyboards/amj40/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD


ifndef QUANTUM_DIR
include ../../../../Makefile
endif
27 changes: 27 additions & 0 deletions keyboards/amj40/keymaps/fabian/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD


ifndef QUANTUM_DIR
include ../../../../Makefile
endif
23 changes: 23 additions & 0 deletions keyboards/amj60/keymaps/iso_split_rshift/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

ifndef QUANTUM_DIR
include ../../../../Makefile
endif
15 changes: 15 additions & 0 deletions keyboards/atomic/keymaps/pvc/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
4 changes: 4 additions & 0 deletions keyboards/atreus62/keymaps/atreus52/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NKRO_ENABLE = true
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
5 changes: 5 additions & 0 deletions keyboards/atreus62/keymaps/mneme/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TAP_DANCE_ENABLE = yes
NKRO_ENABLE = true
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
37 changes: 37 additions & 0 deletions keyboards/bananasplit/keymaps/0010/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2017 Balz Guenat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


# QMK Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
# BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
# MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
# EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
# CONSOLE_ENABLE = no # Console for debug(+400)
# COMMAND_ENABLE = yes # Commands for debug and configuration
# NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
# BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
# MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
# AUDIO_ENABLE = no # Audio output on port C6
# UNICODE_ENABLE = no # Unicode
# BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
# RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

ifndef QUANTUM_DIR
include ../../../../Makefile
endif
37 changes: 37 additions & 0 deletions keyboards/bananasplit/keymaps/coloneljesus/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2017 Balz Guenat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


# QMK Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
# BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
# MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
# EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
# CONSOLE_ENABLE = no # Console for debug(+400)
# COMMAND_ENABLE = yes # Commands for debug and configuration
# NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
# BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
# MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
# AUDIO_ENABLE = no # Audio output on port C6
# UNICODE_ENABLE = no # Unicode
# BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
# RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

ifndef QUANTUM_DIR
include ../../../../Makefile
endif
Loading

0 comments on commit 4cdcbdb

Please sign in to comment.