core: Add matrix_clear() and default impl.
[tmk_keyboard.git] / tmk_core / common.mk
1 COMMON_DIR = common
2 SRC += $(COMMON_DIR)/host.c \
3 $(COMMON_DIR)/keyboard.c \
4 $(COMMON_DIR)/matrix.c \
5 $(COMMON_DIR)/action.c \
6 $(COMMON_DIR)/action_tapping.c \
7 $(COMMON_DIR)/action_macro.c \
8 $(COMMON_DIR)/action_layer.c \
9 $(COMMON_DIR)/action_util.c \
10 $(COMMON_DIR)/print.c \
11 $(COMMON_DIR)/debug.c \
12 $(COMMON_DIR)/util.c \
13 $(COMMON_DIR)/hook.c \
14 $(COMMON_DIR)/avr/suspend.c \
15 $(COMMON_DIR)/avr/xprintf.S \
16 $(COMMON_DIR)/avr/timer.c \
17 $(COMMON_DIR)/avr/bootloader.c
18
19
20 # Option modules
21 ifeq (yes,$(strip $(UNIMAP_ENABLE)))
22 SRC += $(COMMON_DIR)/unimap.c
23 OPT_DEFS += -DUNIMAP_ENABLE
24 else
25 ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
26 SRC += $(COMMON_DIR)/actionmap.c
27 OPT_DEFS += -DACTIONMAP_ENABLE
28 else
29 SRC += $(COMMON_DIR)/keymap.c
30 endif
31 endif
32
33 ifeq (yes,$(strip $(BOOTMAGIC_ENABLE)))
34 SRC += $(COMMON_DIR)/bootmagic.c
35 SRC += $(COMMON_DIR)/avr/eeconfig.c
36 OPT_DEFS += -DBOOTMAGIC_ENABLE
37 endif
38
39 ifeq (yes,$(strip $(MOUSEKEY_ENABLE)))
40 SRC += $(COMMON_DIR)/mousekey.c
41 OPT_DEFS += -DMOUSEKEY_ENABLE
42 OPT_DEFS += -DMOUSE_ENABLE
43 endif
44
45 ifeq (yes,$(strip $(EXTRAKEY_ENABLE)))
46 OPT_DEFS += -DEXTRAKEY_ENABLE
47 endif
48
49 ifeq (yes,$(strip $(CONSOLE_ENABLE)))
50 OPT_DEFS += -DCONSOLE_ENABLE
51 else
52 OPT_DEFS += -DNO_PRINT
53 OPT_DEFS += -DNO_DEBUG
54 endif
55
56 ifeq (yes,$(strip $(COMMAND_ENABLE)))
57 SRC += $(COMMON_DIR)/command.c
58 OPT_DEFS += -DCOMMAND_ENABLE
59 endif
60
61 ifeq (yes,$(strip $(NKRO_ENABLE)))
62 OPT_DEFS += -DNKRO_ENABLE
63 endif
64
65 ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
66 OPT_DEFS += -DUSB_6KRO_ENABLE
67 endif
68
69 ifeq (yes, $(strip $(KEYBOARD_LOCK_ENABLE)))
70 OPT_DEFS += -DKEYBOARD_LOCK_ENABLE
71 endif
72
73 ifeq (yes,$(strip $(SLEEP_LED_ENABLE)))
74 SRC += $(COMMON_DIR)/avr/sleep_led.c
75 OPT_DEFS += -DSLEEP_LED_ENABLE
76 OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
77 endif
78
79 ifeq (yes,$(strip $(BACKLIGHT_ENABLE)))
80 SRC += $(COMMON_DIR)/backlight.c
81 OPT_DEFS += -DBACKLIGHT_ENABLE
82 endif
83
84 ifeq (yes,$(strip $(KEYMAP_SECTION_ENABLE)))
85 OPT_DEFS += -DKEYMAP_SECTION_ENABLE
86
87 ifeq ($(strip $(MCU)),atmega32u2)
88 EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x
89 else ifeq ($(strip $(MCU)),atmega32u4)
90 EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x
91 else
92 EXTRALDFLAGS = $(error no ldscript for keymap section)
93 endif
94 endif
95
96 # Version string
97 VERSION := $(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null)
98 OPT_DEFS += -DVERSION=$(VERSION)
99
100
101 # Search Path
102 VPATH += $(TMK_DIR)/common
Imprint / Impressum