]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - Makefile.common
changed signature of keymap_fn_layer() in keymap_skel.h.
[qmk_firmware.git] / Makefile.common
index 8037b07721b07ab6275263c5ec59bafc065e6da2..795e7b999bf9d3ff050b91d9e709d0d9f84327b9 100644 (file)
 
 # List C source files here. (C dependencies are automatically generated.)
 SRC =  tmk.c \
+       layer.c \
        key_process.c \
-       usb.c \
        usb_keyboard.c \
-       usb_mouse.c \
        usb_debug.c \
+       usb.c \
        jump_bootloader.c \
-       print.c
+       print.c \
+       timer.c \
+       util.c
 SRC += $(TARGET_SRC)
 
+# Option modules
+ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
+    SRC += usb_mouse.c
+endif
+ifdef MOUSEKEY_ENABLE
+    SRC += mousekey.c
+endif
+ifdef PS2_MOUSE_ENABLE
+    SRC += ps2.c \
+          ps2_mouse.c
+endif
+ifdef USB_EXTRA_ENABLE
+    SRC += usb_extra.c
+endif
+
+ALL_SRC = $(SRC)
+ALL_SRC += usb_mouse.c \
+          mousekey.c \
+          ps2.c \
+          ps2_mouse.c \
+          usb_extra.c
+
+
 # C source file search path
 VPATH = $(TARGET_DIR):$(COMMON_DIR)
 
@@ -115,18 +140,38 @@ EXTRAINCDIRS = $(TARGET_DIR) $(COMMON_DIR)
 CSTANDARD = -std=gnu99
 
 
+OPT_DEFS =
+ifdef MOUSEKEY_ENABLE
+    OPT_DEFS += -DMOUSEKEY_ENABLE
+endif
+ifdef PS2_MOUSE_ENABLE
+    OPT_DEFS += -DPS2_MOUSE_ENABLE
+endif
+ifdef USB_EXTRA_ENABLE
+    OPT_DEFS += -DUSB_EXTRA_ENABLE
+endif
+ifdef USB_NKRO_ENABLE
+    OPT_DEFS += -DUSB_NKRO_ENABLE
+endif
+ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
+    OPT_DEFS += -DUSB_MOUSE_ENABLE
+endif
+
 # Place -D or -U options here for C sources
 CDEFS = -DF_CPU=$(F_CPU)UL
+CDEFS += $(OPT_DEFS)
 
 
 # Place -D or -U options here for ASM sources
 ADEFS = -DF_CPU=$(F_CPU)
+ADEFS += $(OPT_DEFS)
 
 
 # Place -D or -U options here for C++ sources
 CPPDEFS = -DF_CPU=$(F_CPU)UL
 #CPPDEFS += -D__STDC_LIMIT_MACROS
 #CPPDEFS += -D__STDC_CONSTANT_MACROS
+CPPDEFS += $(OPT_DEFS)
 
 
 
@@ -155,6 +200,7 @@ CFLAGS += -Wstrict-prototypes
 CFLAGS += -Wa,-adhlns=$(@:%.o=$(OBJDIR)/%.lst)
 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 CFLAGS += $(CSTANDARD)
+CFLAGS += -include config.h
 
 
 #---------------- Compiler Options C++ ----------------
@@ -182,6 +228,7 @@ CPPFLAGS += -Wundef
 CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 #CPPFLAGS += $(CSTANDARD)
+CPPFLAGS += -include config.h
 
 
 #---------------- Assembler Options ----------------
@@ -194,6 +241,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 #  -listing-cont-lines: Sets the maximum number of continuation lines of hex 
 #       dump that will be displayed for a given single line of source input.
 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
+ASFLAGS += -include config.h
 
 
 #---------------- Library Options ----------------
@@ -390,6 +438,11 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 # Default target.
 all: begin gccversion sizebefore build sizeafter end
 
+depend: tmk.c
+       @echo $<
+       @echo $(<F)
+#      $(CC) -E $(ALL_CFLAGS) $<
+
 # Change the build target to build a HEX file or a library.
 build: elf hex eep lss sym
 #build: lib
@@ -589,11 +642,11 @@ clean_list :
        $(REMOVE) $(TARGET).map
        $(REMOVE) $(TARGET).sym
        $(REMOVE) $(TARGET).lss
-       $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
-       $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
-       $(REMOVE) $(SRC:.c=.s)
-       $(REMOVE) $(SRC:.c=.d)
-       $(REMOVE) $(SRC:.c=.i)
+       $(REMOVE) $(ALL_SRC:%.c=$(OBJDIR)/%.o)
+       $(REMOVE) $(ALL_SRC:%.c=$(OBJDIR)/%.lst)
+       $(REMOVE) $(ALL_SRC:.c=.s)
+       $(REMOVE) $(ALL_SRC:.c=.d)
+       $(REMOVE) $(ALL_SRC:.c=.i)
        $(REMOVEDIR) .dep