1 # Hey Emacs, this is a -*- makefile -*-
2 #----------------------------------------------------------------------------
3 # WinAVR Makefile Template written by Eric B. Weddington, Jg Wunsch, et al.
5 # Released to the Public Domain
7 # Additional material for this makefile was written by:
20 # Output format. (can be srec, ihex, binary)
25 # Object files directory
26 # To put object files in current directory, use a dot (.), do NOT make
27 # this an empty or blank macro!
28 OBJDIR = $(BUILD_DIR)/obj_$(TARGET)
31 # Optimization level, can be [0, 1, 2, 3, s].
32 # 0 = turn off optimization. s = optimize for size.
33 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
38 # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
39 # AVR Studio 4.10 requires dwarf-2.
40 # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
48 ERROR_COLOR=\033[31;01m
49 WARN_COLOR=\033[33;01m
54 ifneq ($(shell awk --version 2>/dev/null),)
60 OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
61 ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
62 WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
68 TAB_LOG = printf "\n$$LOG\n\n" | $(AWK) '{ sub(/^/," | "); print }'
69 TAB_LOG_PLAIN = printf "$$LOG\n"
70 AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
71 AWK_CMD = $(AWK) '{ printf "%-69s", $$0; }'
72 PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && false
73 PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
74 PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && false
75 PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
76 PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
77 BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
79 # List any extra directories to look for include files here.
80 # Each directory must be seperated by a space.
81 # Use forward slashes for directory separators.
82 # For a directory that has spaces, enclose it in quotes.
83 EXTRAINCDIRS = $(subst :, ,$(VPATH))
86 # Compiler flag to set the C Standard level.
88 # gnu89 = c89 plus GCC extensions
89 # c99 = ISO C99 standard (not yet fully implemented)
90 # gnu99 = c99 plus GCC extensions
91 CSTANDARD = -std=gnu99
94 # Place -D or -U options here for C sources
95 CDEFS = -DF_CPU=$(F_CPU)UL
99 # Place -D or -U options here for ASM sources
100 ADEFS = -DF_CPU=$(F_CPU)
104 # Place -D or -U options here for C++ sources
105 CPPDEFS = -DF_CPU=$(F_CPU)UL
106 #CPPDEFS += -D__STDC_LIMIT_MACROS
107 #CPPDEFS += -D__STDC_CONSTANT_MACROS
108 CPPDEFS += $(OPT_DEFS)
112 #---------------- Compiler Options C ----------------
113 # -g*: generate debugging information
114 # -O*: optimization level
115 # -f...: tuning, see GCC manual and avr-libc documentation
116 # -Wall...: warning level
117 # -Wa,...: tell GCC to pass this to the assembler.
118 # -adhlns...: create assembler listing
122 CFLAGS += -funsigned-char
123 CFLAGS += -funsigned-bitfields
124 CFLAGS += -ffunction-sections
125 CFLAGS += -fdata-sections
126 CFLAGS += -fno-inline-small-functions
127 CFLAGS += -fpack-struct
128 CFLAGS += -fshort-enums
129 CFLAGS += -fno-strict-aliasing
132 ifeq ("$(shell echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
133 CFLAGS+= -fdiagnostics-color
137 CFLAGS += -Wstrict-prototypes
138 #CFLAGS += -mshort-calls
139 #CFLAGS += -fno-unit-at-a-time
141 #CFLAGS += -Wunreachable-code
142 #CFLAGS += -Wsign-compare
143 CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
144 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
145 CFLAGS += $(CSTANDARD)
147 CFLAGS += -include $(CONFIG_H)
151 #---------------- Compiler Options C++ ----------------
152 # -g*: generate debugging information
153 # -O*: optimization level
154 # -f...: tuning, see GCC manual and avr-libc documentation
155 # -Wall...: warning level
156 # -Wa,...: tell GCC to pass this to the assembler.
157 # -adhlns...: create assembler listing
158 CPPFLAGS = -g$(DEBUG)
159 CPPFLAGS += $(CPPDEFS)
161 CPPFLAGS += -funsigned-char
162 CPPFLAGS += -funsigned-bitfields
163 CPPFLAGS += -fpack-struct
164 CPPFLAGS += -fshort-enums
165 CPPFLAGS += -fno-exceptions
166 CPPFLAGS += -ffunction-sections
167 CPPFLAGS += -fdata-sections
168 # to supress "warning: only initialized variables can be placed into program memory area"
172 #CPPFLAGS += -mshort-calls
173 #CPPFLAGS += -fno-unit-at-a-time
174 #CPPFLAGS += -Wstrict-prototypes
175 #CPPFLAGS += -Wunreachable-code
176 #CPPFLAGS += -Wsign-compare
177 CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
178 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
179 #CPPFLAGS += $(CSTANDARD)
181 CPPFLAGS += -include $(CONFIG_H)
185 #---------------- Assembler Options ----------------
186 # -Wa,...: tell GCC to pass this to the assembler.
187 # -adhlns: create listing
188 # -gstabs: have the assembler create line number information; note that
189 # for use in COFF files, additional information about filenames
190 # and function names needs to be present in the assembler source
191 # files -- see avr-libc docs [FIXME: not yet described there]
192 # -listing-cont-lines: Sets the maximum number of continuation lines of hex
193 # dump that will be displayed for a given single line of source input.
194 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
195 ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
197 ASFLAGS += -include $(CONFIG_H)
200 #---------------- Library Options ----------------
201 # Minimalistic printf version
202 PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
204 # Floating point printf version (requires MATH_LIB = -lm below)
205 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
207 # If this is left blank, then it will use the Standard printf version.
209 #PRINTF_LIB = $(PRINTF_LIB_MIN)
210 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
213 # Minimalistic scanf version
214 SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
216 # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
217 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
219 # If this is left blank, then it will use the Standard scanf version.
221 #SCANF_LIB = $(SCANF_LIB_MIN)
222 #SCANF_LIB = $(SCANF_LIB_FLOAT)
228 # List any extra directories to look for libraries here.
229 # Each directory must be seperated by a space.
230 # Use forward slashes for directory separators.
231 # For a directory that has spaces, enclose it in quotes.
236 #---------------- External Memory Options ----------------
238 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
239 # used for variables (.data/.bss) and heap (malloc()).
240 #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
242 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
243 # only used for heap (malloc()).
244 #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
250 #---------------- Linker Options ----------------
251 # -Wl,...: tell GCC to pass this to linker.
252 # -Map: create map file
253 # --cref: add cross reference to map file
255 # Comennt out "--relax" option to avoid a error such:
256 # (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
258 LDFLAGS = -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
259 #LDFLAGS += -Wl,--relax
260 LDFLAGS += -Wl,--gc-sections
261 LDFLAGS += $(EXTMEMOPTS)
262 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
263 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
264 #LDFLAGS += -T linker_script.x
265 # You can give EXTRALDFLAGS at 'make' command line.
266 LDFLAGS += $(EXTRALDFLAGS)
270 #---------------- Debugging Options ----------------
272 # For simulavr only - target MCU frequency.
273 DEBUG_MFREQ = $(F_CPU)
275 # Set the DEBUG_UI to either gdb or insight.
279 # Set the debugging back-end to either avarice, simulavr.
280 DEBUG_BACKEND = avarice
281 #DEBUG_BACKEND = simulavr
284 GDBINIT_FILE = __avr_gdbinit
286 # When using avarice settings for the JTAG
289 # Debugging port used to communicate between GDB / avarice / simulavr.
292 # Debugging host used to communicate between GDB / avarice / simulavr, normally
293 # just set to localhost unless doing some sort of crazy debugging when
294 # avarice is running on a different computer.
295 DEBUG_HOST = localhost
299 #============================================================================
302 # Define programs and commands.
305 OBJCOPY = avr-objcopy
306 OBJDUMP = avr-objdump
314 SECHO = $(SILENT) || echo
315 # Autodecct teensy loader
316 ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
317 TEENSY_LOADER_CLI = teensy-loader-cli
319 TEENSY_LOADER_CLI = teensy_loader_cli
324 MSG_ERRORS_NONE = Errors: none
325 MSG_BEGIN = -------- begin --------
326 MSG_END = -------- end --------
327 MSG_SIZE_BEFORE = Size before:
328 MSG_SIZE_AFTER = Size after:
329 MSG_COFF = Converting to AVR COFF:
330 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
331 MSG_FLASH = Creating load file for Flash:
332 MSG_EEPROM = Creating load file for EEPROM:
333 MSG_EXTENDED_LISTING = Creating Extended Listing:
334 MSG_SYMBOL_TABLE = Creating Symbol Table:
335 MSG_LINKING = Linking:
336 MSG_COMPILING = Compiling:
337 MSG_COMPILING_CPP = Compiling:
338 MSG_ASSEMBLING = Assembling:
339 MSG_CLEANING = Cleaning project:
340 MSG_CREATING_LIBRARY = Creating library:
345 # Define all object files.
346 OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(patsubst %.cpp,$(OBJDIR)/%.o,$(patsubst %.S,$(OBJDIR)/%.o,$(SRC))))
348 # Define all listing files.
349 LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst %.S,$(OBJDIR)/%.lst,$(SRC))))
352 # Compiler flags to generate dependency files.
353 #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
354 GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$@).d
357 # Combine all necessary flags and optional flags.
358 # Add target processor to flags.
359 # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
360 ALL_CFLAGS = -mmcu=$(MCU) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
361 ALL_CPPFLAGS = -mmcu=$(MCU) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
362 ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
369 @$(MAKE) clean_list # force clean each time
374 # Quick make that doesn't clean
383 # Change the build target to build a HEX file or a library.
385 #build: elf hex eep lss sym
389 elf: $(BUILD_DIR)/$(TARGET).elf
390 hex: $(BUILD_DIR)/$(TARGET).hex
391 eep: $(BUILD_DIR)/$(TARGET).eep
392 lss: $(BUILD_DIR)/$(TARGET).lss
393 sym: $(BUILD_DIR)/$(TARGET).sym
394 LIBNAME=lib$(TARGET).a
400 # AVR Studio 3.x does not check make's exit code but relies on
401 # the following magic strings to be generated by the compile job.
403 @$(SECHO) $(MSG_BEGIN)
409 # Display size of file.
410 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
411 #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
412 ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
415 @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
416 2>/dev/null; $(SECHO); fi
419 @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
420 2>/dev/null; $(SECHO); fi
421 # test file sizes eventually
422 # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | $(AWK) 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi
424 # Display compiler version information.
426 @$(SILENT) || $(CC) --version
430 # Program the device.
431 program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
434 teensy: $(BUILD_DIR)/$(TARGET).hex
435 $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex
437 flip: $(BUILD_DIR)/$(TARGET).hex
438 batchisp -hardware usb -device $(MCU) -operation erase f
439 batchisp -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program
440 batchisp -hardware usb -device $(MCU) -operation start reset 0
442 dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
443 ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
444 dfu-programmer $(MCU) erase --force
446 dfu-programmer $(MCU) erase
448 dfu-programmer $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
449 dfu-programmer $(MCU) reset
452 dfu-programmer $(MCU) reset
453 dfu-programmer $(MCU) start
455 flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
456 $(COPY) $(BUILD_DIR)/$(TARGET).eep $(BUILD_DIR)/$(TARGET)eep.hex
457 batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
458 batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(BUILD_DIR)/$(TARGET)eep.hex program
459 batchisp -hardware usb -device $(MCU) -operation start reset 0
460 $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
462 dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
463 ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
464 dfu-programmer $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep
466 dfu-programmer $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep
468 dfu-programmer $(MCU) reset
471 # Generate avr-gdb config/init file which does the following:
472 # define the reset signal, load the target file, connect to target, and set
473 # a breakpoint at main().
475 @$(REMOVE) $(GDBINIT_FILE)
476 @echo define reset >> $(GDBINIT_FILE)
477 @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
478 @echo end >> $(GDBINIT_FILE)
479 @echo file $(BUILD_DIR)/$(TARGET).elf >> $(GDBINIT_FILE)
480 @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
481 ifeq ($(DEBUG_BACKEND),simulavr)
482 @echo load >> $(GDBINIT_FILE)
484 @echo break main >> $(GDBINIT_FILE)
486 debug: gdb-config $(BUILD_DIR)/$(TARGET).elf
487 ifeq ($(DEBUG_BACKEND), avarice)
488 @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
489 @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
490 $(BUILD_DIR)/$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
491 @$(WINSHELL) /c pause
494 @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
495 $(DEBUG_MFREQ) --port $(DEBUG_PORT)
497 @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
502 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
503 COFFCONVERT = $(OBJCOPY) --debugging
504 COFFCONVERT += --change-section-address .data-0x800000
505 COFFCONVERT += --change-section-address .bss-0x800000
506 COFFCONVERT += --change-section-address .noinit-0x800000
507 COFFCONVERT += --change-section-address .eeprom-0x810000
511 coff: $(BUILD_DIR)/$(TARGET).elf
512 @$(SECHO) $(MSG_COFF) $(BUILD_DIR)/$(TARGET).cof
513 $(COFFCONVERT) -O coff-avr $< $(BUILD_DIR)/$(TARGET).cof
516 extcoff: $(BUILD_DIR)/$(TARGET).elf
517 @$(SECHO) $(MSG_EXTENDED_COFF) $(BUILD_DIR)/$(TARGET).cof
518 $(COFFCONVERT) -O coff-ext-avr $< $(BUILD_DIR)/$(TARGET).cof
522 # Create final output files (.hex, .eep) from ELF output file.
524 @$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
525 $(eval CMD=$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@)
527 @$(COPY) $@ $(TARGET).hex
530 @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
531 $(eval CMD=$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0)
534 # Create extended listing file from ELF output file.
536 @$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
537 $(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
540 # Create a symbol table from ELF output file.
542 @$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
543 $(eval CMD=$(NM) -n $< > $@ )
546 # Create library from object files.
547 .SECONDARY : $(BUILD_DIR)/$(TARGET).a
550 @$(SILENT) || printf "$(MSG_CREATING_LIBRARY) $@" | $(AWK_CMD)
551 $(eval CMD=$(AR) $@ $(OBJ) )
554 # Link: create ELF output file from object files.
555 .SECONDARY : $(BUILD_DIR)/$(TARGET).elf
558 @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
559 $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
562 # Compile: create object files from C source files.
565 @$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD)
566 $(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@)
569 # Compile: create object files from C++ source files.
570 $(OBJDIR)/%.o : %.cpp
572 @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD)
573 $(CC) -c $(ALL_CPPFLAGS) $< -o $@
576 # Compile: create assembler files from C source files.
578 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
579 $(eval CMD=$(CC) -S $(ALL_CFLAGS) $< -o $@)
582 # Compile: create assembler files from C++ source files.
584 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
585 $(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@)
588 # Assemble: create object files from assembler source files.
591 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
592 $(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@)
595 # Create preprocessed source for use in sending a bug report.
597 $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
599 # Target: clean project.
600 clean: begin clean_list end
603 $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR)
604 $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR)
605 $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR)
611 SUBDIRS := $(sort $(dir $(wildcard $(TOP_DIR)/keyboards/*/.)))
612 all-keyboards-defaults-%:
613 @for x in $(SUBDIRS) ; do \
614 printf "Compiling with default: $$x" | $(AWK_CMD); \
615 LOG=$$($(MAKE) -C $$x $(subst all-keyboards-defaults-,,$@) VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
618 all-keyboards-defaults: all-keyboards-defaults-all
620 KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
621 all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
622 all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
623 all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
624 all-keyboards: all-keyboards-all
627 $(eval KEYBOARD=$(patsubst /keyboards/%,%,$1))
628 $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)$1/keymaps/*/.))))
629 @for x in $(KEYMAPS) ; do \
630 printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | $(AWK) '{ printf "%-88s", $$0; }'; \
631 LOG=$$($(MAKE) -C $(TOP_DIR)$1 $2 keymap=$$x VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
635 define make_keyboard_helper
636 # Just remove the -quick, -all and so on from the first argument and pass it forward
637 $(call make_keyboard,$(subst -$2,,$1),$2)
641 $(call make_keyboard_helper,$@,quick)
643 $(call make_keyboard_helper,$@,all)
645 $(call make_keyboard_helper,$@,clean)
647 $(call make_keyboard_helper,$@,all)
650 $(eval MAKECONFIG=$(call get_target,all-keymaps,$@))
651 $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboards/$(KEYBOARD)/keymaps/*/.))))
652 @for x in $(KEYMAPS) ; do \
653 printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | $(AWK) '{ printf "%-88s", $$0; }'; \
654 LOG=$$($(MAKE) $(subst all-keymaps-,,$@) keyboard=$(KEYBOARD) keymap=$$x VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
657 all-keymaps: all-keymaps-all
659 # Create build directory
660 $(shell mkdir $(BUILD_DIR) 2>/dev/null)
662 # Create object files directory
663 $(shell mkdir $(OBJDIR) 2>/dev/null)
666 # Include the dependency files.
667 -include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
670 # Listing of phony targets.
671 .PHONY : all quick begin finish end sizebefore sizeafter gccversion \
672 build elf hex eep lss sym coff extcoff \
673 clean clean_list debug gdb-config show_path \
674 program teensy dfu flip dfu-ee flip-ee dfu-start \
675 all-keyboards-defaults all-keyboards all-keymaps \
676 all-keyboards-defaults-% all-keyboards-% all-keymaps-%