]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Split common.mk into common.mk and common_features.mk
authorFred Sundvik <fsundvik@gmail.com>
Fri, 16 Jun 2017 19:14:47 +0000 (22:14 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 18 Jun 2017 18:22:22 +0000 (21:22 +0300)
To support including keyboard/keymap specific rules before it

build_full_test.mk
build_keyboard.mk
build_test.mk
common.mk
common_features.mk [new file with mode: 0644]
tests/basic/rules.mk

index 8b04cc3a4f960e3152d6bbac45be9e7a0f2fbd7a..a4fc8d8201d19d55d40109eb949ea2cb83c8adcc 100644 (file)
@@ -18,6 +18,6 @@ include tests/$(TEST)/rules.mk
 
 TEST_PATH=tests/$(TEST)
 
-$(TEST)_SRC=$(TEST_PATH)/test.c $(TMK_COMMON_SRC)
+$(TEST)_SRC=$(TEST_PATH)/test.c $(TMK_COMMON_SRC) $(QUANTUM_SRC)
 $(TEST)_DEFS=$(TMK_COMMON_DEFS)
 $(TEST)_CONFIG=$(TEST_PATH)/config.h
index f13d5b6d69c51454f5792911db2eda4e53367ed0..3ec389ac9f5afc296070579642d6952421b03a8b 100644 (file)
@@ -31,8 +31,6 @@ $(error MASTER does not have a valid value(left/right))
     endif
 endif
 
-
-
 KEYBOARD_PATH := keyboards/$(KEYBOARD)
 KEYBOARD_C := $(KEYBOARD_PATH)/$(KEYBOARD).c
 
@@ -42,7 +40,6 @@ else
     $(error "$(KEYBOARD_C)" does not exist)
 endif
 
-
 ifneq ($(SUBPROJECT),)
     SUBPROJECT_PATH := keyboards/$(KEYBOARD)/$(SUBPROJECT)
     SUBPROJECT_C := $(SUBPROJECT_PATH)/$(SUBPROJECT).c
@@ -118,19 +115,12 @@ endif
 # # project specific files
 SRC += $(KEYBOARD_C) \
     $(KEYMAP_C) \
-    $(QUANTUM_DIR)/quantum.c \
-    $(QUANTUM_DIR)/keymap_common.c \
-    $(QUANTUM_DIR)/keycode_config.c \
-    $(QUANTUM_DIR)/process_keycode/process_leader.c
+    $(QUANTUM_SRC)
 
 ifneq ($(SUBPROJECT),)
     SRC += $(SUBPROJECT_C)
 endif
 
-ifndef CUSTOM_MATRIX
-    SRC += $(QUANTUM_DIR)/matrix.c
-endif
-
 # Optimize size but this may cause error "relocation truncated to fit"
 #EXTRALDFLAGS = -Wl,--relax
 
@@ -142,9 +132,10 @@ endif
 VPATH += $(KEYBOARD_PATH)
 VPATH += $(COMMON_VPATH)
 
+include common_features.mk
 include $(TMK_PATH)/protocol.mk
-
 include $(TMK_PATH)/common.mk
+
 SRC += $(TMK_COMMON_SRC)
 OPT_DEFS += $(TMK_COMMON_DEFS)
 EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
index 609b094affd151ca4f546e376944d02e41dd037c..cac2cba509268b80fbc197947f0f38f3a341f3d2 100644 (file)
@@ -42,6 +42,11 @@ all: elf
 VPATH += $(COMMON_VPATH)
 PLATFORM:=TEST
 
+ifneq ($(filter $(FULL_TESTS),$(TEST)),)
+include tests/$(TEST)/rules.mk
+endif
+
+include common_features.mk
 include $(TMK_PATH)/common.mk
 include $(QUANTUM_PATH)/serial_link/tests/rules.mk
 ifneq ($(filter $(FULL_TESTS),$(TEST)),)
index 51e4283ba74e874e9dabcd139498f53c6185867a..70f7ae099541968a497042856891d3e21a2dae35 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -11,12 +11,6 @@ QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
 
 BUILD_DIR := $(TOP_DIR)/.build
 
-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)
-SERIAL_DEFS += -DSERIAL_LINK_ENABLE
-
 COMMON_VPATH := $(TOP_DIR)
 COMMON_VPATH += $(TMK_PATH)
 COMMON_VPATH += $(QUANTUM_PATH)
