]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/common.mk
xt_usb: Fix XT soft reset
[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 $(NO_DEBUG)))
62     OPT_DEFS += -DNO_DEBUG
63 endif
64
65 ifeq (yes,$(strip $(NO_PRINT)))
66     OPT_DEFS += -DNO_PRINT
67 endif
68
69 ifeq (yes,$(strip $(COMMAND_ENABLE)))
70     SRC += $(COMMON_DIR)/command.c
71     OPT_DEFS += -DCOMMAND_ENABLE
72 endif
73
74 ifeq (yes,$(strip $(NKRO_ENABLE)))
75     OPT_DEFS += -DNKRO_ENABLE
76 endif
77
78 ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
79     OPT_DEFS += -DUSB_6KRO_ENABLE
80 endif
81
82 ifeq (yes, $(strip $(KEYBOARD_LOCK_ENABLE)))
83     OPT_DEFS += -DKEYBOARD_LOCK_ENABLE
84 endif
85
86 ifeq (yes,$(strip $(SLEEP_LED_ENABLE)))
87     SRC += $(COMMON_DIR)/avr/sleep_led.c
88     OPT_DEFS += -DSLEEP_LED_ENABLE
89     OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
90 endif
91
92 ifeq (yes,$(strip $(BACKLIGHT_ENABLE)))
93     SRC += $(COMMON_DIR)/backlight.c
94     OPT_DEFS += -DBACKLIGHT_ENABLE
95 endif
96
97 ifeq (yes,$(strip $(KEYMAP_SECTION_ENABLE)))
98     OPT_DEFS += -DKEYMAP_SECTION_ENABLE
99
100     ifeq ($(strip $(MCU)),atmega32u2)
101         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr35.x
102     else ifeq ($(strip $(MCU)),atmega32u4)
103         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr5.x
104     else ifeq ($(strip $(MCU)),at90usb1286)
105         EXTRALDFLAGS = -Wl,-L$(TMK_DIR),-Tldscript_keymap_avr51.x
106     else
107         EXTRALDFLAGS = $(error no ldscript for keymap section)
108     endif
109 endif
110
111 # Version string
112 TMK_VERSION := $(shell (git describe --always --dirty=+ || echo 'unknown') 2> /dev/null)
113 OPT_DEFS += -DTMK_VERSION=$(TMK_VERSION)
114
115
116 # Search Path
117 VPATH += $(TMK_DIR)/common