layer.c \
key_process.c \
usb_keyboard.c \
- usb_mouse.c \
usb_debug.c \
- usb_extra.c \
usb.c \
jump_bootloader.c \
print.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
-# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL
-CDEFS += -DDESCRIPTION=$(DESCRIPTION)
-CDEFS += -DVENDOR_ID=$(VENDOR_ID)
-CDEFS += -DPRODUCT_ID=$(PRODUCT_ID)
-CDEFS += -DMANUFACTURER=$(MANUFACTURER)
-CDEFS += -DPRODUCT=$(PRODUCT)
-ifdef MOUSE_DELAY_TIME
-CDEFS += -DMOUSE_DELAY_TIME=$(MOUSE_DELAY_TIME)
+OPT_DEFS =
+ifdef MOUSEKEY_ENABLE
+ OPT_DEFS += -DMOUSEKEY_ENABLE
endif
-ifdef NKRO_ENABLE
-CDEFS += -DNKRO_ENABLE
+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 += -DDESCRIPTION=$(DESCRIPTION)
-ADEFS += -DVENDOR_ID=$(VENDOR_ID)
-ADEFS += -DPRODUCT_ID=$(PRODUCT_ID)
-ADEFS += -DMANUFACTURER=$(MANUFACTURER)
-ADEFS += -DPRODUCT=$(PRODUCT)
-ifdef MOUSE_DELAY_TIME
-ADEFS += -DMOUSE_DELAY_TIME=$(MOUSE_DELAY_TIME)
-endif
+ADEFS += $(OPT_DEFS)
# Place -D or -U options here for C++ sources
-CPPDEFS = -DF_CPU=$(F_CPU)UL -DDESCRIPTION=$(DESCRIPTION) -DVENDOR_ID=$(VENDOR_ID) -DPRODUCT_ID=$(PRODUCT_ID)
+CPPDEFS = -DF_CPU=$(F_CPU)UL
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
-CPPDEFS += -DDESCRIPTION=$(DESCRIPTION)
-CPPDEFS += -DVENDOR_ID=$(VENDOR_ID)
-CPPDEFS += -DPRODUCT_ID=$(PRODUCT_ID)
-CPPDEFS += -DMANUFACTURER=$(MANUFACTURER)
-CPPDEFS += -DPRODUCT=$(PRODUCT)
-ifdef MOUSE_DELAY_TIME
-CPPDEFS += -DMOUSE_DELAY_TIME=$(MOUSE_DELAY_TIME)
-endif
+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