2018-08-11 18:16:21 +00: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 06:23:37 +00:00
|
|
|
ifndef VERBOSE
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
2021-10-28 00:07:53 +00:00
|
|
|
include paths.mk
|
|
|
|
include $(BUILDDEFS_PATH)/message.mk
|
2016-08-21 10:53:36 +00:00
|
|
|
|
2021-03-08 03:10:03 +00:00
|
|
|
# Set the qmk cli to use
|
|
|
|
QMK_BIN ?= qmk
|
|
|
|
|
2018-08-11 18:16:21 +00:00
|
|
|
# Set the filename for the final firmware binary
|
2017-10-14 21:32:19 +00:00
|
|
|
KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
|
|
|
|
TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
|
|
|
|
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
|
2016-08-21 10:53:36 +00:00
|
|
|
|
|
|
|
# Force expansion
|
|
|
|
TARGET := $(TARGET)
|
|
|
|
|
2021-08-18 20:52:41 +00:00
|
|
|
ifneq ($(FORCE_LAYOUT),)
|
|
|
|
TARGET := $(TARGET)_$(FORCE_LAYOUT)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Object files and generated keymap directory
|
|
|
|
# To put object files in current directory, use a dot (.), do NOT make
|
|
|
|
# this an empty or blank macro!
|
|
|
|
KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
|
|
|
|
|
2018-12-15 05:31:56 +00:00
|
|
|
ifdef SKIP_VERSION
|
|
|
|
OPT_DEFS += -DSKIP_VERSION
|
|
|
|
endif
|
|
|
|
|
2022-01-24 23:54:56 +00:00
|
|
|
# Generate the version.h file
|
|
|
|
ifdef SKIP_VERSION
|
|
|
|
VERSION_H_FLAGS := --skip-all
|
|
|
|
endif
|
|
|
|
ifdef SKIP_GIT
|
|
|
|
VERSION_H_FLAGS := --skip-git
|
|
|
|
endif
|
|
|
|
|
2022-02-03 20:36:02 +00:00
|
|
|
# Generate the board's version.h file.
|
|
|
|
$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(KEYMAP_OUTPUT)/src/version.h)
|
|
|
|
|
2018-08-11 18:16:21 +00: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 21:32:19 +00: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 18:16:21 +00:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
|
2017-10-14 21:32:19 +00:00
|
|
|
KEYBOARD_PATHS += $(KEYBOARD_PATH_5)
|
2018-08-11 18:16:21 +00: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 16:22:57 +00:00
|
|
|
|
2018-08-11 18:16:21 +00:00
|
|
|
# Pull in rules.mk files from all our subfolders
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
|
2017-10-14 21:32:19 +00: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 07:26:23 +00:00
|
|
|
endif
|
2017-10-14 21:32:19 +00: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 16:22:57 +00: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)
|
|
|
|
|
2020-12-30 18:27:37 +00:00
|
|
|
# Pull in rules from info.json
|
2021-08-18 20:52:41 +00:00
|
|
|
INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_rules.mk)
|
2020-12-30 18:27:37 +00:00
|
|
|
include $(INFO_RULES_MK)
|
|
|
|
|
2019-07-15 19:14:27 +00:00
|
|
|
# Check for keymap.json first, so we can regenerate keymap.c
|
2022-02-10 17:45:51 +00:00
|
|
|
include $(BUILDDEFS_PATH)/build_json.mk
|
2019-07-15 19:14:27 +00:00
|
|
|
|
2021-08-28 23:42:57 +00:00
|
|
|
# Pull in keymap level rules.mk
|
2019-07-15 19:14:27 +00:00
|
|
|
ifeq ("$(wildcard $(KEYMAP_PATH))", "")
|
|
|
|
# Look through the possible keymap folders until we find a matching keymap.c
|
|
|
|
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),)
|
|
|
|
# If we haven't found a keymap yet fall back to community layouts
|
2022-02-10 17:45:51 +00:00
|
|
|
include $(BUILDDEFS_PATH)/build_layout.mk
|
2019-07-15 19:14:27 +00:00
|
|
|
else
|
2022-02-05 01:32:31 +00:00
|
|
|
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
|
2019-07-15 19:14:27 +00:00
|
|
|
# this state should never be reached
|
|
|
|
endif
|
2019-01-10 16:22:57 +00:00
|
|
|
endif
|
|
|
|
|
2021-08-18 20:52:41 +00:00
|
|
|
# Have we found a keymap.json?
|
|
|
|
ifneq ("$(wildcard $(KEYMAP_JSON))", "")
|
2021-08-20 09:11:49 +00:00
|
|
|
KEYMAP_C := $(KEYMAP_OUTPUT)/src/keymap.c
|
|
|
|
KEYMAP_H := $(KEYMAP_OUTPUT)/src/config.h
|
2021-08-18 20:52:41 +00:00
|
|
|
|
|
|
|
# Load the keymap-level rules.mk if exists
|
|
|
|
-include $(KEYMAP_PATH)/rules.mk
|
|
|
|
|
|
|
|
# Load any rules.mk content from keymap.json
|
2021-08-20 09:11:49 +00:00
|
|
|
INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_OUTPUT)/src/rules.mk)
|
2021-08-18 20:52:41 +00:00
|
|
|
include $(INFO_RULES_MK)
|
|
|
|
|
2021-08-20 09:11:49 +00:00
|
|
|
# Add rules to generate the keymap files - indentation here is important
|
|
|
|
$(KEYMAP_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
|
2022-02-13 22:46:17 +00:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON))
|
|
|
|
@$(BUILD_CMD)
|
2021-08-18 20:52:41 +00:00
|
|
|
|
2021-08-20 09:11:49 +00:00
|
|
|
$(KEYMAP_OUTPUT)/src/config.h: $(KEYMAP_JSON)
|
2022-02-13 22:46:17 +00:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_H))
|
|
|
|
@$(BUILD_CMD)
|
2021-08-18 20:52:41 +00:00
|
|
|
|
2021-08-20 09:11:49 +00:00
|
|
|
generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
|
2021-08-18 20:52:41 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2019-01-10 16:22:57 +00:00
|
|
|
ifeq ($(strip $(CTPC)), yes)
|
2022-02-03 20:36:02 +00:00
|
|
|
CONVERT_TO_PROTON_C=yes
|
2019-01-10 16:22:57 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
|
2021-08-17 23:04:15 +00:00
|
|
|
include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk
|
2019-01-10 16:22:57 +00:00
|
|
|
endif
|
|
|
|
|
2021-10-28 00:07:53 +00:00
|
|
|
include $(BUILDDEFS_PATH)/mcu_selection.mk
|
2019-01-10 16:22:57 +00:00
|
|
|
|
2018-08-11 18:16:21 +00:00
|
|
|
# Find all the C source files to be compiled in subfolders.
|
2017-10-14 21:32:19 +00: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 07:26:23 +00:00
|
|
|
|
2017-10-14 21:32:19 +00: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 18:14:52 +00: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 21:32:19 +00:00
|
|
|
|
2018-10-16 18:14:52 +00: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 21:11:29 +00:00
|
|
|
|
2018-08-11 18:16:21 +00: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
|
|
|
|
#
|
2021-05-01 01:00:04 +00:00
|
|
|
QMK_KEYBOARD_H = $(KEYBOARD_OUTPUT)/src/default_keyboard.h
|
2017-11-14 21:11:29 +00: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 18:16:21 +00: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 05:45:36 +00:00
|
|
|
ifdef MCU_FAMILY
|
2017-04-12 06:52:40 +00:00
|
|
|
PLATFORM=CHIBIOS
|
2020-03-21 05:20:04 +00:00
|
|
|
PLATFORM_KEY=chibios
|
|
|
|
FIRMWARE_FORMAT?=bin
|
2021-07-01 22:24:08 +00:00
|
|
|
OPT_DEFS += -DMCU_$(MCU_FAMILY)
|
2018-08-29 19:07:52 +00:00
|
|
|
else ifdef ARM_ATSAM
|
|
|
|
PLATFORM=ARM_ATSAM
|
2020-03-21 05:20:04 +00:00
|
|
|
PLATFORM_KEY=arm_atsam
|
2018-08-29 19:07:52 +00:00
|
|
|
FIRMWARE_FORMAT=bin
|
2016-08-15 05:45:36 +00:00
|
|
|
else
|
2017-04-12 06:52:40 +00:00
|
|
|
PLATFORM=AVR
|
2020-03-21 05:20:04 +00:00
|
|
|
PLATFORM_KEY=avr
|
2018-08-11 18:16:21 +00:00
|
|
|
FIRMWARE_FORMAT?=hex
|
2016-08-15 05:45:36 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-11 18:16:21 +00:00
|
|
|
# Find all of the config.h files and add them to our CONFIG_H define.
|
2017-10-14 21:32:19 +00: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 05:58:05 +00:00
|
|
|
endif
|
|
|
|
|
2019-04-19 22:25:08 +00: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
|
|
|
|
|
2020-12-30 18:27:37 +00:00
|
|
|
# Pull in stuff from info.json
|
|
|
|
INFO_JSON_FILES :=
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/info.json)","")
|
|
|
|
INFO_JSON_FILES += $(KEYBOARD_PATH_1)/info.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/info.json)","")
|
|
|
|
INFO_JSON_FILES += $(KEYBOARD_PATH_2)/info.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/info.json)","")
|
|
|
|
INFO_JSON_FILES += $(KEYBOARD_PATH_3)/info.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/info.json)","")
|
|
|
|
INFO_JSON_FILES += $(KEYBOARD_PATH_4)/info.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/info.json)","")
|
|
|
|
INFO_JSON_FILES += $(KEYBOARD_PATH_5)/info.json
|
|
|
|
endif
|
|
|
|
|
|
|
|
CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
|
|
|
|
|
|
|
|
$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
|
2022-02-13 22:46:17 +00:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h)
|
|
|
|
@$(BUILD_CMD)
|
2020-12-30 18:27:37 +00:00
|
|
|
|
2021-05-01 01:00:04 +00:00
|
|
|
$(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES)
|
2022-02-13 22:46:17 +00:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h)
|
|
|
|
@$(BUILD_CMD)
|
2021-05-01 01:00:04 +00:00
|
|
|
|
2020-12-30 18:27:37 +00:00
|
|
|
$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
|
2022-02-13 22:46:17 +00:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h)
|
|
|
|
@$(BUILD_CMD)
|
2020-12-30 18:27:37 +00:00
|
|
|
|
2021-05-01 01:00:04 +00:00
|
|
|
generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.h $(KEYBOARD_OUTPUT)/src/layouts.h
|
2021-01-04 20:36:02 +00:00
|
|
|
|
|
|
|
.INTERMEDIATE : generated-files
|
|
|
|
|
2021-01-12 20:50:14 +00:00
|
|
|
# Userspace setup and definitions
|
|
|
|
ifeq ("$(USER_NAME)","")
|
|
|
|
USER_NAME := $(KEYMAP)
|
|
|
|
endif
|
|
|
|
USER_PATH := users/$(USER_NAME)
|
|
|
|
|
2021-08-28 23:42:57 +00:00
|
|
|
# Pull in user level rules.mk
|
2021-01-12 20:50:14 +00:00
|
|
|
-include $(USER_PATH)/rules.mk
|
|
|
|
ifneq ("$(wildcard $(USER_PATH)/config.h)","")
|
|
|
|
CONFIG_H += $(USER_PATH)/config.h
|
|
|
|
endif
|
2021-01-29 00:04:37 +00:00
|
|
|
ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(USER_PATH)/post_config.h
|
|
|
|
endif
|
2021-01-12 20:50:14 +00:00
|
|
|
|
2021-01-30 21:08:58 +00:00
|
|
|
# Disable features that a keyboard doesn't support
|
2021-10-28 00:07:53 +00:00
|
|
|
-include $(BUILDDEFS_PATH)/disable_features.mk
|
2021-01-30 21:08:58 +00:00
|
|
|
|
2021-08-28 23:42:57 +00:00
|
|
|
# Pull in post_rules.mk files from all our subfolders
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_1)/post_rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/post_rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_2)/post_rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/post_rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_3)/post_rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/post_rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_4)/post_rules.mk
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/post_rules.mk)","")
|
|
|
|
include $(KEYBOARD_PATH_5)/post_rules.mk
|
|
|
|
endif
|
|
|
|
|
2021-01-12 20:50:14 +00:00
|
|
|
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYMAP_PATH)/config.h
|
|
|
|
endif
|
2021-08-18 20:52:41 +00:00
|
|
|
ifneq ("$(KEYMAP_H)","")
|
|
|
|
CONFIG_H += $(KEYMAP_H)
|
|
|
|
endif
|
2021-01-12 20:50:14 +00:00
|
|
|
|
2019-07-15 19:14:27 +00:00
|
|
|
# project specific files
|
2021-08-17 23:11:07 +00:00
|
|
|
SRC += \
|
|
|
|
$(KEYBOARD_SRC) \
|
2017-04-12 06:52:40 +00:00
|
|
|
$(KEYMAP_C) \
|
2021-08-17 23:11:07 +00:00
|
|
|
$(QUANTUM_SRC) \
|
|
|
|
$(QUANTUM_DIR)/main.c \
|
2016-08-01 06:23:37 +00:00
|
|
|
|
|
|
|
# Optimize size but this may cause error "relocation truncated to fit"
|
|
|
|
#EXTRALDFLAGS = -Wl,--relax
|
|
|
|
|
|
|
|
# Search Path
|
|
|
|
VPATH += $(KEYMAP_PATH)
|
2019-05-02 15:01:58 +00:00
|
|
|
VPATH += $(USER_PATH)
|
2017-10-14 21:32:19 +00:00
|
|
|
VPATH += $(KEYBOARD_PATHS)
|
2016-08-27 10:43:12 +00:00
|
|
|
VPATH += $(COMMON_VPATH)
|
2022-02-03 20:36:02 +00:00
|
|
|
VPATH += $(KEYBOARD_OUTPUT)/src
|
2022-02-02 04:30:22 +00:00
|
|
|
VPATH += $(KEYMAP_OUTPUT)/src
|
2016-08-01 06:23:37 +00:00
|
|
|
|
2022-02-10 17:45:51 +00:00
|
|
|
include $(BUILDDEFS_PATH)/common_features.mk
|
2021-10-28 00:07:53 +00:00
|
|
|
include $(BUILDDEFS_PATH)/generic_features.mk
|
2016-11-25 07:15:12 +00:00
|
|
|
include $(TMK_PATH)/protocol.mk
|
2021-11-19 18:41:02 +00:00
|
|
|
include $(PLATFORM_PATH)/common.mk
|
2021-10-28 00:07:53 +00:00
|
|
|
include $(BUILDDEFS_PATH)/bootloader.mk
|
2017-06-16 19:14:47 +00:00
|
|
|
|
2019-05-03 13:20:23 +00:00
|
|
|
SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
|
2018-12-15 05:31:56 +00:00
|
|
|
SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
|
2016-08-27 10:43:12 +00:00
|
|
|
SRC += $(TMK_COMMON_SRC)
|
|
|
|
OPT_DEFS += $(TMK_COMMON_DEFS)
|
|
|
|
EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
|
|
|
|
|
2020-11-28 20:02:18 +00:00
|
|
|
SKIP_COMPILE := no
|
|
|
|
ifneq ($(REQUIRE_PLATFORM_KEY),)
|
|
|
|
ifneq ($(REQUIRE_PLATFORM_KEY),$(PLATFORM_KEY))
|
|
|
|
SKIP_COMPILE := yes
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-11-19 18:41:02 +00:00
|
|
|
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
|
|
|
|
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
|
|
|
|
|
2020-03-22 09:48:17 +00:00
|
|
|
ifneq ($(strip $(PROTOCOL)),)
|
|
|
|
include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
|
2017-01-21 17:30:06 +00:00
|
|
|
else
|
2020-03-22 09:48:17 +00:00
|
|
|
include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk
|
2018-08-29 19:07:52 +00:00
|
|
|
endif
|
|
|
|
|
2020-03-22 09:48:17 +00:00
|
|
|
# TODO: remove this bodge?
|
|
|
|
PROJECT_DEFS := $(OPT_DEFS)
|
|
|
|
PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
|
|
|
|
PROJECT_CONFIG := $(CONFIG_H)
|
2018-02-08 20:07:46 +00:00
|
|
|
|
2019-04-19 22:25:08 +00:00
|
|
|
CONFIG_H += $(POST_CONFIG_H)
|
2017-11-14 21:11:29 +00:00
|
|
|
ALL_CONFIGS := $(PROJECT_CONFIG) $(CONFIG_H)
|
|
|
|
|
2016-08-15 05:20:16 +00:00
|
|
|
OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
|
|
|
|
$(KEYMAP_OUTPUT)_SRC := $(SRC)
|
2021-10-20 20:04:23 +00:00
|
|
|
$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) \
|
2021-01-22 19:32:10 +00:00
|
|
|
-DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(QMK_KEYBOARD_H)\" \
|
2022-01-20 23:19:50 +00:00
|
|
|
-DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\"
|
2016-08-27 10:43:12 +00:00
|
|
|
$(KEYMAP_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS)
|
2016-08-15 05:58:05 +00:00
|
|
|
$(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
|
2021-10-20 20:04:23 +00:00
|
|
|
$(KEYBOARD_OUTPUT)_SRC := $(PLATFORM_SRC)
|
|
|
|
$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
|
|
|
|
$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
|
2017-10-14 21:32:19 +00:00
|
|
|
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
|
2016-08-15 05:20:16 +00:00
|
|
|
|
2016-08-22 06:16:08 +00:00
|
|
|
# Default target.
|
2020-11-28 20:02:18 +00:00
|
|
|
ifeq ($(SKIP_COMPILE),no)
|
2017-11-28 04:08:21 +00:00
|
|
|
all: build check-size
|
2020-11-28 20:02:18 +00:00
|
|
|
else
|
|
|
|
all:
|
|
|
|
echo "skipped" >&2
|
|
|
|
endif
|
|
|
|
|
2021-01-04 20:36:02 +00:00
|
|
|
build: elf cpfirmware
|
2019-01-31 02:20:13 +00:00
|
|
|
check-size: build
|
2020-12-31 06:20:56 +00:00
|
|
|
check-md5: build
|
2019-07-16 05:45:31 +00:00
|
|
|
objs-size: build
|
2016-08-15 05:20:16 +00:00
|
|
|
|
2021-10-28 00:07:53 +00:00
|
|
|
include $(BUILDDEFS_PATH)/show_options.mk
|
2022-02-10 17:45:51 +00:00
|
|
|
include $(BUILDDEFS_PATH)/common_rules.mk
|
2021-01-04 20:36:02 +00:00
|
|
|
|
|
|
|
# Ensure we have generated files available for each of the objects
|
|
|
|
define GEN_FILES
|
|
|
|
$1: generated-files
|
|
|
|
endef
|
|
|
|
$(foreach O,$(OBJ),$(eval $(call GEN_FILES,$(patsubst %.a,%.o,$(O)))))
|