@@ -25,125 +19,3 @@ COMMON_VPATH += $(QUANTUM_PATH)/audio
 COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
 COMMON_VPATH += $(QUANTUM_PATH)/api
 COMMON_VPATH += $(SERIAL_PATH)
-
-ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
-    OPT_DEFS += -DAPI_SYSEX_ENABLE
-    SRC += $(QUANTUM_DIR)/api/api_sysex.c
-    OPT_DEFS += -DAPI_ENABLE
-    SRC += $(QUANTUM_DIR)/api.c
-    MIDI_ENABLE=yes
-endif
-
-MUSIC_ENABLE := 0
-
-ifeq ($(strip $(AUDIO_ENABLE)), yes)
-    OPT_DEFS += -DAUDIO_ENABLE
-    MUSIC_ENABLE := 1
-    SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
-    SRC += $(QUANTUM_DIR)/audio/audio.c
-    SRC += $(QUANTUM_DIR)/audio/voices.c
-    SRC += $(QUANTUM_DIR)/audio/luts.c
-endif
-
-ifeq ($(strip $(MIDI_ENABLE)), yes)
-    OPT_DEFS += -DMIDI_ENABLE
-    MUSIC_ENABLE := 1
-    SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
-endif
-
-ifeq ($(MUSIC_ENABLE), 1)
-    SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
-endif
-
-ifeq ($(strip $(COMBO_ENABLE)), yes)
-    OPT_DEFS += -DCOMBO_ENABLE
-    SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
-endif
-
-ifeq ($(strip $(VIRTSER_ENABLE)), yes)
-    OPT_DEFS += -DVIRTSER_ENABLE
-endif
-
-ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
-    OPT_DEFS += -DFAUXCLICKY_ENABLE
-    SRC += $(QUANTUM_DIR)/fauxclicky.c
-endif
-
-ifeq ($(strip $(UCIS_ENABLE)), yes)
-    OPT_DEFS += -DUCIS_ENABLE
-    UNICODE_COMMON = yes
-    SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
-endif
-
-ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
-    OPT_DEFS += -DUNICODEMAP_ENABLE
-    UNICODE_COMMON = yes
-    SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
-endif
-
-ifeq ($(strip $(UNICODE_ENABLE)), yes)
-    OPT_DEFS += -DUNICODE_ENABLE
-    UNICODE_COMMON = yes
-    SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
-endif
-
-ifeq ($(strip $(UNICODE_COMMON)), yes)
-    SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
-endif
-
-ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
-    OPT_DEFS += -DRGBLIGHT_ENABLE
-    SRC += $(QUANTUM_DIR)/light_ws2812.c
-    SRC += $(QUANTUM_DIR)/rgblight.c
-    CIE1931_CURVE = yes
-    LED_BREATHING_TABLE = yes
-endif
-
-ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
-    OPT_DEFS += -DTAP_DANCE_ENABLE
-    SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
-endif
-
-ifeq ($(strip $(PRINTING_ENABLE)), yes)
-    OPT_DEFS += -DPRINTING_ENABLE
-    SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
-    SRC += $(TMK_DIR)/protocol/serial_uart.c
-endif
-
-ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
-    SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
-    OPT_DEFS += $(SERIAL_DEFS)
-    VAPTH += $(SERIAL_PATH)
-endif
-
-ifneq ($(strip $(VARIABLE_TRACE)),)
-    SRC += $(QUANTUM_DIR)/variable_trace.c
-    OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
-ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
-    OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
-endif
-endif
-
-ifeq ($(strip $(LCD_ENABLE)), yes)
-    CIE1931_CURVE = yes
-endif
-
-ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
-    ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
-        CIE1931_CURVE = yes
-    endif
-endif
-
-ifeq ($(strip $(CIE1931_CURVE)), yes)
-    OPT_DEFS += -DUSE_CIE1931_CURVE
-    LED_TABLES = yes
-endif
-
-ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
-    OPT_DEFS += -DUSE_LED_BREATHING_TABLE
-    LED_TABLES = yes
-endif
-
-ifeq ($(strip $(LED_TABLES)), yes)
-    SRC += $(QUANTUM_DIR)/led_tables.c
-endif
diff --git a/common_features.mk b/common_features.mk
new file mode 100644 (file)
index 0000000..a8a52af
--- /dev/null
@@ -0,0 +1,152 @@
+# Copyright 2017 Fred Sundvik
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+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)
+SERIAL_DEFS += -DSERIAL_LINK_ENABLE
+
+ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
+    OPT_DEFS += -DAPI_SYSEX_ENABLE
+    SRC += $(QUANTUM_DIR)/api/api_sysex.c
+    OPT_DEFS += -DAPI_ENABLE
+    SRC += $(QUANTUM_DIR)/api.c
+    MIDI_ENABLE=yes
+endif
+
+MUSIC_ENABLE := 0
+
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
+    OPT_DEFS += -DAUDIO_ENABLE
+    MUSIC_ENABLE := 1
+    SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
+    SRC += $(QUANTUM_DIR)/audio/audio.c
+    SRC += $(QUANTUM_DIR)/audio/voices.c
+    SRC += $(QUANTUM_DIR)/audio/luts.c
+endif
+
+ifeq ($(strip $(MIDI_ENABLE)), yes)
+    OPT_DEFS += -DMIDI_ENABLE
+    MUSIC_ENABLE := 1
+    SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
+endif
+
+ifeq ($(MUSIC_ENABLE), 1)
+    SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
+endif
+
+ifeq ($(strip $(COMBO_ENABLE)), yes)
+    OPT_DEFS += -DCOMBO_ENABLE
+    SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
+endif
+
+ifeq ($(strip $(VIRTSER_ENABLE)), yes)
+    OPT_DEFS += -DVIRTSER_ENABLE
+endif
+
+ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
+    OPT_DEFS += -DFAUXCLICKY_ENABLE
+    SRC += $(QUANTUM_DIR)/fauxclicky.c
+endif
+
+ifeq ($(strip $(UCIS_ENABLE)), yes)
+    OPT_DEFS += -DUCIS_ENABLE
+    UNICODE_COMMON = yes
+    SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
+endif
+
+ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
+    OPT_DEFS += -DUNICODEMAP_ENABLE
+    UNICODE_COMMON = yes
+    SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
+endif
+
+ifeq ($(strip $(UNICODE_ENABLE)), yes)
+    OPT_DEFS += -DUNICODE_ENABLE
+    UNICODE_COMMON = yes
+    SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
+endif
+
+ifeq ($(strip $(UNICODE_COMMON)), yes)
+    SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
+endif
+
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
+    OPT_DEFS += -DRGBLIGHT_ENABLE
+    SRC += $(QUANTUM_DIR)/light_ws2812.c
+    SRC += $(QUANTUM_DIR)/rgblight.c
+    CIE1931_CURVE = yes
+    LED_BREATHING_TABLE = yes
+endif
+
+ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
+    OPT_DEFS += -DTAP_DANCE_ENABLE
+    SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
+endif
+
+ifeq ($(strip $(PRINTING_ENABLE)), yes)
+    OPT_DEFS += -DPRINTING_ENABLE
+    SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
+    SRC += $(TMK_DIR)/protocol/serial_uart.c
+endif
+
+ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
+    SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
+    OPT_DEFS += $(SERIAL_DEFS)
+    VAPTH += $(SERIAL_PATH)
+endif
+
+ifneq ($(strip $(VARIABLE_TRACE)),)
+    SRC += $(QUANTUM_DIR)/variable_trace.c
+    OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
+ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
+    OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
+endif
+endif
+
+ifeq ($(strip $(LCD_ENABLE)), yes)
+    CIE1931_CURVE = yes
+endif
+
+ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
+    ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
+        CIE1931_CURVE = yes
+    endif
+endif
+
+ifeq ($(strip $(CIE1931_CURVE)), yes)
+    OPT_DEFS += -DUSE_CIE1931_CURVE
+    LED_TABLES = yes
+endif
+
+ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
+    OPT_DEFS += -DUSE_LED_BREATHING_TABLE
+    LED_TABLES = yes
+endif
+
+ifeq ($(strip $(LED_TABLES)), yes)
+    SRC += $(QUANTUM_DIR)/led_tables.c
+endif
+
+QUANTUM_SRC:= \
+    $(QUANTUM_DIR)/quantum.c \
+    $(QUANTUM_DIR)/keymap_common.c \
+    $(QUANTUM_DIR)/keycode_config.c \
+    $(QUANTUM_DIR)/process_keycode/process_leader.c
+
+ifndef CUSTOM_MATRIX
+    QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
+endif
\ No newline at end of file
index 0405b9d0f8a67379ba327db430aa2dd704d6fb53..8a906807cff4c8d025fa9089b9ea41eb509e275d 100644 (file)
@@ -11,4 +11,6 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+CUSTOM_MATRIX=yes
\ No newline at end of file