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