# List C source files here. (C dependencies are automatically generated.)
SRC = tmk.c \
+ layer.c \
key_process.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)
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 -DDESCRIPTION=$(DESCRIPTION)
+CDEFS = -DF_CPU=$(F_CPU)UL
+CDEFS += $(OPT_DEFS)
# Place -D or -U options here for ASM sources
-ADEFS = -DF_CPU=$(F_CPU) -DDESCRIPTION=$(DESCRIPTION)
+ADEFS = -DF_CPU=$(F_CPU)
+ADEFS += $(OPT_DEFS)
# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL -DDESCRIPTION=$(DESCRIPTION)
+CPPDEFS = -DF_CPU=$(F_CPU)UL
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
+CPPDEFS += $(OPT_DEFS)
CFLAGS += -Wa,-adhlns=$(@:%.o=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
+CFLAGS += -include config.h
#---------------- Compiler Options C++ ----------------
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
+CPPFLAGS += -include config.h
#---------------- Assembler Options ----------------
# -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 ----------------
# 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
$(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