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