]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/common.mk
lufa: Add debug print support with UART
[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     # Remove print functions when console is disabled and
54     # no other print method like UART is available
55     ifneq (yes, $(strip $(DEBUG_PRINT_AVAILABLE)))
56         OPT_DEFS += -DNO_PRINT
57         OPT_DEFS += -DNO_DEBUG
58     endif
59 endif
60
61 ifeq (yes,$(strip $(COMMAND_ENABLE)))
62     SRC += $(COMMON_DIR)/command.c
63     OPT_DEFS += -DCOMMAND_ENABLE
64 endif
65
66 ifeq (yes,$(strip $(NKRO_ENABLE)))
67     OPT_DEFS += -DNKRO_ENABLE
68 endif
69
70 ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
71     OPT_DEFS += -DUSB_6KRO_ENABLE
72 endif
73
74 ifeq (yes, $(strip $(KEYBOARD_LOCK_ENABLE)))
75     OPT_DEFS += -DKEYBOARD_LOCK_ENABLE
76 endif
77
78 ifeq (yes,$(strip $(SLEEP_LED_ENABLE)))
79     SRC += $(COMMON_DIR)/avr/sleep_led.c
80     OPT_DEFS += -DSLEEP_LED_ENABLE
81     OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
82 endif
83
84 ifeq (yes,$(strip $(BACKLIGHT_ENABLE)))
85     SRC += $(COMMON_DIR)/backlight.c
86     OPT_DEFS += -DBACKLIGHT_ENABLE
87 endif
88
89 ifeq (yes,$(strip $(KEYMAP_SECTION_ENABLE)))
90     OPT_DEFS += -DKEYMAP_SECTION_ENABLE
91
92     ifeq ($(strip $(MCU)),atmega32u2)
93         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x
94     else ifeq ($(strip $(MCU)),atmega32u4)
95         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x
96     else
97         EXTRALDFLAGS = $(error no ldscript for keymap section)
98     endif
99 endif
100
101 # Version string
102 VERSION := $(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null)
103 OPT_DEFS += -DVERSION=$(VERSION)
104
105
106 # Search Path
107 VPATH += $(TMK_DIR)/common