diff options
Diffstat (limited to 'tmk_core/rules.mk')
| -rw-r--r-- | tmk_core/rules.mk | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index c1474a5c2..a66718cd2 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk | |||
| @@ -223,6 +223,12 @@ $(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ)))) | |||
| 223 | 223 | ||
| 224 | MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@) | 224 | MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@) |
| 225 | 225 | ||
| 226 | # For a ChibiOS build, ensure that the board files have the hook overrides injected | ||
| 227 | define BOARDSRC_INJECT_HOOKS | ||
| 228 | $(KEYBOARD_OUTPUT)/$(patsubst %.c,%.o,$(patsubst ./%,%,$1)): INIT_HOOK_CFLAGS += -include $(TOP_DIR)/tmk_core/protocol/chibios/init_hooks.h | ||
| 229 | endef | ||
| 230 | $(foreach LOBJ, $(BOARDSRC), $(eval $(call BOARDSRC_INJECT_HOOKS,$(LOBJ)))) | ||
| 231 | |||
| 226 | # Add QMK specific flags | 232 | # Add QMK specific flags |
| 227 | DFU_SUFFIX ?= dfu-suffix | 233 | DFU_SUFFIX ?= dfu-suffix |
| 228 | DFU_SUFFIX_ARGS ?= | 234 | DFU_SUFFIX_ARGS ?= |
| @@ -306,27 +312,27 @@ ifdef $1_CONFIG | |||
| 306 | $1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG)) | 312 | $1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG)) |
| 307 | endif | 313 | endif |
| 308 | $1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) | 314 | $1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) |
| 309 | $1_CXXFLAGS= $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) | 315 | $1_CXXFLAGS = $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) |
| 310 | $1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) | 316 | $1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) |
| 311 | 317 | ||
| 312 | # Compile: create object files from C source files. | 318 | # Compile: create object files from C source files. |
| 313 | $1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN) | 319 | $1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN) |
| 314 | @mkdir -p $$(@D) | 320 | @mkdir -p $$(@D) |
| 315 | @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD) | 321 | @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD) |
| 316 | $$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) | 322 | $$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) |
| 317 | @$$(BUILD_CMD) | 323 | @$$(BUILD_CMD) |
| 318 | 324 | ||
| 319 | # Compile: create object files from C++ source files. | 325 | # Compile: create object files from C++ source files. |
| 320 | $1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) | 326 | $1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) |
| 321 | @mkdir -p $$(@D) | 327 | @mkdir -p $$(@D) |
| 322 | @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) | 328 | @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) |
| 323 | $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) | 329 | $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) |
| 324 | @$$(BUILD_CMD) | 330 | @$$(BUILD_CMD) |
| 325 | 331 | ||
| 326 | $1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) | 332 | $1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) |
| 327 | @mkdir -p $$(@D) | 333 | @mkdir -p $$(@D) |
| 328 | @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) | 334 | @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) |
| 329 | $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) | 335 | $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) |
| 330 | @$$(BUILD_CMD) | 336 | @$$(BUILD_CMD) |
| 331 | 337 | ||
| 332 | # Assemble: create object files from assembler source files. | 338 | # Assemble: create object files from assembler source files. |
