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
|
|
|
|
|
2021-10-28 02:07:53 +02:00
|
|
|
include paths.mk
|
|
|
|
include $(BUILDDEFS_PATH)/message.mk
|
2016-08-21 12:53:36 +02:00
|
|
|
|
2022-06-29 23:42:23 +02:00
|
|
|
# Helper to add defines with a 'QMK_' prefix
|
|
|
|
define add_qmk_prefix_defs
|
|
|
|
ifdef $1
|
|
|
|
# Need to cater for 'STM32L4xx+'
|
|
|
|
OPT_DEFS += -DQMK_$(2)="$($1)" -DQMK_$(2)_$(shell echo $($1) | sed -e 's@+@Plus@g' -e 's@[^a-zA-Z0-9]@_@g' | tr '[:lower:]' '[:upper:]')
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
2021-03-08 04:10:03 +01:00
|
|
|
# Set the qmk cli to use
|
|
|
|
QMK_BIN ?= qmk
|
|
|
|
|
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)
|
2016-08-21 12:53:36 +02:00
|
|
|
|
2023-03-29 06:55:31 +02:00
|
|
|
ifeq ($(strip $(DUMP_CI_METADATA)),yes)
|
|
|
|
$(info CI Metadata: KEYBOARD=$(KEYBOARD))
|
|
|
|
$(info CI Metadata: KEYMAP=$(KEYMAP))
|
|
|
|
endif
|
|
|
|
|
2016-08-21 12:53:36 +02:00
|
|
|
# Force expansion
|
|
|
|
TARGET := $(TARGET)
|
|
|
|
|
2021-08-18 22:52:41 +02: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!
|
2023-06-21 00:41:49 +02:00
|
|
|
INTERMEDIATE_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
|
2021-08-18 22:52:41 +02:00
|
|
|
|
2018-12-15 06:31:56 +01:00
|
|
|
ifdef SKIP_VERSION
|
|
|
|
OPT_DEFS += -DSKIP_VERSION
|
|
|
|
endif
|
|
|
|
|
2022-01-25 00:54:56 +01:00
|
|
|
# Generate the version.h file
|
2023-01-30 09:47:46 +01:00
|
|
|
VERSION_H_FLAGS :=
|
2022-01-25 00:54:56 +01:00
|
|
|
ifdef SKIP_VERSION
|
2023-01-30 09:47:46 +01:00
|
|
|
VERSION_H_FLAGS += --skip-all
|
2022-01-25 00:54:56 +01:00
|
|
|
endif
|
|
|
|
ifdef SKIP_GIT
|
2023-01-30 09:47:46 +01:00
|
|
|
VERSION_H_FLAGS += --skip-git
|
2022-01-25 00:54:56 +01:00
|
|
|
endif
|
|
|
|
|
2022-02-03 21:36:02 +01:00
|
|
|
# Generate the board's version.h file.
|
2023-06-21 00:41:49 +02:00
|
|
|
$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o $(INTERMEDIATE_OUTPUT)/src/version.h)
|
2022-02-03 21:36:02 +01:00
|
|
|
|
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)
|
|
|
|
|
2024-03-10 06:20:25 +01:00
|
|
|
# Pull in rules from DD keyboard config
|
2023-06-21 00:41:49 +02:00
|
|
|
INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(INTERMEDIATE_OUTPUT)/src/info_rules.mk)
|
2020-12-30 19:27:37 +01:00
|
|
|
include $(INFO_RULES_MK)
|
|
|
|
|
2019-07-15 21:14:27 +02:00
|
|
|
# Check for keymap.json first, so we can regenerate keymap.c
|
2022-02-10 18:45:51 +01:00
|
|
|
include $(BUILDDEFS_PATH)/build_json.mk
|
2019-07-15 21:14:27 +02:00
|
|
|
|
2021-08-29 01:42:57 +02:00
|
|
|
# Pull in keymap level rules.mk
|
2023-11-27 21:53:43 +01:00
|
|
|
ifeq ("$(wildcard $(KEYMAP_PATH))", "")
|
|
|
|
# Look through the possible keymap folders until we find a matching keymap.c
|
|
|
|
ifneq ($(QMK_USERSPACE),)
|
|
|
|
ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.c)","")
|
|
|
|
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/rules.mk
|
|
|
|
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)/keymap.c
|
|
|
|
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_1)
|
|
|
|
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.c)","")
|
|
|
|
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/rules.mk
|
|
|
|
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)/keymap.c
|
|
|
|
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_2)
|
|
|
|
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.c)","")
|
|
|
|
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/rules.mk
|
|
|
|
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)/keymap.c
|
|
|
|
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_3)
|
|
|
|
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.c)","")
|
|
|
|
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/rules.mk
|
|
|
|
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)/keymap.c
|
|
|
|
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_4)
|
|
|
|
else ifneq ("$(wildcard $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.c)","")
|
|
|
|
-include $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/rules.mk
|
|
|
|
KEYMAP_C := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)/keymap.c
|
|
|
|
KEYMAP_PATH := $(QMK_USERSPACE)/$(MAIN_KEYMAP_PATH_5)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(KEYMAP_PATH),)
|
|
|
|
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 ("$(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_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_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_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 ($(LAYOUTS),)
|
|
|
|
# If we haven't found a keymap yet fall back to community layouts
|
|
|
|
include $(BUILDDEFS_PATH)/build_layout.mk
|
|
|
|
else ifeq ("$(wildcard $(KEYMAP_JSON_PATH))", "") # Not finding keymap.c is fine if we found a keymap.json
|
|
|
|
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
|
|
|
|
# this state should never be reached
|
|
|
|
endif
|
|
|
|
endif
|
2019-01-10 17:22:57 +01:00
|
|
|
endif
|
|
|
|
|
2021-08-18 22:52:41 +02:00
|
|
|
# Have we found a keymap.json?
|
|
|
|
ifneq ("$(wildcard $(KEYMAP_JSON))", "")
|
2023-09-25 06:17:50 +02:00
|
|
|
ifneq ("$(wildcard $(KEYMAP_C))", "")
|
|
|
|
$(call WARNING_MESSAGE,Keymap is specified as both keymap.json and keymap.c -- keymap.json file wins.)
|
|
|
|
endif
|
|
|
|
|
|
|
|
KEYMAP_PATH := $(KEYMAP_JSON_PATH)
|
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
KEYMAP_C := $(INTERMEDIATE_OUTPUT)/src/keymap.c
|
|
|
|
KEYMAP_H := $(INTERMEDIATE_OUTPUT)/src/config.h
|
2021-08-18 22:52:41 +02:00
|
|
|
|
|
|
|
# Load the keymap-level rules.mk if exists
|
|
|
|
-include $(KEYMAP_PATH)/rules.mk
|
|
|
|
|
|
|
|
# Load any rules.mk content from keymap.json
|
2023-06-21 00:41:49 +02:00
|
|
|
INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --output $(INTERMEDIATE_OUTPUT)/src/rules.mk $(KEYMAP_JSON))
|
2021-08-18 22:52:41 +02:00
|
|
|
include $(INFO_RULES_MK)
|
|
|
|
|
2021-08-20 11:11:49 +02:00
|
|
|
# Add rules to generate the keymap files - indentation here is important
|
2023-06-21 00:41:49 +02:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON))
|
|
|
|
@$(BUILD_CMD)
|
2021-08-18 22:52:41 +02:00
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/config.h: $(KEYMAP_JSON)
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
2022-10-19 18:43:25 +02:00
|
|
|
$(eval CMD=$(QMK_BIN) generate-config-h --quiet --output $(KEYMAP_H) $(KEYMAP_JSON))
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(BUILD_CMD)
|
2021-08-18 22:52:41 +02:00
|
|
|
|
2024-06-17 22:51:53 +02:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/keymap.h: $(KEYMAP_JSON)
|
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
|
|
|
$(eval CMD=$(QMK_BIN) generate-keymap-h --quiet --output $(INTERMEDIATE_OUTPUT)/src/keymap.h $(KEYMAP_JSON))
|
|
|
|
@$(BUILD_CMD)
|
|
|
|
|
|
|
|
generated-files: $(INTERMEDIATE_OUTPUT)/src/config.h $(INTERMEDIATE_OUTPUT)/src/keymap.c $(INTERMEDIATE_OUTPUT)/src/keymap.h
|
2021-08-18 22:52:41 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2022-04-03 19:22:52 +02:00
|
|
|
include $(BUILDDEFS_PATH)/converters.mk
|
2019-01-10 17:22:57 +01:00
|
|
|
|
2023-01-28 21:40:47 +01:00
|
|
|
MCU_ORIG := $(MCU)
|
|
|
|
include $(wildcard $(PLATFORM_PATH)/*/mcu_selection.mk)
|
2019-01-10 17:22:57 +01:00
|
|
|
|
2024-03-10 06:20:25 +01:00
|
|
|
# PLATFORM_KEY should be detected in DD keyboard config via key 'processor' (or rules.mk 'MCU')
|
2023-01-19 01:27:00 +01:00
|
|
|
ifeq ($(PLATFORM_KEY),)
|
|
|
|
$(call CATASTROPHIC_ERROR,Platform not defined)
|
|
|
|
endif
|
|
|
|
PLATFORM=$(shell echo $(PLATFORM_KEY) | tr '[:lower:]' '[:upper:]')
|
|
|
|
|
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
|
2022-10-05 18:32:07 +02:00
|
|
|
# use #ifdef statements to include all the necessary subfolder includes,
|
2018-08-11 20:16:21 +02:00
|
|
|
# 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)","")
|
2022-09-19 02:35:46 +02:00
|
|
|
FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
|
2017-11-14 22:11:29 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/$(KEYBOARD_FOLDER_2).h)","")
|
2022-09-19 02:35:46 +02:00
|
|
|
FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_2).h
|
2017-11-14 22:11:29 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/$(KEYBOARD_FOLDER_3).h)","")
|
2022-09-19 02:35:46 +02:00
|
|
|
FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_3).h
|
2017-11-14 22:11:29 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/$(KEYBOARD_FOLDER_4).h)","")
|
2022-09-19 02:35:46 +02:00
|
|
|
FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_4).h
|
2017-11-14 22:11:29 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/$(KEYBOARD_FOLDER_5).h)","")
|
2022-09-19 02:35:46 +02:00
|
|
|
FOUND_KEYBOARD_H = $(KEYBOARD_FOLDER_5).h
|
2017-11-14 22:11:29 +01: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
|
|
|
|
|
2024-03-10 06:20:25 +01:00
|
|
|
# Create dependencies on DD keyboard config - structure validated elsewhere
|
|
|
|
DD_CONFIG_FILES :=
|
2020-12-30 19:27:37 +01:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/info.json)","")
|
2024-03-10 06:20:25 +01:00
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_1)/info.json
|
2020-12-30 19:27:37 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/info.json)","")
|
2024-03-10 06:20:25 +01:00
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_2)/info.json
|
2020-12-30 19:27:37 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/info.json)","")
|
2024-03-10 06:20:25 +01:00
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_3)/info.json
|
2020-12-30 19:27:37 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/info.json)","")
|
2024-03-10 06:20:25 +01:00
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_4)/info.json
|
2020-12-30 19:27:37 +01:00
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/info.json)","")
|
2024-03-10 06:20:25 +01:00
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_5)/info.json
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/keyboard.json)","")
|
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_1)/keyboard.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/keyboard.json)","")
|
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_2)/keyboard.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/keyboard.json)","")
|
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_3)/keyboard.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/keyboard.json)","")
|
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_4)/keyboard.json
|
|
|
|
endif
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/keyboard.json)","")
|
|
|
|
DD_CONFIG_FILES += $(KEYBOARD_PATH_5)/keyboard.json
|
2020-12-30 19:27:37 +01:00
|
|
|
endif
|
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
CONFIG_H += $(INTERMEDIATE_OUTPUT)/src/info_config.h
|
|
|
|
KEYBOARD_SRC += $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c
|
2020-12-30 19:27:37 +01:00
|
|
|
|
2024-03-10 06:20:25 +01:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/info_config.h: $(DD_CONFIG_FILES)
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
2023-06-21 00:41:49 +02:00
|
|
|
$(eval CMD=$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(INTERMEDIATE_OUTPUT)/src/info_config.h)
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(BUILD_CMD)
|
2020-12-30 19:27:37 +01:00
|
|
|
|
2024-03-10 06:20:25 +01:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/default_keyboard.c: $(DD_CONFIG_FILES)
|
2022-05-15 23:39:29 +02:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
2023-06-21 00:41:49 +02:00
|
|
|
$(eval CMD=$(QMK_BIN) generate-keyboard-c --quiet --keyboard $(KEYBOARD) --output $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c)
|
2022-05-15 23:39:29 +02:00
|
|
|
@$(BUILD_CMD)
|
|
|
|
|
2024-03-10 06:20:25 +01:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/default_keyboard.h: $(DD_CONFIG_FILES)
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
2023-06-21 00:41:49 +02:00
|
|
|
$(eval CMD=$(QMK_BIN) generate-keyboard-h --quiet --keyboard $(KEYBOARD) --include $(FOUND_KEYBOARD_H) --output $(INTERMEDIATE_OUTPUT)/src/default_keyboard.h)
|
2022-03-17 00:45:06 +01:00
|
|
|
@$(BUILD_CMD)
|
2021-05-01 03:00:04 +02:00
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
generated-files: $(INTERMEDIATE_OUTPUT)/src/info_config.h $(INTERMEDIATE_OUTPUT)/src/default_keyboard.c $(INTERMEDIATE_OUTPUT)/src/default_keyboard.h
|
2021-01-04 21:36:02 +01:00
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
generated-files: $(INTERMEDIATE_OUTPUT)/src/info_deps.d
|
2023-05-15 13:58:12 +02:00
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
$(INTERMEDIATE_OUTPUT)/src/info_deps.d:
|
2023-05-15 13:58:12 +02:00
|
|
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
2023-06-21 00:41:49 +02:00
|
|
|
$(eval CMD=$(QMK_BIN) generate-make-dependencies -kb $(KEYBOARD) -km $(KEYMAP) -o $(INTERMEDIATE_OUTPUT)/src/info_deps.d)
|
2023-05-15 13:58:12 +02:00
|
|
|
@$(BUILD_CMD)
|
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
-include $(INTERMEDIATE_OUTPUT)/src/info_deps.d
|
2023-05-15 13:58:12 +02:00
|
|
|
|
2021-01-04 21:36:02 +01:00
|
|
|
.INTERMEDIATE : generated-files
|
|
|
|
|
2022-08-13 23:13:15 +02:00
|
|
|
# Userspace setup and definitions
|
|
|
|
ifeq ("$(USER_NAME)","")
|
|
|
|
USER_NAME := $(KEYMAP)
|
|
|
|
endif
|
|
|
|
USER_PATH := users/$(USER_NAME)
|
|
|
|
|
2023-11-27 21:53:43 +01:00
|
|
|
# If we have userspace, then add it to the lookup VPATH
|
|
|
|
ifneq ($(wildcard $(QMK_USERSPACE)),)
|
|
|
|
VPATH += $(QMK_USERSPACE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# If the equivalent users directory exists in userspace, use that in preference to anything currently in the main repo
|
|
|
|
ifneq ($(wildcard $(QMK_USERSPACE)/$(USER_PATH)),)
|
|
|
|
USER_PATH := $(QMK_USERSPACE)/$(USER_PATH)
|
|
|
|
endif
|
|
|
|
|
2022-08-13 23:13:15 +02:00
|
|
|
# Pull in user level rules.mk
|
|
|
|
-include $(USER_PATH)/rules.mk
|
2021-01-12 21:50:14 +01:00
|
|
|
ifneq ("$(wildcard $(USER_PATH)/config.h)","")
|
|
|
|
CONFIG_H += $(USER_PATH)/config.h
|
|
|
|
endif
|
2021-01-29 01:04:37 +01:00
|
|
|
ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
|
|
|
|
POST_CONFIG_H += $(USER_PATH)/post_config.h
|
|
|
|
endif
|
2021-01-12 21:50:14 +01:00
|
|
|
|
2021-01-30 22:08:58 +01:00
|
|
|
# Disable features that a keyboard doesn't support
|
2021-10-28 02:07:53 +02:00
|
|
|
-include $(BUILDDEFS_PATH)/disable_features.mk
|
2021-01-30 22:08:58 +01:00
|
|
|
|
2022-10-22 21:39:39 +02:00
|
|
|
ifneq ("$(CONVERTER)","")
|
|
|
|
-include $(CONVERTER)/post_converter.mk
|
|
|
|
endif
|
|
|
|
|
2021-08-29 01:42:57 +02: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 21:50:14 +01:00
|
|
|
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
|
|
|
CONFIG_H += $(KEYMAP_PATH)/config.h
|
|
|
|
endif
|
2021-08-18 22:52:41 +02:00
|
|
|
ifneq ("$(KEYMAP_H)","")
|
|
|
|
CONFIG_H += $(KEYMAP_H)
|
|
|
|
endif
|
2021-01-12 21:50:14 +01:00
|
|
|
|
2023-11-27 21:53:43 +01:00
|
|
|
ifeq ($(KEYMAP_C),)
|
|
|
|
$(call CATASTROPHIC_ERROR,Invalid keymap,Could not find keymap)
|
|
|
|
endif
|
|
|
|
|
2022-06-05 02:26:02 +02:00
|
|
|
OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\"
|
|
|
|
|
2022-07-05 00:58:35 +02:00
|
|
|
# If a keymap or userspace places their keymap array in another file instead, allow for it to be included
|
|
|
|
# !!NOTE!! -- For this to work, the source file cannot be part of $(SRC), so users should not add it via `SRC += <file>`
|
|
|
|
ifneq ($(strip $(INTROSPECTION_KEYMAP_C)),)
|
|
|
|
OPT_DEFS += -DINTROSPECTION_KEYMAP_C=\"$(strip $(INTROSPECTION_KEYMAP_C))\"
|
|
|
|
endif
|
|
|
|
|
2019-07-15 21:14:27 +02:00
|
|
|
# project specific files
|
2021-08-18 01:11:07 +02:00
|
|
|
SRC += \
|
|
|
|
$(KEYBOARD_SRC) \
|
2022-06-05 02:26:02 +02:00
|
|
|
$(QUANTUM_DIR)/keymap_introspection.c \
|
2021-08-18 01:11:07 +02:00
|
|
|
$(QUANTUM_SRC) \
|
|
|
|
$(QUANTUM_DIR)/main.c \
|
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)
|
2023-06-21 00:41:49 +02:00
|
|
|
VPATH += $(INTERMEDIATE_OUTPUT)/src
|
2016-08-01 08:23:37 +02:00
|
|
|
|
2022-02-10 18:45:51 +01:00
|
|
|
include $(BUILDDEFS_PATH)/common_features.mk
|
2021-10-28 02:07:53 +02:00
|
|
|
include $(BUILDDEFS_PATH)/generic_features.mk
|
2016-11-25 08:15:12 +01:00
|
|
|
include $(TMK_PATH)/protocol.mk
|
2021-11-19 19:41:02 +01:00
|
|
|
include $(PLATFORM_PATH)/common.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
|
|
|
|
2022-08-31 16:17:24 +02:00
|
|
|
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/bootloader.mk
|
2021-11-19 19:41:02 +01:00
|
|
|
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
|
|
|
|
-include $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash.mk
|
|
|
|
|
2020-03-22 10:48:17 +01:00
|
|
|
ifneq ($(strip $(PROTOCOL)),)
|
2023-06-22 16:07:28 +02:00
|
|
|
PROTOCOL_KEY = $(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]'))
|
2017-01-21 18:30:06 +01:00
|
|
|
else
|
2023-06-22 16:07:28 +02:00
|
|
|
PROTOCOL_KEY = $(PLATFORM_KEY)
|
2018-08-29 21:07:52 +02:00
|
|
|
endif
|
2023-06-22 16:07:28 +02:00
|
|
|
include $(TMK_PATH)/protocol/$(PROTOCOL_KEY)/$(PROTOCOL_KEY).mk
|
2018-08-29 21:07:52 +02:00
|
|
|
|
2022-06-29 23:42:23 +02:00
|
|
|
# Setup definitions based on the selected MCU
|
|
|
|
$(eval $(call add_qmk_prefix_defs,MCU_ORIG,MCU))
|
|
|
|
$(eval $(call add_qmk_prefix_defs,MCU_ARCH,MCU_ARCH))
|
|
|
|
$(eval $(call add_qmk_prefix_defs,MCU_PORT_NAME,MCU_PORT_NAME))
|
|
|
|
$(eval $(call add_qmk_prefix_defs,MCU_FAMILY,MCU_FAMILY))
|
|
|
|
$(eval $(call add_qmk_prefix_defs,MCU_SERIES,MCU_SERIES))
|
|
|
|
$(eval $(call add_qmk_prefix_defs,BOARD,BOARD))
|
2023-10-22 04:27:31 +02:00
|
|
|
$(eval $(call add_qmk_prefix_defs,OPT,OPT))
|
2022-06-29 23:42:23 +02:00
|
|
|
|
2023-03-23 02:48:25 +01:00
|
|
|
# Control whether intermediate file listings are generated
|
|
|
|
# e.g.:
|
|
|
|
# make handwired/onekey/blackpill_f411:default KEEP_INTERMEDIATES=yes
|
|
|
|
# cat .build/obj_handwired_onekey_blackpill_f411_default/quantum/quantum.i | sed -e 's@^#.*@@g' -e 's@^\s*//.*@@g' -e '/^\s*$/d' | clang-format
|
|
|
|
ifeq ($(strip $(KEEP_INTERMEDIATES)), yes)
|
|
|
|
OPT_DEFS += -save-temps=obj
|
|
|
|
endif
|
|
|
|
|
2023-06-21 00:41:49 +02:00
|
|
|
OUTPUTS := $(INTERMEDIATE_OUTPUT)
|
|
|
|
$(INTERMEDIATE_OUTPUT)_SRC := $(SRC) $(PLATFORM_SRC)
|
2024-04-10 11:03:11 +02:00
|
|
|
$(INTERMEDIATE_OUTPUT)_DEFS := \
|
2023-06-21 00:41:49 +02:00
|
|
|
-DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYBOARD_H=\"$(INTERMEDIATE_OUTPUT)/src/default_keyboard.h\" \
|
|
|
|
-DQMK_KEYMAP=\"$(KEYMAP)\" -DQMK_KEYMAP_H=\"$(KEYMAP).h\" -DQMK_KEYMAP_CONFIG_H=\"$(KEYMAP_PATH)/config.h\" \
|
2024-04-10 11:03:11 +02:00
|
|
|
$(OPT_DEFS)
|
|
|
|
$(INTERMEDIATE_OUTPUT)_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
|
|
|
|
$(INTERMEDIATE_OUTPUT)_CONFIG := $(CONFIG_H) $(POST_CONFIG_H)
|
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
|
2020-11-28 21:02:18 +01:00
|
|
|
|
2021-01-04 21:36:02 +01:00
|
|
|
build: elf cpfirmware
|
2019-01-31 03:20:13 +01:00
|
|
|
check-size: build
|
2020-12-31 07:20:56 +01:00
|
|
|
check-md5: build
|
2019-07-16 07:45:31 +02:00
|
|
|
objs-size: build
|
2016-08-15 07:20:16 +02:00
|
|
|
|
2023-01-04 06:07:13 +01:00
|
|
|
ifneq ($(strip $(TOP_SYMBOLS)),)
|
2022-06-16 01:55:15 +02:00
|
|
|
ifeq ($(strip $(TOP_SYMBOLS)),yes)
|
2023-01-04 06:07:13 +01:00
|
|
|
NUM_TOP_SYMBOLS := 10
|
|
|
|
else
|
|
|
|
NUM_TOP_SYMBOLS := $(strip $(TOP_SYMBOLS))
|
|
|
|
endif
|
2022-06-16 01:55:15 +02:00
|
|
|
all: top-symbols
|
|
|
|
check-size: top-symbols
|
|
|
|
top-symbols: build
|
|
|
|
echo "###########################################"
|
|
|
|
echo "# Highest flash usage:"
|
2023-10-21 12:31:23 +02:00
|
|
|
$(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep ' [RrTt] ' | head -n$(NUM_TOP_SYMBOLS) | sed -e 's#^0000000# #g' -e 's#^000000# #g' -e 's#^00000# #g' -e 's#^0000# #g' -e 's#^000# #g' -e 's#^00# #g' -e 's#^0# #g'
|
2022-06-16 01:55:15 +02:00
|
|
|
echo "###########################################"
|
|
|
|
echo "# Highest RAM usage:"
|
2023-10-21 12:31:23 +02:00
|
|
|
$(NM) -Crtd --size-sort $(BUILD_DIR)/$(TARGET).elf | grep ' [BbCDdGgSs] ' | head -n$(NUM_TOP_SYMBOLS) | sed -e 's#^0000000# #g' -e 's#^000000# #g' -e 's#^00000# #g' -e 's#^0000# #g' -e 's#^000# #g' -e 's#^00# #g' -e 's#^0# #g'
|
2022-06-16 01:55:15 +02:00
|
|
|
echo "###########################################"
|
|
|
|
endif
|
|
|
|
|
2021-10-28 02:07:53 +02:00
|
|
|
include $(BUILDDEFS_PATH)/show_options.mk
|
2022-02-10 18:45:51 +01:00
|
|
|
include $(BUILDDEFS_PATH)/common_rules.mk
|
2021-01-04 21:36:02 +01: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)))))
|