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