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:
17 #----------------------------------------------------------------------------
20 # make all = Make software.
22 # make clean = Clean out built project files.
24 # make coff = Convert ELF to AVR COFF.
26 # make extcoff = Convert ELF to AVR Extended COFF.
28 # make program = Download the hex file to the device.
29 # Please customize your programmer settings(PROGRAM_CMD)
31 # make teensy = Download the hex file to the device, using teensy_loader_cli.
32 # (must have teensy_loader_cli installed).
34 # make dfu = Download the hex file to the device, using dfu-programmer (must
35 # have dfu-programmer installed).
37 # make flip = Download the hex file to the device, using Atmel FLIP (must
38 # have Atmel FLIP installed).
40 # make dfu-ee = Download the eeprom file to the device, using dfu-programmer
41 # (must have dfu-programmer installed).
43 # make flip-ee = Download the eeprom file to the device, using Atmel FLIP
44 # (must have Atmel FLIP installed).
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.
49 # make filename.s = Just compile filename.c into the assembler code only.
51 # make filename.i = Create a preprocessed source file for use in submitting
52 # bug reports to the GCC project.
54 # To rebuild project do "make clean" then "make all".
55 #----------------------------------------------------------------------------
58 # Output format. (can be srec, ihex, binary)
63 # Object files directory
64 # To put object files in current directory, use a dot (.), do NOT make
65 # this an empty or blank macro!
66 OBJDIR = $(BUILD_DIR)/obj_$(TARGET)
69 # Optimization level, can be [0, 1, 2, 3, s].
70 # 0 = turn off optimization. s = optimize for size.
71 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
76 # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
77 # AVR Studio 4.10 requires dwarf-2.
78 # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
86 ERROR_COLOR=\033[31;01m
87 WARN_COLOR=\033[33;01m
92 OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
93 ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)
94 WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)
100 TAB_LOG = printf "\n$$LOG\n\n" | awk '{ sub(/^/," | "); print }'
101 TAB_LOG_PLAIN = printf "$$LOG\n"
102 AWK_STATUS = awk '{ printf " %-10s\n", $$1; }'
103 AWK_CMD = awk '{ printf "%-69s", $$0; }'
104 PRINT_ERROR = ($(SILENT) ||printf "$(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && false
105 PRINT_WARNING = ($(SILENT) || printf "$(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
106 PRINT_ERROR_PLAIN = ($(SILENT) ||printf "$(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && false
107 PRINT_WARNING_PLAIN = ($(SILENT) || printf "$(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
108 PRINT_OK = $(SILENT) || printf "$(OK_STRING)" | $(AWK_STATUS)
109 BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
111 # List any extra directories to look for include files here.
112 # Each directory must be seperated by a space.
113 # Use forward slashes for directory separators.
114 # For a directory that has spaces, enclose it in quotes.
115 EXTRAINCDIRS = $(subst :, ,$(VPATH))
118 # Compiler flag to set the C Standard level.
120 # gnu89 = c89 plus GCC extensions
121 # c99 = ISO C99 standard (not yet fully implemented)
122 # gnu99 = c99 plus GCC extensions
123 CSTANDARD = -std=gnu99
126 # Place -D or -U options here for C sources
127 CDEFS = -DF_CPU=$(F_CPU)UL
131 # Place -D or -U options here for ASM sources
132 ADEFS = -DF_CPU=$(F_CPU)
136 # Place -D or -U options here for C++ sources
137 CPPDEFS = -DF_CPU=$(F_CPU)UL
138 #CPPDEFS += -D__STDC_LIMIT_MACROS
139 #CPPDEFS += -D__STDC_CONSTANT_MACROS
140 CPPDEFS += $(OPT_DEFS)
144 #---------------- Compiler Options C ----------------
145 # -g*: generate debugging information
146 # -O*: optimization level
147 # -f...: tuning, see GCC manual and avr-libc documentation
148 # -Wall...: warning level
149 # -Wa,...: tell GCC to pass this to the assembler.
150 # -adhlns...: create assembler listing
154 CFLAGS += -funsigned-char
155 CFLAGS += -funsigned-bitfields
156 CFLAGS += -ffunction-sections
157 CFLAGS += -fdata-sections
158 CFLAGS += -fno-inline-small-functions
159 CFLAGS += -fpack-struct
160 CFLAGS += -fshort-enums
161 CFLAGS += -fno-strict-aliasing
164 ifeq ("$(echo "int main(){}" | $(CC) -fdiagnostics-color -x c - -o /dev/null 2>&1)", "")
165 CFLAGS+= -fdiagnostics-color
169 CFLAGS += -Wstrict-prototypes
170 #CFLAGS += -mshort-calls
171 #CFLAGS += -fno-unit-at-a-time
173 #CFLAGS += -Wunreachable-code
174 #CFLAGS += -Wsign-compare
175 CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
176 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
177 CFLAGS += $(CSTANDARD)
179 CFLAGS += -include $(CONFIG_H)
183 #---------------- Compiler Options C++ ----------------
184 # -g*: generate debugging information
185 # -O*: optimization level
186 # -f...: tuning, see GCC manual and avr-libc documentation
187 # -Wall...: warning level
188 # -Wa,...: tell GCC to pass this to the assembler.
189 # -adhlns...: create assembler listing
190 CPPFLAGS = -g$(DEBUG)
191 CPPFLAGS += $(CPPDEFS)
193 CPPFLAGS += -funsigned-char
194 CPPFLAGS += -funsigned-bitfields
195 CPPFLAGS += -fpack-struct
196 CPPFLAGS += -fshort-enums
197 CPPFLAGS += -fno-exceptions
198 CPPFLAGS += -ffunction-sections
199 CPPFLAGS += -fdata-sections
200 # to supress "warning: only initialized variables can be placed into program memory area"
204 #CPPFLAGS += -mshort-calls
205 #CPPFLAGS += -fno-unit-at-a-time
206 #CPPFLAGS += -Wstrict-prototypes
207 #CPPFLAGS += -Wunreachable-code
208 #CPPFLAGS += -Wsign-compare
209 CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
210 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
211 #CPPFLAGS += $(CSTANDARD)
213 CPPFLAGS += -include $(CONFIG_H)
217 #---------------- Assembler Options ----------------
218 # -Wa,...: tell GCC to pass this to the assembler.
219 # -adhlns: create listing
220 # -gstabs: have the assembler create line number information; note that
221 # for use in COFF files, additional information about filenames
222 # and function names needs to be present in the assembler source
223 # files -- see avr-libc docs [FIXME: not yet described there]
224 # -listing-cont-lines: Sets the maximum number of continuation lines of hex
225 # dump that will be displayed for a given single line of source input.
226 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
227 ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
229 ASFLAGS += -include $(CONFIG_H)
232 #---------------- Library Options ----------------
233 # Minimalistic printf version
234 PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
236 # Floating point printf version (requires MATH_LIB = -lm below)
237 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
239 # If this is left blank, then it will use the Standard printf version.
241 #PRINTF_LIB = $(PRINTF_LIB_MIN)
242 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
245 # Minimalistic scanf version
246 SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
248 # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
249 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
251 # If this is left blank, then it will use the Standard scanf version.
253 #SCANF_LIB = $(SCANF_LIB_MIN)
254 #SCANF_LIB = $(SCANF_LIB_FLOAT)
260 # List any extra directories to look for libraries here.
261 # Each directory must be seperated by a space.
262 # Use forward slashes for directory separators.
263 # For a directory that has spaces, enclose it in quotes.
268 #---------------- External Memory Options ----------------
270 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
271 # used for variables (.data/.bss) and heap (malloc()).
272 #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
274 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
275 # only used for heap (malloc()).
276 #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
282 #---------------- Linker Options ----------------
283 # -Wl,...: tell GCC to pass this to linker.
284 # -Map: create map file
285 # --cref: add cross reference to map file
287 # Comennt out "--relax" option to avoid a error such:
288 # (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
290 LDFLAGS = -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
291 #LDFLAGS += -Wl,--relax
292 LDFLAGS += -Wl,--gc-sections
293 LDFLAGS += $(EXTMEMOPTS)
294 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
295 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
296 #LDFLAGS += -T linker_script.x
297 # You can give EXTRALDFLAGS at 'make' command line.
298 LDFLAGS += $(EXTRALDFLAGS)
302 #---------------- Debugging Options ----------------
304 # For simulavr only - target MCU frequency.
305 DEBUG_MFREQ = $(F_CPU)
307 # Set the DEBUG_UI to either gdb or insight.
311 # Set the debugging back-end to either avarice, simulavr.
312 DEBUG_BACKEND = avarice
313 #DEBUG_BACKEND = simulavr
316 GDBINIT_FILE = __avr_gdbinit
318 # When using avarice settings for the JTAG
321 # Debugging port used to communicate between GDB / avarice / simulavr.
324 # Debugging host used to communicate between GDB / avarice / simulavr, normally
325 # just set to localhost unless doing some sort of crazy debugging when
326 # avarice is running on a different computer.
327 DEBUG_HOST = localhost
331 #============================================================================
334 # Define programs and commands.
337 OBJCOPY = avr-objcopy
338 OBJDUMP = avr-objdump
346 SECHO = $(SILENT) || echo
347 # Autodecct teensy loader
348 ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
349 TEENSY_LOADER_CLI = teensy-loader-cli
351 TEENSY_LOADER_CLI = teensy_loader_cli
356 MSG_ERRORS_NONE = Errors: none
357 MSG_BEGIN = -------- begin --------
358 MSG_END = -------- end --------
359 MSG_SIZE_BEFORE = Size before:
360 MSG_SIZE_AFTER = Size after:
361 MSG_COFF = Converting to AVR COFF:
362 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
363 MSG_FLASH = Creating load file for Flash:
364 MSG_EEPROM = Creating load file for EEPROM:
365 MSG_EXTENDED_LISTING = Creating Extended Listing:
366 MSG_SYMBOL_TABLE = Creating Symbol Table:
367 MSG_LINKING = Linking:
368 MSG_COMPILING = Compiling:
369 MSG_COMPILING_CPP = Compiling:
370 MSG_ASSEMBLING = Assembling:
371 MSG_CLEANING = Cleaning project:
372 MSG_CREATING_LIBRARY = Creating library:
377 # Define all object files.
378 OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(patsubst %.cpp,$(OBJDIR)/%.o,$(patsubst %.S,$(OBJDIR)/%.o,$(SRC))))
380 # Define all listing files.
381 LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst %.S,$(OBJDIR)/%.lst,$(SRC))))
384 # Compiler flags to generate dependency files.
385 #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
386 GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$@).d
389 # Combine all necessary flags and optional flags.
390 # Add target processor to flags.
391 # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
392 ALL_CFLAGS = -mmcu=$(MCU) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
393 ALL_CPPFLAGS = -mmcu=$(MCU) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
394 ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
401 @$(MAKE) clean_list # force clean each time
406 # Quick make that doesn't clean
415 # Change the build target to build a HEX file or a library.
417 #build: elf hex eep lss sym
421 elf: $(BUILD_DIR)/$(TARGET).elf
422 hex: $(BUILD_DIR)/$(TARGET).hex
423 eep: $(BUILD_DIR)/$(TARGET).eep
424 lss: $(BUILD_DIR)/$(TARGET).lss
425 sym: $(BUILD_DIR)/$(TARGET).sym
426 LIBNAME=lib$(TARGET).a
432 # AVR Studio 3.x does not check make's exit code but relies on
433 # the following magic strings to be generated by the compile job.
435 @$(SECHO) $(MSG_BEGIN)
441 # Display size of file.
442 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
443 #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
444 ELFSIZE = $(SIZE) $(BUILD_DIR)/$(TARGET).elf
447 @if test -f $(TARGET).hex; then $(SECHO) $(MSG_SIZE_BEFORE); $(SILENT) || $(HEXSIZE); \
448 2>/dev/null; $(SECHO); fi
451 @if test -f $(TARGET).hex; then $(SECHO); $(SECHO) $(MSG_SIZE_AFTER); $(SILENT) || $(HEXSIZE); \
452 2>/dev/null; $(SECHO); fi
453 # test file sizes eventually
454 # @if [[ $($(SIZE) --target=$(FORMAT) $(TARGET).hex | awk 'NR==2 {print "0x"$5}') -gt 0x200 ]]; then $(SECHO) "File is too big!"; fi
456 # Display compiler version information.
458 @$(SILENT) || $(CC) --version
462 # Program the device.
463 program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
466 teensy: $(BUILD_DIR)/$(TARGET).hex
467 $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex
469 flip: $(BUILD_DIR)/$(TARGET).hex
470 batchisp -hardware usb -device $(MCU) -operation erase f
471 batchisp -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program
472 batchisp -hardware usb -device $(MCU) -operation start reset 0
474 dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
475 ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
476 dfu-programmer $(MCU) erase --force
478 dfu-programmer $(MCU) erase
480 dfu-programmer $(MCU) erase
481 dfu-programmer $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
482 dfu-programmer $(MCU) reset
485 ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
486 dfu-programmer $(MCU) erase --force
488 dfu-programmer $(MCU) erase
490 dfu-programmer $(MCU) erase
491 dfu-programmer $(MCU) flash $(KEYMAP_PATH)/compiled.hex
492 dfu-programmer $(MCU) reset
495 dfu-programmer $(MCU) reset
496 dfu-programmer $(MCU) start
498 flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
499 $(COPY) $(BUILD_DIR)/$(TARGET).eep $(BUILD_DIR)/$(TARGET)eep.hex
500 batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
501 batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(BUILD_DIR)/$(TARGET)eep.hex program
502 batchisp -hardware usb -device $(MCU) -operation start reset 0
503 $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
505 dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
506 ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
507 dfu-programmer $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep
509 dfu-programmer $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep
511 dfu-programmer $(MCU) reset
514 # Generate avr-gdb config/init file which does the following:
515 # define the reset signal, load the target file, connect to target, and set
516 # a breakpoint at main().
518 @$(REMOVE) $(GDBINIT_FILE)
519 @echo define reset >> $(GDBINIT_FILE)
520 @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
521 @echo end >> $(GDBINIT_FILE)
522 @echo file $(BUILD_DIR)/$(TARGET).elf >> $(GDBINIT_FILE)
523 @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
524 ifeq ($(DEBUG_BACKEND),simulavr)
525 @echo load >> $(GDBINIT_FILE)
527 @echo break main >> $(GDBINIT_FILE)
529 debug: gdb-config $(BUILD_DIR)/$(TARGET).elf
530 ifeq ($(DEBUG_BACKEND), avarice)
531 @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
532 @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
533 $(BUILD_DIR)/$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
534 @$(WINSHELL) /c pause
537 @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
538 $(DEBUG_MFREQ) --port $(DEBUG_PORT)
540 @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
545 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
546 COFFCONVERT = $(OBJCOPY) --debugging
547 COFFCONVERT += --change-section-address .data-0x800000
548 COFFCONVERT += --change-section-address .bss-0x800000
549 COFFCONVERT += --change-section-address .noinit-0x800000
550 COFFCONVERT += --change-section-address .eeprom-0x810000
554 coff: $(BUILD_DIR)/$(TARGET).elf
555 @$(SECHO) $(MSG_COFF) $(BUILD_DIR)/$(TARGET).cof
556 $(COFFCONVERT) -O coff-avr $< $(BUILD_DIR)/$(TARGET).cof
559 extcoff: $(BUILD_DIR)/$(TARGET).elf
560 @$(SECHO) $(MSG_EXTENDED_COFF) $(BUILD_DIR)/$(TARGET).cof
561 $(COFFCONVERT) -O coff-ext-avr $< $(BUILD_DIR)/$(TARGET).cof
565 # Create final output files (.hex, .eep) from ELF output file.
567 @$(SILENT) || printf "$(MSG_FLASH) $@" | $(AWK_CMD)
568 $(eval CMD=$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@)
570 @$(COPY) $@ $(TARGET).hex
571 $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/compiled.hex" | $(AWK_CMD)
572 $(eval CMD=$(COPY) $@ $(KEYMAP_PATH)/compiled.hex)
576 @$(SILENT) || printf "$(MSG_EEPROM) $@" | $(AWK_CMD)
577 $(eval CMD=$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0)
580 # Create extended listing file from ELF output file.
582 @$(SILENT) || printf "$(MSG_EXTENDED_LISTING) $@" | $(AWK_CMD)
583 $(eval CMD=$(OBJDUMP) -h -S -z $< > $@)
586 # Create a symbol table from ELF output file.
588 @$(SILENT) || printf "$(MSG_SYMBOL_TABLE) $@" | $(AWK_CMD)
589 $(eval CMD=$(NM) -n $< > $@ )
592 # Create library from object files.
593 .SECONDARY : $(BUILD_DIR)/$(TARGET).a
596 @$(SILENT) || printf "$(MSG_CREATING_LIBRARY) $@" | $(AWK_CMD)
597 $(eval CMD=$(AR) $@ $(OBJ) )
600 # Link: create ELF output file from object files.
601 .SECONDARY : $(BUILD_DIR)/$(TARGET).elf
604 @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
605 $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
608 # Compile: create object files from C source files.
611 @$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD)
612 $(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@)
615 # Compile: create object files from C++ source files.
616 $(OBJDIR)/%.o : %.cpp
618 @$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD)
619 $(CC) -c $(ALL_CPPFLAGS) $< -o $@
622 # Compile: create assembler files from C source files.
624 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
625 $(eval CMD=$(CC) -S $(ALL_CFLAGS) $< -o $@)
628 # Compile: create assembler files from C++ source files.
630 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
631 $(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@)
634 # Assemble: create object files from assembler source files.
637 @$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
638 $(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@)
641 # Create preprocessed source for use in sending a bug report.
643 $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
645 # Target: clean project.
646 clean: begin clean_list end
649 $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR)
650 $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR)
651 $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR)
657 SUBDIRS := $(sort $(dir $(wildcard $(TOP_DIR)/keyboard/*/.)))
658 all-keyboards-defaults:
659 @for x in $(SUBDIRS) ; do \
660 printf "Compiling with default: $$x" | $(AWK_CMD); \
661 LOG=$$($(MAKE) -C $$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; \
664 KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboard/%/=/keyboard/%)
665 all-keyboards: $(KEYBOARDS)
667 $(eval KEYBOARD=$(patsubst /keyboard/%,%,$@))
668 $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)$@/keymaps/*/.))))
669 @for x in $(KEYMAPS) ; do \
670 printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | awk '{ printf "%-88s", $$0; }'; \
671 LOG=$$($(MAKE) -C $(TOP_DIR)$@ 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; \
675 $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboard/$(KEYBOARD)/keymaps/*/.))))
676 @for x in $(KEYMAPS) ; do \
677 printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | awk '{ printf "%-88s", $$0; }'; \
678 LOG=$$($(MAKE) 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; \
681 # Create build directory
682 $(shell mkdir $(BUILD_DIR) 2>/dev/null)
684 # Create object files directory
685 $(shell mkdir $(OBJDIR) 2>/dev/null)
688 # Include the dependency files.
689 -include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
692 # Listing of phony targets.
693 .PHONY : all quick begin finish end sizebefore sizeafter gccversion \
694 build elf hex eep lss sym coff extcoff \
695 clean clean_list debug gdb-config show_path \
696 program teensy dfu flip dfu-ee flip-ee dfu-start \
697 all-keyboards-defaults all-keyboards all-keymaps