# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
-# Build Options
-# change to "no" to disable the options, or define them in the makefile.mk in
-# the appropriate keymap folder that will get included automatically
-#
-BOOTMAGIC_ENABLE = yes # 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 = no # USB 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 = 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
-
# Target file name (without extension).
TARGET = planck
-
# Directory common source filess exist
TOP_DIR = ../..
TMK_DIR = ../../tmk_core
SRC := $(KEYMAP_FILE) $(SRC)
-ifeq ($(BACKLIGHT_ENABLE), yes)
- SRC := backlight.c $(SRC)
-endif
-
CONFIG_H = config.h
# MCU name
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096
+# Build Options
+# change to "no" to disable the options, or define them in the makefile.mk in
+# the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE = yes # 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 = no # 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 = 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
+
+ifdef KEYMAP
+
+ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
+ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
+ include keymaps/$(KEYMAP)/makefile.mk
+endif
+endif
+
+else
+
+ifneq ("$(wildcard keymaps/default/makefile.mk)","")
+ include keymaps/default/makefile.mk
+endif
+
+endif
+
+ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
+ SRC := backlight.c $(SRC)
+endif
+
# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax
-AUDIO_ENABLE = yes
-BACKLIGHT_ENABLE = yes
\ No newline at end of file
+AUDIO_ENABLE = yes
\ No newline at end of file
SRC += $(QUANTUM_DIR)/matrix.c
endif
-ifeq ($(MIDI_ENABLE), yes)
+ifeq ($(strip $(MIDI_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_midi.c
endif
-ifeq ($(AUDIO_ENABLE), yes)
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio.c
endif
-ifeq ($(UNICODE_ENABLE), yes)
+ifeq ($(strip $(UNICODE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif
-ifeq ($(RGBLIGHT_ENABLE), yes)
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c
OPT_DEFS += -DRGBLIGHT_ENABLE
# Option modules
-ifeq ($(BOOTMAGIC_ENABLE), yes)
+ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes)
SRC += $(COMMON_DIR)/bootmagic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBOOTMAGIC_ENABLE
endif
-ifeq ($(MOUSEKEY_ENABLE), yes)
+ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
SRC += $(COMMON_DIR)/mousekey.c
OPT_DEFS += -DMOUSEKEY_ENABLE
OPT_DEFS += -DMOUSE_ENABLE
endif
-ifeq ($(EXTRAKEY_ENABLE), yes)
+ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
OPT_DEFS += -DEXTRAKEY_ENABLE
endif
-ifeq ($(CONSOLE_ENABLE), yes)
+ifeq ($(strip $(CONSOLE_ENABLE)), yes)
OPT_DEFS += -DCONSOLE_ENABLE
else
OPT_DEFS += -DNO_PRINT
OPT_DEFS += -DNO_DEBUG
endif
-ifeq ($(COMMAND_ENABLE), yes)
+ifeq ($(strip $(COMMAND_ENABLE)), yes)
SRC += $(COMMON_DIR)/command.c
OPT_DEFS += -DCOMMAND_ENABLE
endif
-ifeq ($(NKRO_ENABLE), yes)
+ifeq ($(strip $(NKRO_ENABLE)), yes)
OPT_DEFS += -DNKRO_ENABLE
endif
-ifeq ($(MIDI_ENABLE), yes)
+ifeq ($(strip $(MIDI_ENABLE)), yes)
OPT_DEFS += -DMIDI_ENABLE
endif
-ifeq ($(AUDIO_ENABLE), yes)
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
OPT_DEFS += -DAUDIO_ENABLE
endif
-ifeq ($(USB_6KRO_ENABLE), yes)
+ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
OPT_DEFS += -DUSB_6KRO_ENABLE
endif
-ifeq ($(SLEEP_LED_ENABLE), yes)
+ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
SRC += $(COMMON_DIR)/sleep_led.c
OPT_DEFS += -DSLEEP_LED_ENABLE
OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
endif
-ifeq ($(BACKLIGHT_ENABLE), yes)
+ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(COMMON_DIR)/backlight.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBACKLIGHT_ENABLE
endif
-ifeq ($(BLUETOOTH_ENABLE), yes)
+ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
OPT_DEFS += -DBLUETOOTH_ENABLE
endif
-ifeq ($(KEYMAP_SECTION_ENABLE), yes)
+ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes)
OPT_DEFS += -DKEYMAP_SECTION_ENABLE
ifeq ($(strip $(MCU)),atmega32u2)
$(LUFA_DIR)/descriptor.c \
$(LUFA_SRC_USB)
-ifeq ($(MIDI_ENABLE), yes)
+ifeq ($(strip $(MIDI_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/midi/midi.c \
$(LUFA_DIR)/midi/midi_device.c \
$(LUFA_DIR)/midi/bytequeue/bytequeue.c \
$(LUFA_SRC_USBCLASS)
endif
-ifeq ($(BLUETOOTH_ENABLE), yes)
+ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c
endif