]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/common.mk
Merge branch 'console_ringbuf_fix'
[max/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     OPT_DEFS += -DACTIONMAP_ENABLE
25 else
26     ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
27         SRC += $(COMMON_DIR)/actionmap.c
28         OPT_DEFS += -DACTIONMAP_ENABLE
29     else
30         SRC += $(COMMON_DIR)/keymap.c
31     endif
32 endif
33
34 ifeq (yes,$(strip $(BOOTMAGIC_ENABLE)))
35     SRC += $(COMMON_DIR)/bootmagic.c
36     SRC += $(COMMON_DIR)/avr/eeconfig.c
37     OPT_DEFS += -DBOOTMAGIC_ENABLE
38 endif
39
40 ifeq (yes,$(strip $(MOUSEKEY_ENABLE)))
41     SRC += $(COMMON_DIR)/mousekey.c
42     OPT_DEFS += -DMOUSEKEY_ENABLE
43     OPT_DEFS += -DMOUSE_ENABLE
44 endif
45
46 ifeq (yes,$(strip $(EXTRAKEY_ENABLE)))
47     OPT_DEFS += -DEXTRAKEY_ENABLE
48 endif
49
50 ifeq (yes,$(strip $(CONSOLE_ENABLE)))
51     OPT_DEFS += -DCONSOLE_ENABLE
52 else
53     OPT_DEFS += -DNO_PRINT
54     OPT_DEFS += -DNO_DEBUG
55 endif
56
57 ifeq (yes,$(strip $(COMMAND_ENABLE)))
58     SRC += $(COMMON_DIR)/command.c
59     OPT_DEFS += -DCOMMAND_ENABLE
60 endif
61
62 ifeq (yes,$(strip $(NKRO_ENABLE)))
63     OPT_DEFS += -DNKRO_ENABLE
64 endif
65
66 ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
67     OPT_DEFS += -DUSB_6KRO_ENABLE
68 endif
69
70 ifeq (yes, $(strip $(KEYBOARD_LOCK_ENABLE)))
71     OPT_DEFS += -DKEYBOARD_LOCK_ENABLE
72 endif
73
74 ifeq (yes,$(strip $(SLEEP_LED_ENABLE)))
75     SRC += $(COMMON_DIR)/avr/sleep_led.c
76     OPT_DEFS += -DSLEEP_LED_ENABLE
77     OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
78 endif
79
80 ifeq (yes,$(strip $(BACKLIGHT_ENABLE)))
81     SRC += $(COMMON_DIR)/backlight.c
82     OPT_DEFS += -DBACKLIGHT_ENABLE
83 endif
84
85 ifeq (yes,$(strip $(KEYMAP_SECTION_ENABLE)))
86     OPT_DEFS += -DKEYMAP_SECTION_ENABLE
87
88     ifeq ($(strip $(MCU)),atmega32u2)
89         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x
90     else ifeq ($(strip $(MCU)),atmega32u4)
91         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x
92     else
93         EXTRALDFLAGS = $(error no ldscript for keymap section)
94     endif
95 endif
96
97 # Version string
98 VERSION := $(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null)
99 OPT_DEFS += -DVERSION=$(VERSION)
100
101
102 # Search Path
103 VPATH += $(TMK_DIR)/common