2016-08-01 08:23:37 +02:00
|
|
|
ifndef VERBOSE
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
2016-08-08 10:06:47 +02:00
|
|
|
include message.mk
|
|
|
|
|
2016-08-01 08:23:37 +02:00
|
|
|
|
|
|
|
# Directory common source filess exist
|
2016-08-08 09:26:23 +02:00
|
|
|
TOP_DIR = .
|
2016-08-01 08:23:37 +02:00
|
|
|
TMK_DIR = tmk_core
|
|
|
|
TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
|
|
|
|
LIB_PATH = $(TOP_DIR)/lib
|
|
|
|
|
|
|
|
QUANTUM_DIR = quantum
|
|
|
|
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
MASTER ?= left
|
|
|
|
ifdef master
|
|
|
|
MASTER = $(master)
|
|
|
|
endif
|
|
|
|
|
2016-08-08 09:26:23 +02:00
|
|
|
KEYBOARD_PATH := keyboards/$(KEYBOARD)
|
|
|
|
KEYBOARD_C := $(KEYBOARD_PATH)/$(KEYBOARD).c
|
2016-08-01 08:23:37 +02:00
|
|
|
|
2016-08-08 09:26:23 +02:00
|
|
|
ifneq ("$(wildcard $(KEYBOARD_C))","")
|
|
|
|
include $(KEYBOARD_PATH)/rules.mk
|
2016-08-01 08:23:37 +02:00
|
|
|
else
|
2016-08-08 09:26:23 +02:00
|
|
|
$(error "$(KEYBOARD_C)" does not exist)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
SUBPROJECT_PATH := keyboards/$(KEYBOARD)/$(SUBPROJECT)
|
|
|
|
SUBPROJECT_C := $(SUBPROJECT_PATH)/$(SUBPROJECT).c
|
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_C))","")
|
|
|
|
OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
|
|
|
|
include $(SUBPROJECT_PATH)/rules.mk
|
|
|
|
else
|
|
|
|
$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-08-15 07:45:36 +02:00
|
|
|
# We can assume a ChibiOS target When MCU_FAMILY is defined, since it's not used for LUFA
|
|
|
|
ifdef MCU_FAMILY
|
|
|
|
PLATFORM=CHIBIOS
|
|
|
|
else
|
|
|
|
PLATFORM=AVR
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),CHIBIOS)
|
|
|
|
include $(TMK_PATH)/protocol/chibios.mk
|
|
|
|
include $(TMK_PATH)/chibios.mk
|
|
|
|
OPT_OS = chibios
|
2016-08-15 08:07:32 +02:00
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_PATH)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(SUBPROJECT_PATH)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(SUBPROJECT_PATH)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(SUBPROJECT_PATH)/boards/$(BOARD)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH)/bootloader_defs.h
|
|
|
|
else ifneq ("$(wildcard $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h)","")
|
|
|
|
OPT_DEFS += -include $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h
|
|
|
|
endif
|
2016-08-15 07:45:36 +02:00
|
|
|
endif
|
|
|
|
|
2016-08-15 07:58:05 +02:00
|
|
|
CONFIG_H = $(KEYBOARD_PATH)/config.h
|
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
ifneq ("$(wildcard $(SUBPROJECT_C))","")
|
|
|
|
CONFIG_H = $(SUBPROJECT_PATH)/config.h
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-08-15 07:45:36 +02: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)
|
2016-08-15 07:45:36 +02:00
|
|
|
PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(SUBPROJECT_PATH) $(KEYBOARD_PATH)
|
2016-08-15 07:58:05 +02:00
|
|
|
PROJECT_CONFIG := $(CONFIG_H)
|
2016-08-15 07:20:16 +02:00
|
|
|
|
2016-08-08 09:26:23 +02:00
|
|
|
MAIN_KEYMAP_PATH := $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
|
|
|
|
MAIN_KEYMAP_C := $(MAIN_KEYMAP_PATH)/keymap.c
|
|
|
|
SUBPROJ_KEYMAP_PATH := $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
|
|
|
|
SUBPROJ_KEYMAP_C := $(SUBPROJ_KEYMAP_PATH)/keymap.c
|
|
|
|
ifneq ("$(wildcard $(SUBPROJ_KEYMAP_C))","")
|
|
|
|
-include $(SUBPROJ_KEYMAP_PATH)/Makefile
|
|
|
|
KEYMAP_C := $(SUBPROJ_KEYMAP_C)
|
|
|
|
KEYMAP_PATH := $(SUBPROJ_KEYMAP_PATH)
|
|
|
|
else ifneq ("$(wildcard $(MAIN_KEYMAP_C))","")
|
|
|
|
-include $(MAIN_KEYMAP_PATH)/Makefile
|
|
|
|
KEYMAP_C := $(MAIN_KEYMAP_C)
|
|
|
|
KEYMAP_PATH := $(MAIN_KEYMAP_PATH)
|
|
|
|
else
|
|
|
|
$(error "$(MAIN_KEYMAP_C)/keymap.c" does not exist)
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
2016-08-15 07:20:16 +02:00
|
|
|
BUILD_DIR = $(TOP_DIR)/.build
|
|
|
|
|
2016-08-08 09:26:23 +02:00
|
|
|
ifneq ($(SUBPROJECT),)
|
2016-08-01 08:23:37 +02:00
|
|
|
TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP)
|
2016-08-15 07:20:16 +02:00
|
|
|
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD)_$(SUBPROJECT)
|
2016-08-01 08:23:37 +02:00
|
|
|
else
|
|
|
|
TARGET ?= $(KEYBOARD)_$(KEYMAP)
|
2016-08-15 07:20:16 +02:00
|
|
|
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD)
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# 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)","")
|
|
|
|
CONFIG_H = $(KEYMAP_PATH)/config.h
|
|
|
|
endif
|
|
|
|
|
|
|
|
# # project specific files
|
2016-08-08 09:26:23 +02:00
|
|
|
SRC += $(KEYBOARD_C) \
|
|
|
|
$(KEYMAP_C) \
|
2016-08-01 08:23:37 +02:00
|
|
|
$(QUANTUM_DIR)/quantum.c \
|
|
|
|
$(QUANTUM_DIR)/keymap_common.c \
|
|
|
|
$(QUANTUM_DIR)/keycode_config.c \
|
|
|
|
$(QUANTUM_DIR)/process_keycode/process_leader.c
|
|
|
|
|
2016-08-08 09:26:23 +02:00
|
|
|
ifneq ($(SUBPROJECT),)
|
|
|
|
SRC += $(SUBPROJECT_C)
|
2016-08-01 08:23:37 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef CUSTOM_MATRIX
|
|
|
|
SRC += $(QUANTUM_DIR)/matrix.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(MIDI_ENABLE)), yes)
|
|
|
|
OPT_DEFS += -DMIDI_ENABLE
|
|
|
|
SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(AUDIO_ENABLE)), yes)
|
|
|
|
OPT_DEFS += -DAUDIO_ENABLE
|
|
|
|
SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
|
|
|
|
SRC += $(QUANTUM_DIR)/audio/audio.c
|
|
|
|
SRC += $(QUANTUM_DIR)/audio/voices.c
|
|
|
|
SRC += $(QUANTUM_DIR)/audio/luts.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(UNICODE_ENABLE)), yes)
|
|
|
|
OPT_DEFS += -DUNICODE_ENABLE
|
|
|
|
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
|
|
|
OPT_DEFS += -DRGBLIGHT_ENABLE
|
|
|
|
SRC += $(QUANTUM_DIR)/light_ws2812.c
|
|
|
|
SRC += $(QUANTUM_DIR)/rgblight.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
|
|
|
|
OPT_DEFS += -DTAP_DANCE_ENABLE
|
|
|
|
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
|
|
|
|
SERIAL_DIR = $(QUANTUM_DIR)/serial_link
|
|
|
|
SERIAL_PATH = $(QUANTUM_PATH)/serial_link
|
|
|
|
SERIAL_SRC = $(wildcard $(SERIAL_PATH)/protocol/*.c)
|
|
|
|
SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
|
|
|
|
SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
|
|
|
|
OPT_DEFS += -DSERIAL_LINK_ENABLE
|
|
|
|
VAPTH += $(SERIAL_PATH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Optimize size but this may cause error "relocation truncated to fit"
|
|
|
|
#EXTRALDFLAGS = -Wl,--relax
|
|
|
|
|
|
|
|
# Search Path
|
|
|
|
VPATH += $(KEYMAP_PATH)
|
2016-08-08 09:26:23 +02:00
|
|
|
ifneq ($(SUBPROJECT),)
|
2016-08-01 08:23:37 +02:00
|
|
|
VPATH += $(SUBPROJECT_PATH)
|
|
|
|
endif
|
|
|
|
VPATH += $(KEYBOARD_PATH)
|
|
|
|
VPATH += $(TOP_DIR)
|
|
|
|
VPATH += $(TMK_PATH)
|
|
|
|
VPATH += $(QUANTUM_PATH)
|
|
|
|
VPATH += $(QUANTUM_PATH)/keymap_extras
|
|
|
|
VPATH += $(QUANTUM_PATH)/audio
|
|
|
|
VPATH += $(QUANTUM_PATH)/process_keycode
|
|
|
|
|
|
|
|
|
|
|
|
include $(TMK_PATH)/common.mk
|
|
|
|
ifeq ($(PLATFORM),AVR)
|
|
|
|
include $(TMK_PATH)/protocol/lufa.mk
|
|
|
|
include $(TMK_PATH)/avr.mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
|
|
|
VISUALIZER_DIR = $(QUANTUM_DIR)/visualizer
|
|
|
|
VISUALIZER_PATH = $(QUANTUM_PATH)/visualizer
|
|
|
|
include $(VISUALIZER_PATH)/visualizer.mk
|
|
|
|
endif
|
|
|
|
|
2016-08-15 07:20:16 +02:00
|
|
|
|
|
|
|
OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
|
|
|
|
$(KEYMAP_OUTPUT)_SRC := $(SRC)
|
|
|
|
$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
|
2016-08-15 07:45:36 +02:00
|
|
|
$(KEYMAP_OUTPUT)_INC := $(EXTRAINCDIRS) $(VPATH)
|
2016-08-15 07:58:05 +02:00
|
|
|
$(KEYMAP_OUTPUT)_CONFIG := $(CONFIG_H)
|
2016-08-15 07:20:16 +02:00
|
|
|
$(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC)
|
|
|
|
$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
|
2016-08-15 07:45:36 +02:00
|
|
|
$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
|
2016-08-15 07:58:05 +02:00
|
|
|
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
|
2016-08-15 07:20:16 +02:00
|
|
|
|
|
|
|
|
2016-08-01 08:23:37 +02:00
|
|
|
include $(TMK_PATH)/rules.mk
|
|
|
|
|