|
|
@ -4,44 +4,9 @@ endif
|
|
|
|
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
|
|
|
|
|
|
|
space := $(subst ,, )
|
|
|
|
|
|
|
|
ESCAPED_ABS_PATH = $(subst $(space),_SPACE_,$(abspath $1))
|
|
|
|
|
|
|
|
starting_makefile := $(call ESCAPED_ABS_PATH,$(firstword $(MAKEFILE_LIST)))
|
|
|
|
|
|
|
|
mkfile_path := $(call ESCAPED_ABS_PATH,$(lastword $(MAKEFILE_LIST))))
|
|
|
|
|
|
|
|
abs_tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifneq (,$(findstring /keyboards/,$(starting_makefile)))
|
|
|
|
|
|
|
|
possible_keyboard:=$(patsubst %/,%,$(dir $(patsubst $(abs_tmk_root)/keyboards/%,%,$(starting_makefile))))
|
|
|
|
|
|
|
|
ifneq (,$(findstring /keymaps/,$(possible_keyboard)))
|
|
|
|
|
|
|
|
KEYMAP_DIR:=$(lastword $(subst /keymaps/, ,$(possible_keyboard)))
|
|
|
|
|
|
|
|
KEYBOARD_DIR:=$(firstword $(subst /keymaps/, ,$(possible_keyboard)))
|
|
|
|
|
|
|
|
ifneq (,$(findstring /,$(KEYBOARD_DIR)))
|
|
|
|
|
|
|
|
# SUBPROJECT_DIR:=$(lastword $(subst /, ,$(KEYBOARD_DIR)))
|
|
|
|
|
|
|
|
# KEYBOARD_DIR:=$(firstword $(subst /, ,$(KEYBOARD_DIR)))
|
|
|
|
|
|
|
|
tmk_root = ../../..
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
tmk_root = ../../../..
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
KEYMAP_DIR:=default
|
|
|
|
|
|
|
|
KEYBOARD_DIR:=$(possible_keyboard)
|
|
|
|
|
|
|
|
ifneq (,$(findstring /,$(KEYBOARD_DIR)))
|
|
|
|
|
|
|
|
# SUBPROJECT_DIR:=$(lastword $(subst /, ,$(KEYBOARD_DIR)))
|
|
|
|
|
|
|
|
# KEYBOARD_DIR:=$(firstword $(subst /, ,$(KEYBOARD_DIR)))
|
|
|
|
|
|
|
|
tmk_root = ../../..
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
tmk_root = ../..
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
tmk_root = .
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
# $(info $(KEYBOARD_DIR))
|
|
|
|
|
|
|
|
# $(info $(KEYMAP_DIR))
|
|
|
|
|
|
|
|
# $(info $(SUBPROJECT_DIR))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Directory common source filess exist
|
|
|
|
# Directory common source filess exist
|
|
|
|
TOP_DIR = $(tmk_root)
|
|
|
|
TOP_DIR = .
|
|
|
|
TMK_DIR = tmk_core
|
|
|
|
TMK_DIR = tmk_core
|
|
|
|
TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
|
|
|
|
TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
|
|
|
|
LIB_PATH = $(TOP_DIR)/lib
|
|
|
|
LIB_PATH = $(TOP_DIR)/lib
|
|
|
@ -50,92 +15,49 @@ QUANTUM_DIR = quantum
|
|
|
|
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
|
|
|
|
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifdef keyboard
|
|
|
|
|
|
|
|
KEYBOARD ?= $(keyboard)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef KEYBOARD_DIR
|
|
|
|
|
|
|
|
KEYBOARD ?= $(KEYBOARD_DIR)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef KEYBOARD
|
|
|
|
|
|
|
|
KEYBOARD=planck
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MASTER ?= left
|
|
|
|
MASTER ?= left
|
|
|
|
ifdef master
|
|
|
|
ifdef master
|
|
|
|
MASTER = $(master)
|
|
|
|
MASTER = $(master)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KEYBOARD_PATH := keyboards/$(KEYBOARD)
|
|
|
|
|
|
|
|
KEYBOARD_C := $(KEYBOARD_PATH)/$(KEYBOARD).c
|
|
|
|
|
|
|
|
|
|
|
|
# converts things to keyboards/subproject
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C))","")
|
|
|
|
ifneq (,$(findstring /,$(KEYBOARD)))
|
|
|
|
include $(KEYBOARD_PATH)/rules.mk
|
|
|
|
TEMP:=$(KEYBOARD)
|
|
|
|
|
|
|
|
KEYBOARD:=$(firstword $(subst /, ,$(TEMP)))
|
|
|
|
|
|
|
|
SUBPROJECT:=$(lastword $(subst /, ,$(TEMP)))
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KEYBOARD_PATH = $(TOP_DIR)/keyboards/$(KEYBOARD)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifdef sub
|
|
|
|
|
|
|
|
SUBPROJECT=$(sub)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef subproject
|
|
|
|
|
|
|
|
SUBPROJECT=$(subproject)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
|
|
|
|
|
|
|
|
KEYBOARD_FILE = keyboards/$(KEYBOARD)/$(KEYBOARD).c
|
|
|
|
|
|
|
|
ifneq ($(call ESCAPED_ABS_PATH,$(KEYBOARD_PATH)/Makefile),$(starting_makefile))
|
|
|
|
|
|
|
|
-include $(KEYBOARD_PATH)/Makefile
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
$(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
|
|
|
|
$(error "$(KEYBOARD_C)" does not exist)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifdef SUBPROJECT_DEFAULT
|
|
|
|
|
|
|
|
SUBPROJECT?=$(SUBPROJECT_DEFAULT)
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
endif
|
|
|
|
SUBPROJECT_PATH := keyboards/$(KEYBOARD)/$(SUBPROJECT)
|
|
|
|
|
|
|
|
SUBPROJECT_C := $(SUBPROJECT_PATH)/$(SUBPROJECT).c
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_C))","")
|
|
|
|
SUBPROJECT_PATH = $(TOP_DIR)/keyboards/$(KEYBOARD)/$(SUBPROJECT)
|
|
|
|
OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
|
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
|
|
|
|
include $(SUBPROJECT_PATH)/rules.mk
|
|
|
|
OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
|
|
|
|
else
|
|
|
|
SUBPROJECT_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/$(SUBPROJECT).c
|
|
|
|
$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
|
|
|
|
ifneq ($(call ESCAPED_ABS_PATH,$(SUBPROJECT_PATH)/Makefile),$(starting_makefile))
|
|
|
|
endif
|
|
|
|
-include $(SUBPROJECT_PATH)/Makefile
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
MAIN_KEYMAP_PATH := $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
|
|
|
|
$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
|
|
|
|
MAIN_KEYMAP_C := $(MAIN_KEYMAP_PATH)/keymap.c
|
|
|
|
endif
|
|
|
|
SUBPROJ_KEYMAP_PATH := $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
|
|
|
|
endif
|
|
|
|
SUBPROJ_KEYMAP_C := $(SUBPROJ_KEYMAP_PATH)/keymap.c
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(SUBPROJ_KEYMAP_C))","")
|
|
|
|
ifdef keymap
|
|
|
|
-include $(SUBPROJ_KEYMAP_PATH)/Makefile
|
|
|
|
KEYMAP ?= $(keymap)
|
|
|
|
KEYMAP_C := $(SUBPROJ_KEYMAP_C)
|
|
|
|
endif
|
|
|
|
KEYMAP_PATH := $(SUBPROJ_KEYMAP_PATH)
|
|
|
|
ifdef KEYMAP_DIR
|
|
|
|
else ifneq ("$(wildcard $(MAIN_KEYMAP_C))","")
|
|
|
|
KEYMAP ?= $(KEYMAP_DIR)
|
|
|
|
-include $(MAIN_KEYMAP_PATH)/Makefile
|
|
|
|
endif
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_C)
|
|
|
|
ifndef KEYMAP
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH)
|
|
|
|
KEYMAP = default
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
|
|
|
|
|
|
|
|
KEYMAP_FILE = keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
|
|
|
|
|
|
|
|
ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
|
|
|
|
|
|
|
|
-include $(KEYMAP_PATH)/Makefile
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/keymap.c)","")
|
|
|
|
$(error "$(MAIN_KEYMAP_C)/keymap.c" does not exist)
|
|
|
|
$(error "$(KEYMAP_PATH)/keymap.c" does not exist)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
KEYMAP_PATH = $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
|
|
|
|
|
|
|
|
KEYMAP_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/keymap.c
|
|
|
|
|
|
|
|
ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
|
|
|
|
|
|
|
|
-include $(KEYMAP_PATH)/Makefile
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP)
|
|
|
|
TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
TARGET ?= $(KEYBOARD)_$(KEYMAP)
|
|
|
|
TARGET ?= $(KEYBOARD)_$(KEYMAP)
|
|
|
@ -149,36 +71,27 @@ BUILD_DIR = $(TOP_DIR)/.build
|
|
|
|
OBJDIR = $(BUILD_DIR)/obj_$(TARGET)
|
|
|
|
OBJDIR = $(BUILD_DIR)/obj_$(TARGET)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
|
|
|
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
|
|
|
CONFIG_H = $(KEYMAP_PATH)/config.h
|
|
|
|
CONFIG_H = $(KEYMAP_PATH)/config.h
|
|
|
|
else
|
|
|
|
else
|
|
|
|
CONFIG_H = $(KEYBOARD_PATH)/config.h
|
|
|
|
CONFIG_H = $(KEYBOARD_PATH)/config.h
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
|
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_C))","")
|
|
|
|
CONFIG_H = $(SUBPROJECT_PATH)/config.h
|
|
|
|
CONFIG_H = $(SUBPROJECT_PATH)/config.h
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# # project specific files
|
|
|
|
# # project specific files
|
|
|
|
SRC += $(KEYBOARD_FILE) \
|
|
|
|
SRC += $(KEYBOARD_C) \
|
|
|
|
$(KEYMAP_FILE) \
|
|
|
|
$(KEYMAP_C) \
|
|
|
|
$(QUANTUM_DIR)/quantum.c \
|
|
|
|
$(QUANTUM_DIR)/quantum.c \
|
|
|
|
$(QUANTUM_DIR)/keymap_common.c \
|
|
|
|
$(QUANTUM_DIR)/keymap_common.c \
|
|
|
|
$(QUANTUM_DIR)/keycode_config.c \
|
|
|
|
$(QUANTUM_DIR)/keycode_config.c \
|
|
|
|
$(QUANTUM_DIR)/process_keycode/process_leader.c
|
|
|
|
$(QUANTUM_DIR)/process_keycode/process_leader.c
|
|
|
|
|
|
|
|
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
SRC += $(SUBPROJECT_FILE)
|
|
|
|
SRC += $(SUBPROJECT_C)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
|
|
|
|
SRC += $(SUBPROJECT_FILE)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
|
|
|
|
SRC += $(SUBPROJECT_FILE)
|
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifndef CUSTOM_MATRIX
|
|
|
|
ifndef CUSTOM_MATRIX
|
|
|
@ -229,7 +142,7 @@ endif
|
|
|
|
|
|
|
|
|
|
|
|
# Search Path
|
|
|
|
# Search Path
|
|
|
|
VPATH += $(KEYMAP_PATH)
|
|
|
|
VPATH += $(KEYMAP_PATH)
|
|
|
|
ifdef SUBPROJECT
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
VPATH += $(SUBPROJECT_PATH)
|
|
|
|
VPATH += $(SUBPROJECT_PATH)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
VPATH += $(KEYBOARD_PATH)
|
|
|
|
VPATH += $(KEYBOARD_PATH)
|
|
|
|