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