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