diff options
| author | IBNobody <ibnobody@gmail.com> | 2016-06-11 17:24:28 -0500 |
|---|---|---|
| committer | IBNobody <ibnobody@gmail.com> | 2016-06-11 17:24:28 -0500 |
| commit | 1c2705eea59c6e772dd771c5f77fbbddeda1d61d (patch) | |
| tree | e97be08b89dad429adea9fefbeaef35c01aaf5a4 | |
| parent | 50621a2e6a7d03add0c202e5b2698338c7fbbf5b (diff) | |
| download | qmk_firmware-1c2705eea59c6e772dd771c5f77fbbddeda1d61d.tar.gz qmk_firmware-1c2705eea59c6e772dd771c5f77fbbddeda1d61d.zip | |
fixed color detection routine in makefile
| -rw-r--r-- | tmk_core/rules.mk | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 8cae22b38..79a728245 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | # make flip-ee = Download the eeprom file to the device, using Atmel FLIP | 43 | # make flip-ee = Download the eeprom file to the device, using Atmel FLIP |
| 44 | # (must have Atmel FLIP installed). | 44 | # (must have Atmel FLIP installed). |
| 45 | # | 45 | # |
| 46 | # make debug = Start either simulavr or avarice as specified for debugging, | 46 | # make debug = Start either simulavr or avarice as specified for debugging, |
| 47 | # with avr-gdb or avr-insight as the front end for debugging. | 47 | # with avr-gdb or avr-insight as the front end for debugging. |
| 48 | # | 48 | # |
| 49 | # make filename.s = Just compile filename.c into the assembler code only. | 49 | # make filename.s = Just compile filename.c into the assembler code only. |
| @@ -66,7 +66,7 @@ BUILD_DIR = .build | |||
| 66 | OBJDIR = $(BUILD_DIR)/obj_$(TARGET) | 66 | OBJDIR = $(BUILD_DIR)/obj_$(TARGET) |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | # Optimization level, can be [0, 1, 2, 3, s]. | 69 | # Optimization level, can be [0, 1, 2, 3, s]. |
| 70 | # 0 = turn off optimization. s = optimize for size. | 70 | # 0 = turn off optimization. s = optimize for size. |
| 71 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) | 71 | # (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
| 72 | OPT = s | 72 | OPT = s |
| @@ -161,10 +161,8 @@ CFLAGS += -fshort-enums | |||
| 161 | CFLAGS += -fno-strict-aliasing | 161 | CFLAGS += -fno-strict-aliasing |
| 162 | # add color | 162 | # add color |
| 163 | ifeq ($(COLOR),true) | 163 | ifeq ($(COLOR),true) |
| 164 | ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "") | 164 | ifeq ("$(echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "") |
| 165 | CFLAGS+= -fdiagnostics-color | 165 | CFLAGS+= -fdiagnostics-color |
| 166 | else ifeq ("$(shell echo "int main(){}" | $(CC) -fcolor-diagnostics -x c - -o /dev/null 2>&1)", "") | ||
| 167 | CFLAGS+= -fcolor-diagnostics | ||
| 168 | endif | 166 | endif |
| 169 | endif | 167 | endif |
| 170 | CFLAGS += -Wall | 168 | CFLAGS += -Wall |
| @@ -223,7 +221,7 @@ endif | |||
| 223 | # for use in COFF files, additional information about filenames | 221 | # for use in COFF files, additional information about filenames |
| 224 | # and function names needs to be present in the assembler source | 222 | # and function names needs to be present in the assembler source |
| 225 | # files -- see avr-libc docs [FIXME: not yet described there] | 223 | # files -- see avr-libc docs [FIXME: not yet described there] |
| 226 | # -listing-cont-lines: Sets the maximum number of continuation lines of hex | 224 | # -listing-cont-lines: Sets the maximum number of continuation lines of hex |
| 227 | # dump that will be displayed for a given single line of source input. | 225 | # dump that will be displayed for a given single line of source input. |
| 228 | ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 | 226 | ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 |
| 229 | ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) | 227 | ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
| @@ -239,7 +237,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min | |||
| 239 | PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt | 237 | PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt |
| 240 | 238 | ||
| 241 | # If this is left blank, then it will use the Standard printf version. | 239 | # If this is left blank, then it will use the Standard printf version. |
| 242 | PRINTF_LIB = | 240 | PRINTF_LIB = |
| 243 | #PRINTF_LIB = $(PRINTF_LIB_MIN) | 241 | #PRINTF_LIB = $(PRINTF_LIB_MIN) |
| 244 | #PRINTF_LIB = $(PRINTF_LIB_FLOAT) | 242 | #PRINTF_LIB = $(PRINTF_LIB_FLOAT) |
| 245 | 243 | ||
| @@ -251,7 +249,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min | |||
| 251 | SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt | 249 | SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt |
| 252 | 250 | ||
| 253 | # If this is left blank, then it will use the Standard scanf version. | 251 | # If this is left blank, then it will use the Standard scanf version. |
| 254 | SCANF_LIB = | 252 | SCANF_LIB = |
| 255 | #SCANF_LIB = $(SCANF_LIB_MIN) | 253 | #SCANF_LIB = $(SCANF_LIB_MIN) |
| 256 | #SCANF_LIB = $(SCANF_LIB_FLOAT) | 254 | #SCANF_LIB = $(SCANF_LIB_FLOAT) |
| 257 | 255 | ||
| @@ -263,7 +261,7 @@ MATH_LIB = -lm | |||
| 263 | # Each directory must be seperated by a space. | 261 | # Each directory must be seperated by a space. |
| 264 | # Use forward slashes for directory separators. | 262 | # Use forward slashes for directory separators. |
| 265 | # For a directory that has spaces, enclose it in quotes. | 263 | # For a directory that has spaces, enclose it in quotes. |
| 266 | EXTRALIBDIRS = | 264 | EXTRALIBDIRS = |
| 267 | 265 | ||
| 268 | 266 | ||
| 269 | 267 | ||
| @@ -324,7 +322,7 @@ JTAG_DEV = /dev/com1 | |||
| 324 | DEBUG_PORT = 4242 | 322 | DEBUG_PORT = 4242 |
| 325 | 323 | ||
| 326 | # Debugging host used to communicate between GDB / avarice / simulavr, normally | 324 | # Debugging host used to communicate between GDB / avarice / simulavr, normally |
| 327 | # just set to localhost unless doing some sort of crazy debugging when | 325 | # just set to localhost unless doing some sort of crazy debugging when |
| 328 | # avarice is running on a different computer. | 326 | # avarice is running on a different computer. |
| 329 | DEBUG_HOST = localhost | 327 | DEBUG_HOST = localhost |
| 330 | 328 | ||
| @@ -358,7 +356,7 @@ endif | |||
| 358 | MSG_ERRORS_NONE = Errors: none | 356 | MSG_ERRORS_NONE = Errors: none |
| 359 | MSG_BEGIN = -------- begin -------- | 357 | MSG_BEGIN = -------- begin -------- |
| 360 | MSG_END = -------- end -------- | 358 | MSG_END = -------- end -------- |
| 361 | MSG_SIZE_BEFORE = Size before: | 359 | MSG_SIZE_BEFORE = Size before: |
| 362 | MSG_SIZE_AFTER = Size after: | 360 | MSG_SIZE_AFTER = Size after: |
| 363 | MSG_COFF = Converting to AVR COFF: | 361 | MSG_COFF = Converting to AVR COFF: |
| 364 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: | 362 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
| @@ -396,22 +394,22 @@ ALL_CPPFLAGS = -mmcu=$(MCU) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS) | |||
| 396 | ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) | 394 | ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) |
| 397 | 395 | ||
| 398 | # Default target. | 396 | # Default target. |
| 399 | all: | 397 | all: |
| 400 | @$(MAKE) begin | 398 | @$(MAKE) begin |
| 401 | @$(MAKE) gccversion | 399 | @$(MAKE) gccversion |
| 402 | @$(MAKE) sizebefore | 400 | @$(MAKE) sizebefore |
| 403 | @$(MAKE) clean_list # force clean each time | 401 | @$(MAKE) clean_list # force clean each time |
| 404 | @$(MAKE) build | 402 | @$(MAKE) build |
| 405 | @$(MAKE) sizeafter | 403 | @$(MAKE) sizeafter |
| 406 | @$(MAKE) end | 404 | @$(MAKE) end |
| 407 | 405 | ||
| 408 | # Quick make that doesn't clean | 406 | # Quick make that doesn't clean |
| 409 | quick: | 407 | quick: |
| 410 | @$(MAKE) begin | 408 | @$(MAKE) begin |
| 411 | @$(MAKE) gccversion | 409 | @$(MAKE) gccversion |
| 412 | @$(MAKE) sizebefore | 410 | @$(MAKE) sizebefore |
| 413 | @$(MAKE) build | 411 | @$(MAKE) build |
| 414 | @$(MAKE) sizeafter | 412 | @$(MAKE) sizeafter |
| 415 | @$(MAKE) end | 413 | @$(MAKE) end |
| 416 | 414 | ||
| 417 | # Change the build target to build a HEX file or a library. | 415 | # Change the build target to build a HEX file or a library. |
| @@ -456,12 +454,12 @@ sizeafter: | |||
| 456 | # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | awk 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi | 454 | # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | awk 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi |
| 457 | 455 | ||
| 458 | # Display compiler version information. | 456 | # Display compiler version information. |
| 459 | gccversion : | 457 | gccversion : |
| 460 | @$(SILENT) || $(CC) --version | 458 | @$(SILENT) || $(CC) --version |
| 461 | 459 | ||
| 462 | 460 | ||
| 463 | 461 | ||
| 464 | # Program the device. | 462 | # Program the device. |
| 465 | program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep | 463 | program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep |
| 466 | $(PROGRAM_CMD) | 464 | $(PROGRAM_CMD) |
| 467 | 465 | ||
| @@ -492,7 +490,7 @@ endif | |||
| 492 | dfu-programmer $(MCU) erase | 490 | dfu-programmer $(MCU) erase |
| 493 | dfu-programmer $(MCU) flash $(KEYMAP_PATH)/compiled.hex | 491 | dfu-programmer $(MCU) flash $(KEYMAP_PATH)/compiled.hex |
| 494 | dfu-programmer $(MCU) reset | 492 | dfu-programmer $(MCU) reset |
| 495 | 493 | ||
| 496 | dfu-start: | 494 | dfu-start: |
| 497 | dfu-programmer $(MCU) reset | 495 | dfu-programmer $(MCU) reset |
| 498 | dfu-programmer $(MCU) start | 496 | dfu-programmer $(MCU) start |
| @@ -514,9 +512,9 @@ endif | |||
| 514 | 512 | ||
| 515 | 513 | ||
| 516 | # Generate avr-gdb config/init file which does the following: | 514 | # Generate avr-gdb config/init file which does the following: |
| 517 | # define the reset signal, load the target file, connect to target, and set | 515 | # define the reset signal, load the target file, connect to target, and set |
| 518 | # a breakpoint at main(). | 516 | # a breakpoint at main(). |
| 519 | gdb-config: | 517 | gdb-config: |
| 520 | @$(REMOVE) $(GDBINIT_FILE) | 518 | @$(REMOVE) $(GDBINIT_FILE) |
| 521 | @echo define reset >> $(GDBINIT_FILE) | 519 | @echo define reset >> $(GDBINIT_FILE) |
| 522 | @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) | 520 | @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) |
| @@ -618,7 +616,7 @@ $(OBJDIR)/%.o : %.c | |||
| 618 | $(OBJDIR)/%.o : %.cpp | 616 | $(OBJDIR)/%.o : %.cpp |
| 619 | @mkdir -p $(@D) | 617 | @mkdir -p $(@D) |
| 620 | @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD) | 618 | @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD) |
| 621 | $(CC) -c $(ALL_CPPFLAGS) $< -o $@ | 619 | $(CC) -c $(ALL_CPPFLAGS) $< -o $@ |
| 622 | @$(BUILD_CMD) | 620 | @$(BUILD_CMD) |
| 623 | 621 | ||
| 624 | # Compile: create assembler files from C source files. | 622 | # Compile: create assembler files from C source files. |
| @@ -642,7 +640,7 @@ $(OBJDIR)/%.o : %.S | |||
| 642 | 640 | ||
| 643 | # Create preprocessed source for use in sending a bug report. | 641 | # Create preprocessed source for use in sending a bug report. |
| 644 | %.i : %.c | 642 | %.i : %.c |
| 645 | $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@ | 643 | $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@ |
| 646 | 644 | ||
| 647 | # Target: clean project. | 645 | # Target: clean project. |
| 648 | clean: begin clean_list end | 646 | clean: begin clean_list end |
