diff options
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/common.mk | 2 | ||||
-rw-r--r-- | tmk_core/common/keycode.h | 7 | ||||
-rw-r--r-- | tmk_core/rules.mk | 75 |
3 files changed, 32 insertions, 52 deletions
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 5bae0d762f..aa05b9491d 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -107,7 +107,7 @@ endif # Version string -OPT_DEFS += -DVERSION=$(shell (git describe --always --dirty || echo 'unknown') 2> /dev/null) +OPT_DEFS += -DVERSION=$(GIT_VERSION) # Bootloader address ifdef STM32_BOOTLOADER_ADDRESS diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 448195306f..2f208c54e0 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF)) #define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE) -#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_WFAV) +#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_MRWD) #define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31) #define IS_MOUSEKEY(code) (KC_MS_UP <= (code) && (code) <= KC_MS_ACCEL2) #define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT) @@ -156,8 +156,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define KC_WSTP KC_WWW_STOP #define KC_WREF KC_WWW_REFRESH #define KC_WFAV KC_WWW_FAVORITES -/* Jump to bootloader */ -#define KC_BTLD KC_BOOTLOADER /* Transparent */ #define KC_TRANSPARENT 1 #define KC_TRNS KC_TRANSPARENT @@ -428,9 +426,6 @@ enum internal_special_keycodes { KC_MEDIA_FAST_FORWARD, KC_MEDIA_REWIND, /* 0xBC */ - /* Jump to bootloader */ - KC_BOOTLOADER = 0xBF, - /* Fn key */ KC_FN0 = 0xC0, KC_FN1, diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 352e9314b6..f13351ea19 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -260,7 +260,7 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst # Compiler flags to generate dependency files. #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d -GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$@).d +GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$(subst $(BUILD_DIR)/,,$@)).d # Combine all necessary flags and optional flags. @@ -271,23 +271,10 @@ ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS) ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) # Default target. -all: - @$(MAKE) begin - @$(MAKE) gccversion - @$(MAKE) sizebefore - @$(MAKE) clean_list # force clean each time - @$(MAKE) build - @$(MAKE) sizeafter - @$(MAKE) end +all: build sizeafter # Quick make that doesn't clean -quick: - @$(MAKE) begin - @$(MAKE) gccversion - @$(MAKE) sizebefore - @$(MAKE) build - @$(MAKE) sizeafter - @$(MAKE) end +quick: build sizeafter # Change the build target to build a HEX file or a library. build: elf hex @@ -303,13 +290,7 @@ sym: $(BUILD_DIR)/$(TARGET).sym LIBNAME=lib$(TARGET).a lib: $(LIBNAME) - - -# Eye candy. -# AVR Studio 3.x does not check make's exit code but relies on -# the following magic strings to be generated by the compile job. -begin: - @$(SECHO) $(MSG_BEGIN) +check_submodule: git submodule status --recursive | \ while IFS= read -r x; do \ case "$$x" in \ @@ -318,10 +299,6 @@ begin: esac \ done -end: - @$(SECHO) $(MSG_END) - - # Display size of file. HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf @@ -331,7 +308,7 @@ sizebefore: @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \ 2>/dev/null; $(SECHO); fi -sizeafter: +sizeafter: $(BUILD_DIR)/$(TARGET).hex @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \ 2>/dev/null; $(SECHO); fi # test file sizes eventually @@ -383,60 +360,55 @@ gccversion : $(eval CMD=$(AR) $@ $(OBJ) ) @$(BUILD_CMD) +BEGIN = gccversion check_submodule sizebefore + # Link: create ELF output file from object files. .SECONDARY : $(BUILD_DIR)/$(TARGET).elf .PRECIOUS : $(OBJ) -%.elf: $(OBJ) +%.elf: $(OBJ) | $(BEGIN) @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD) $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)) @$(BUILD_CMD) # Compile: create object files from C source files. -$(OBJDIR)/%.o : %.c +$(OBJDIR)/%.o : %.c | $(BEGIN) @mkdir -p $(@D) @$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD) $(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@) @$(BUILD_CMD) # Compile: create object files from C++ source files. -$(OBJDIR)/%.o : %.cpp +$(OBJDIR)/%.o : %.cpp | $(BEGIN) @mkdir -p $(@D) @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD) $(eval CMD=$(CC) -c $(ALL_CPPFLAGS) $< -o $@) @$(BUILD_CMD) # Compile: create assembler files from C source files. -%.s : %.c +%.s : %.c | $(BEGIN) @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD) $(eval CMD=$(CC) -S $(ALL_CFLAGS) $< -o $@) @$(BUILD_CMD) # Compile: create assembler files from C++ source files. -%.s : %.cpp +%.s : %.cpp | $(BEGIN) @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD) $(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@) @$(BUILD_CMD) # Assemble: create object files from assembler source files. -$(OBJDIR)/%.o : %.S +$(OBJDIR)/%.o : %.S | $(BEGIN) @mkdir -p $(@D) @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD) $(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@) @$(BUILD_CMD) # Create preprocessed source for use in sending a bug report. -%.i : %.c +%.i : %.c | $(BEGIN) $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@ # Target: clean project. -clean: begin clean_list end - -clean_list : - @$(REMOVE) -r $(BUILD_DIR) - @$(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR) - @$(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR) - @if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi - @$(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR) +clean: show_path: @echo VPATH=$(VPATH) @@ -496,6 +468,19 @@ all-keymaps-%: all-keymaps: all-keymaps-all +GOAL=$(MAKECMDGOALS) +ifeq ($(MAKECMDGOALS),) +GOAL = all +endif +CLEANING_GOALS=clean clean_list all +ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),) +$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null) +$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR)) +$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR)) +$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi) +$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR)) +endif + # Create build directory $(shell mkdir $(BUILD_DIR) 2>/dev/null) @@ -508,8 +493,8 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) # Listing of phony targets. -.PHONY : all quick begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff \ +.PHONY : all quick finish sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff check_submodule \ clean clean_list debug gdb-config show_path \ program teensy dfu flip dfu-ee flip-ee dfu-start \ all-keyboards-defaults all-keyboards all-keymaps \ |