2018-08-11 20:16:21 +02:00
|
|
|
# Determine what keyboard we are building and setup the build environment.
|
|
|
|
#
|
|
|
|
# We support folders up to 5 levels deep below `keyboards/`. This file is
|
|
|
|
# responsible for determining which folder is being used and doing the
|
|
|
|
# corresponding environment setup.
|
|
|
|
|
2016-08-01 08:23:37 +02:00
|
|
|
ifndef VERBOSE
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
2016-08-21 16:14:38 +02:00
|
|
|
include common.mk
|
2016-08-21 12:53:36 +02:00
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Set the filename for the final firmware binary
|
2017-10-14 23:32:19 +02:00
|
|
|
KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
|
|
|
|
TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
|
|
|
|
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
|
2019-01-10 17:22:57 +01:00
|
|
|
STM32_PATH := quantum/stm32
|
2016-08-21 12:53:36 +02:00
|
|
|
|
|
|
|
# Force expansion
|
|
|
|
TARGET := $(TARGET)
|
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# For split boards we need to set a master half.
|
2016-08-01 08:23:37 +02:00
|
|
|
MASTER ?= left
|
|
|
|
ifdef master
|
2017-04-12 08:52:40 +02:00
|
|
|
MASTER = $(master)
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
2017-02-26 06:13:47 +01:00
|
|
|
ifeq ($(MASTER),right)
|
2017-04-12 08:52:40 +02:00
|
|
|
OPT_DEFS += -DMASTER_IS_ON_RIGHT
|
2017-02-26 06:13:47 +01:00
|
|
|
else
|
2017-04-12 08:52:40 +02:00
|
|
|
ifneq ($(MASTER),left)
|
2016-08-27 12:43:12 +02:00
|
|
|
$(error MASTER does not have a valid value(left/right))
|
2017-04-12 08:52:40 +02:00
|
|
|
endif
|
2016-08-27 12:43:12 +02:00
|
|
|
endif
|
|
|
|
|
2018-12-15 06:31:56 +01:00
|
|
|
ifdef SKIP_VERSION
|
|
|
|
OPT_DEFS += -DSKIP_VERSION
|
|
|
|
endif
|
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Determine which subfolders exist.
|
|
|
|
KEYBOARD_FOLDER_PATH_1 := $(KEYBOARD)
|
|
|
|
KEYBOARD_FOLDER_PATH_2 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_1)))
|
|
|
|
KEYBOARD_FOLDER_PATH_3 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_2)))
|
|
|
|
KEYBOARD_FOLDER_PATH_4 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_3)))
|
|
|
|
KEYBOARD_FOLDER_PATH_5 := $(patsubst %/,%,$(dir $(KEYBOARD_FOLDER_PATH_4)))
|
|
|
|
KEYBOARD_FOLDER_1 := $(notdir $(KEYBOARD_FOLDER_PATH_1))
|
|
|
|
KEYBOARD_FOLDER_2 := $(notdir $(KEYBOARD_FOLDER_PATH_2))
|
|
|
|
KEYBOARD_FOLDER_3 := $(notdir $(KEYBOARD_FOLDER_PATH_3))
|
|
|
|
KEYBOARD_FOLDER_4 := $(notdir $(KEYBOARD_FOLDER_PATH_4))
|
|
|
|
KEYBOARD_FOLDER_5 := $(notdir $(KEYBOARD_FOLDER_PATH_5))
|
2017-10-14 23:32:19 +02:00
|
|
|
KEYBOARD_PATHS :=
|
|
|
|
KEYBOARD_PATH_1 := keyboards/$(KEYBOARD_FOLDER_PATH_1)
|
|
|
|
KEYBOARD_PATH_2 := keyboards/$(KEYBOARD_FOLDER_PATH_2)
|
|
|
|
KEYBOARD_PATH_3 := keyboards/$(KEYBOARD_FOLDER_PATH_3)
|
|
|
|
KEYBOARD_PATH_4 := keyboards/$(KEYBOARD_FOLDER_PATH_4)
|
|
|
|
KEYBOARD_PATH_5 := keyboards/$(KEYBOARD_FOLDER_PATH_5)
|
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
|
2017-10-14 23:32:19 +02:00
|
|
|
KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
|
2018-08-11 20:16:21 +02:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
|
|
|
|
KEYBOARD_PATHS += $(KEYBOARD_PATH_4)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
|
|
|
|
KEYBOARD_PATHS += $(KEYBOARD_PATH_3)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
|
|
|
|
KEYBOARD_PATHS += $(KEYBOARD_PATH_2)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
|
|
|
|
KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
|
|
|
|
endif
|
|
|
|
|
2019-01-10 17:22:57 +01:00
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Pull in rules.mk files from all our subfolders
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
|
2017-10-14 23:32:19 +02:00
|
|
|
include $(KEYBOARD_PATH_5)/rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_4)/rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_3)/rules.mk
|
2016-08-08 09:26:23 +02:00
|
|
|
endif
|
2017-10-14 23:32:19 +02:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_2)/rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_1)/rules.mk
|
|
|
|
endif
|
|
|
|
|
2019-01-10 17:22:57 +01:00
|
|
|
|
|
|
|
MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
|
|
|
|
MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
|
|
|
|
MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
|
|
|
|
MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
|
|
|
|
MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
|
|
|
|
-include $(MAIN_KEYMAP_PATH_5)/rules.mk
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
|
|
|
|
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
|
|
|
|
-include $(MAIN_KEYMAP_PATH_4)/rules.mk
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
|
|
|
|
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
|
|
|
|
-include $(MAIN_KEYMAP_PATH_3)/rules.mk
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
|
|
|
|
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
|
|
|
|
-include $(MAIN_KEYMAP_PATH_2)/rules.mk
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
|
|
|
|
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
|
|
|
|
-include $(MAIN_KEYMAP_PATH_1)/rules.mk
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
|
|
|
|
else ifneq ($(LAYOUTS),)
|
|
|
|
include build_layout.mk
|
|
|
|
else
|
|
|
|
$(error Could not find keymap)
|
|
|
|
# this state should never be reached
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(CTPC)), yes)
|
|
|
|
CONVERT_TO_PROTON_C=yes
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
|
|
|
|
TARGET := $(TARGET)_proton_c
|
|
|
|
include $(STM32_PATH)/proton_c.mk
|
|
|
|
OPT_DEFS += -DCONVERT_TO_PROTON_C
|
|
|
|
endif
|
|
|
|
|
2019-02-15 05:14:26 +01:00
|
|
|
ifneq ($(FORCE_LAYOUT),)
|
|
|
|
TARGET := $(TARGET)_$(FORCE_LAYOUT)
|
|
|
|
endif
|
|
|
|
|
2019-01-10 17:22:57 +01:00
|
|
|
include quantum/mcu_selection.mk
|
|
|
|
|
|
|
|
ifdef MCU_FAMILY
|
|
|
|
OPT_DEFS += -DQMK_STM32
|
|
|
|
KEYBOARD_PATHS += $(STM32_PATH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Find all the C source files to be compiled in subfolders.
|
2017-10-14 23:32:19 +02:00
|
|
|
KEYBOARD_SRC :=
|
|
|
|
|
|
|
|
KEYBOARD_C_1 := $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).c
|
|
|
|
KEYBOARD_C_2 := $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).c
|
|
|
|
KEYBOARD_C_3 := $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).c
|
|
|
|
KEYBOARD_C_4 := $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).c
|
|
|
|
KEYBOARD_C_5 := $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).c
|
2016-08-08 09:26:23 +02:00
|
|
|
|
2017-10-14 23:32:19 +02:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C_5))","")
|
|
|
|
KEYBOARD_SRC += $(KEYBOARD_C_5)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C_4))","")
|
|
|
|
KEYBOARD_SRC += $(KEYBOARD_C_4)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C_3))","")
|
|
|
|
KEYBOARD_SRC += $(KEYBOARD_C_3)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C_2))","")
|
|
|
|
KEYBOARD_SRC += $(KEYBOARD_C_2)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C_1))","")
|
|
|
|
KEYBOARD_SRC += $(KEYBOARD_C_1)
|
|
|
|
endif
|
|
|
|
|
2018-10-16 20:14:52 +02:00
|
|
|
# Generate KEYBOARD_name_subname for all levels of the keyboard folder
|
|
|
|
KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
|
|
|
|
KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
|
|
|
|
KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
|
|
|
|
KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
|
|
|
|
KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
|
2017-10-14 23:32:19 +02:00
|
|
|
|
2018-10-16 20:14:52 +02:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
|
|
|
|
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
|
|
|
|
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
|
|
|
|
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
|
|
|
|
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
|
|
|
|
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
|
|
|
|
endif
|
2017-11-14 22:11:29 +01:00
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
|
|
|
|
# that the same keymap may be used on multiple keyboards.
|
|
|
|
#
|
|
|
|
# We grab the most top-level include file that we can. That file should
|
|
|
|
# use #ifdef statements to include all the neccesary subfolder includes,
|
|
|
|
# as described here:
|
|
|
|
#
|
|
|
|
# https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
|
|
|
|
#
|
2017-11-14 22:11:29 +01:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
|
|
|
|
QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
|
|
|
|
QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
|
|
|
|
QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
|
|
|
|
QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
|
|
|
|
QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
|
|
|
|
endif
|
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Determine and set parameters based on the keyboard's processor family.
|
|
|
|
# We can assume a ChibiOS target When MCU_FAMILY is defined since it's
|
|
|
|
# not used for LUFA
|
2016-08-15 07:45:36 +02:00
|
|
|
ifdef MCU_FAMILY
|
2018-08-11 20:16:21 +02:00
|
|
|
FIRMWARE_FORMAT?=bin
|
2017-04-12 08:52:40 +02:00
|
|
|
PLATFORM=CHIBIOS
|
2018-08-29 21:07:52 +02:00
|
|
|
else ifdef ARM_ATSAM
|
|
|
|
PLATFORM=ARM_ATSAM
|
|
|
|
FIRMWARE_FORMAT=bin
|
2016-08-15 07:45:36 +02:00
|
|
|
else
|
2017-04-12 08:52:40 +02:00
|
|
|
PLATFORM=AVR
|
2018-08-11 20:16:21 +02:00
|
|
|
FIRMWARE_FORMAT?=hex
|
2016-08-15 07:45:36 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),CHIBIOS)
|
2017-04-12 08:52:40 +02:00
|
|
|
include $(TMK_PATH)/chibios.mk
|
|
|
|
OPT_OS = chibios
|
2017-10-14 23:32:19 +02:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_5)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_5)/boards/$(BOARD)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_4)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_4)/boards/$(BOARD)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_3)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_3)/boards/$(BOARD)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_2)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_2)/boards/$(BOARD)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_1)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH_1)/boards/$(BOARD)/bootloader_defs.h
|
2018-04-04 04:43:40 +02:00
|
|
|
else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(TOP_DIR)/drivers/boards/$(BOARD)/bootloader_defs.h
|
2017-04-12 08:52:40 +02:00
|
|
|
endif
|
2016-08-15 07:45:36 +02:00
|
|
|
endif
|
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Find all of the config.h files and add them to our CONFIG_H define.
|
2017-10-14 23:32:19 +02:00
|
|
|
CONFIG_H :=
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYBOARD_PATH_5)/config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYBOARD_PATH_4)/config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYBOARD_PATH_3)/config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYBOARD_PATH_2)/config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYBOARD_PATH_1)/config.h
|
2016-08-15 07:58:05 +02:00
|
|
|
endif
|
|
|
|
|
2019-04-20 00:25:08 +02:00
|
|
|
POST_CONFIG_H :=
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(KEYBOARD_PATH_1)/post_config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(KEYBOARD_PATH_2)/post_config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(KEYBOARD_PATH_3)/post_config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(KEYBOARD_PATH_4)/post_config.h
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(KEYBOARD_PATH_5)/post_config.h
|
|
|
|
endif
|
|
|
|
|
2017-02-26 06:13:47 +01:00
|
|
|
# Save the defines and includes here, so we don't include any keymap specific ones
|
2016-08-15 07:20:16 +02:00
|
|
|
PROJECT_DEFS := $(OPT_DEFS)
|
2017-10-14 23:32:19 +02:00
|
|
|
PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
|
2016-08-15 07:58:05 +02:00
|
|
|
PROJECT_CONFIG := $(CONFIG_H)
|
2016-08-15 07:20:16 +02:00
|
|
|
|
2018-08-11 20:16:21 +02:00
|
|
|
# Userspace setup and definitions
|
2018-04-21 19:48:30 +02:00
|
|
|
ifeq ("$(USER_NAME)","")
|
|
|
|
USER_NAME := $(KEYMAP)
|
|
|
|
endif
|
|
|
|
USER_PATH := users/$(USER_NAME)
|
|
|
|
|
2017-10-21 23:44:11 +02:00
|
|
|
-include $(USER_PATH)/rules.mk
|
2018-05-22 21:47:28 +02:00
|
|
|
ifneq ("$(wildcard $(USER_PATH)/config.h)","")
|
|
|
|
CONFIG_H += $(USER_PATH)/config.h
|
2018-04-01 06:02:40 +02:00
|
|
|
endif
|
|
|
|
|
2017-10-21 23:44:11 +02:00
|
|
|
|
2016-08-01 08:23:37 +02:00
|
|
|
# Object files directory
|
|
|
|
# To put object files in current directory, use a dot (.), do NOT make
|
|
|
|
# this an empty or blank macro!
|
2016-08-15 07:20:16 +02:00
|
|
|
KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
|
2016-08-01 08:23:37 +02:00
|
|
|
|
|
|
|
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
2017-10-14 23:32:19 +02:00
|
|
|
CONFIG_H += $(KEYMAP_PATH)/config.h
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# # project specific files
|
2017-10-14 23:32:19 +02:00
|
|
|
SRC += $(KEYBOARD_SRC) \
|
2017-04-12 08:52:40 +02:00
|
|
|
$(KEYMAP_C) \
|
2017-06-16 21:14:47 +02:00
|
|
|
$(QUANTUM_SRC)
|
2016-08-01 08:23:37 +02:00
|
|
|
|
|
|
|
# Optimize size but this may cause error "relocation truncated to fit"
|
|
|
|
#EXTRALDFLAGS = -Wl,--relax
|
|
|
|
|
|
|
|
# Search Path
|
|
|
|
VPATH += $(KEYMAP_PATH)
|
2019-05-02 17:01:58 +02:00
|
|
|
VPATH += $(USER_PATH)
|
2017-10-14 23:32:19 +02:00
|
|
|
VPATH += $(KEYBOARD_PATHS)
|
2016-08-27 12:43:12 +02:00
|
|
|
VPATH += $(COMMON_VPATH)
|
2016-08-01 08:23:37 +02:00
|
|
|
|
2017-06-16 21:14:47 +02:00
|
|
|
include common_features.mk
|
2016-11-25 08:15:12 +01:00
|
|
|
include $(TMK_PATH)/protocol.mk
|
2016-08-01 08:23:37 +02:00
|
|
|
include $(TMK_PATH)/common.mk
|
2017-11-28 05:08:21 +01:00
|
|
|
include bootloader.mk
|
2017-06-16 21:14:47 +02:00
|
|
|
|
2019-05-03 15:20:23 +02:00
|
|
|
SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
|
2018-12-15 06:31:56 +01:00
|
|
|
SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
|
2016-08-27 12:43:12 +02:00
|
|
|
SRC += $(TMK_COMMON_SRC)
|
|
|
|
OPT_DEFS += $(TMK_COMMON_DEFS)
|
|
|
|
EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
|
|
|
|
|
2016-08-01 08:23:37 +02:00
|
|
|
ifeq ($(PLATFORM),AVR)
|
2017-01-21 18:30:06 +01:00
|
|
|
ifeq ($(strip $(PROTOCOL)), VUSB)
|
2017-04-12 08:52:40 +02:00
|
|
|
include $(TMK_PATH)/protocol/vusb.mk
|
2017-01-21 18:30:06 +01:00
|
|
|
else
|
2017-04-12 08:52:40 +02:00
|
|
|
include $(TMK_PATH)/protocol/lufa.mk
|
2017-01-21 18:30:06 +01:00
|
|
|
endif
|
2017-04-12 08:52:40 +02:00
|
|
|
include $(TMK_PATH)/avr.mk
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
2018-08-29 21:07:52 +02:00
|
|
|
ifeq ($(PLATFORM),ARM_ATSAM)
|
|
|
|
include $(TMK_PATH)/arm_atsam.mk
|
|
|
|
include $(TMK_PATH)/protocol/arm_atsam.mk
|
|
|
|
endif
|
|
|
|
|
2018-02-08 21:07:46 +01:00
|
|
|
ifeq ($(PLATFORM),CHIBIOS)
|
|
|
|
include $(TMK_PATH)/protocol/chibios.mk
|
|
|
|
endif
|
|
|
|
|
2016-08-01 08:23:37 +02:00
|
|
|
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
2017-04-12 08:52:40 +02:00
|
|
|
VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
|
|
|
|
VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
|
|
|
|
include $(VISUALIZER_PATH)/visualizer.mk
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
2019-04-20 00:25:08 +02:00
|
|
|
CONFIG_H += $(POST_CONFIG_H)
|
2017-11-14 22:11:29 +01:00
|
|
|
ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
|
|
|
|
|
2016-08-15 07:20:16 +02:00
|
|
|
OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
|
|
|
|
$(KEYMAP_OUTPUT)_SRC := $(SRC)
|
2017-08-24 04:29:07 +02:00
|
|
|
$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) $(GFXDEFS) \
|
2017-11-14 22:11:29 +01:00
|
|
|
-DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(QMK_KEYBOARD_H)\" -DQMK_KEYBOARD_CONFIG_H=\"$(KEYBOARD_PATH_1)/config.h\" \
|
2017-08-24 04:29:07 +02:00
|
|
|
-DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\" \
|
2017-10-14 23:32:19 +02:00
|
|
|
-DQMK_SUBPROJECT -DQMK_SUBPROJECT_H -DQMK_SUBPROJECT_CONFIG_H
|
2016-08-27 12:43:12 +02:00
|
|
|
$(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
|
2016-08-15 07:58:05 +02:00
|
|
|
$(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
|
2016-08-28 22:25:39 +02:00
|
|
|
$(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC) $(GFXSRC)
|
|
|
|
$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS) $(GFXDEFS)
|
|
|
|
$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(GFXINC)
|
2017-10-14 23:32:19 +02:00
|
|
|
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
|
2016-08-15 07:20:16 +02:00
|
|
|
|
2016-08-22 08:16:08 +02:00
|
|
|
# Default target.
|
2017-11-28 05:08:21 +01:00
|
|
|
all: build check-size
|
2018-01-28 20:11:28 +01:00
|
|
|
build: elf cpfirmware
|
2019-01-31 03:20:13 +01:00
|
|
|
check-size: build
|
2016-08-15 07:20:16 +02:00
|
|
|
|
2019-02-15 02:52:58 +01:00
|
|
|
include show_options.mk
|
2016-08-01 08:23:37 +02:00
|
|
|
include $(TMK_PATH)/rules.mk
|