1 # Hey Emacs, this is a -*- makefile -*-
 
   2 #----------------------------------------------------------------------------
 
   3 # WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
 
   4 #  >> Modified for use with the LUFA project. <<
 
   6 # Released to the Public Domain
 
   8 # Additional material for this makefile was written by:
 
  21 #----------------------------------------------------------------------------
 
  24 # make all = Make software.
 
  26 # make clean = Clean out built project files.
 
  28 # make coff = Convert ELF to AVR COFF.
 
  30 # make extcoff = Convert ELF to AVR Extended COFF.
 
  32 # make program = Download the hex file to the device, using avrdude.
 
  33 #                Please customize the avrdude settings below first!
 
  35 # make doxygen = Generate DoxyGen documentation for the project (must have
 
  38 # make debug = Start either simulavr or avarice as specified for debugging, 
 
  39 #              with avr-gdb or avr-insight as the front end for debugging.
 
  41 # make filename.s = Just compile filename.c into the assembler code only.
 
  43 # make filename.i = Create a preprocessed source file for use in submitting
 
  44 #                   bug reports to the GCC project.
 
  46 # To rebuild project do "make clean" then "make all".
 
  47 #----------------------------------------------------------------------------
 
  54 # Target board (see library BoardTypes.h documentation, USER or blank for projects not requiring
 
  55 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called 
 
  56 # "Board" inside the application directory.
 
  60 # Processor frequency.
 
  61 #     This will define a symbol, F_CPU, in all source code files equal to the 
 
  62 #     processor frequency. You can then use this symbol in your source code to 
 
  63 #     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
 
  64 #     automatically to create a 32-bit value in your source code.
 
  81 # Input clock frequency.
 
  82 #     This will define a symbol, F_CLOCK, in all source code files equal to the 
 
  83 #     input clock frequency (before any prescaling is performed). This value may
 
  84 #     differ from F_CPU if prescaling is used on the latter, and is required as the
 
  85 #     raw input clock is fed directly to the PLL sections of the AVR for high speed
 
  86 #     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
 
  87 #     at the end, this will be done automatically to create a 32-bit value in your
 
  90 #     If no clock division is performed on the input clock inside the AVR (via the
 
  91 #     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
 
  95 # Output format. (can be srec, ihex, binary)
 
  99 # Target file name (without extension).
 
 100 TARGET = BootloaderDFU
 
 103 # Object files directory
 
 104 #     To put object files in current directory, use a dot (.), do NOT make
 
 105 #     this an empty or blank macro!
 
 109 # List C source files here. (C dependencies are automatically generated.)
 
 112           ../../LUFA/Drivers/USB/LowLevel/LowLevel.c           \
 
 113           ../../LUFA/Drivers/USB/LowLevel/Endpoint.c           \
 
 114           ../../LUFA/Drivers/USB/LowLevel/DevChapter9.c        \
 
 115           ../../LUFA/Drivers/USB/HighLevel/USBTask.c           \
 
 116           ../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c      \
 
 117           ../../LUFA/Drivers/USB/HighLevel/Events.c            \
 
 118           ../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c    \
 
 120 # List C++ source files here. (C dependencies are automatically generated.)
 
 124 # List Assembler source files here.
 
 125 #     Make them always end in a capital .S.  Files ending in a lowercase .s
 
 126 #     will not be considered source files but generated files (assembler
 
 127 #     output from the compiler), and will be deleted upon "make clean"!
 
 128 #     Even though the DOS/Win* filesystem matches both .s and .S the same,
 
 129 #     it will preserve the spelling of the filenames, and gcc itself does
 
 130 #     care about how the name is spelled on its command-line.
 
 134 # Optimization level, can be [0, 1, 2, 3, s]. 
 
 135 #     0 = turn off optimization. s = optimize for size.
 
 136 #     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
 
 141 #     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
 
 142 #     AVR Studio 4.10 requires dwarf-2.
 
 143 #     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
 
 147 # List any extra directories to look for include files here.
 
 148 #     Each directory must be seperated by a space.
 
 149 #     Use forward slashes for directory separators.
 
 150 #     For a directory that has spaces, enclose it in quotes.
 
 151 EXTRAINCDIRS = ../../
 
 154 # Compiler flag to set the C Standard level.
 
 156 #     gnu89 = c89 plus GCC extensions
 
 157 #     c99   = ISO C99 standard (not yet fully implemented)
 
 158 #     gnu99 = c99 plus GCC extensions
 
 159 CSTANDARD = -std=gnu99
 
 162 # Starting byte address of the bootloader
 
 166 # Place -D or -U options here for C sources
 
 167 CDEFS  = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)
 
 168 CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DFEATURELESS_CONTROL_ONLY_DEVICE
 
 169 CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=32
 
 170 CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
 
 171 CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION
 
 174 # Place -D or -U options here for ASM sources
 
 175 ADEFS = -DF_CPU=$(F_CPU)
 
 178 # Place -D or -U options here for C++ sources
 
 179 CPPDEFS = -DF_CPU=$(F_CPU)UL
 
 180 #CPPDEFS += -D__STDC_LIMIT_MACROS
 
 181 #CPPDEFS += -D__STDC_CONSTANT_MACROS
 
 185 #---------------- Compiler Options C ----------------
 
 186 #  -g*:          generate debugging information
 
 187 #  -O*:          optimization level
 
 188 #  -f...:        tuning, see GCC manual and avr-libc documentation
 
 189 #  -Wall...:     warning level
 
 190 #  -Wa,...:      tell GCC to pass this to the assembler.
 
 191 #    -adhlns...: create assembler listing
 
 195 CFLAGS += -funsigned-char
 
 196 CFLAGS += -funsigned-bitfields
 
 197 CFLAGS += -ffunction-sections
 
 198 CFLAGS += -fdata-sections
 
 199 CFLAGS += -fpack-struct
 
 200 CFLAGS += -fshort-enums
 
 201 CFLAGS += -fno-inline-small-functions
 
 202 CFLAGS += -fno-reorder-blocks
 
 203 CFLAGS += -fno-reorder-blocks-and-partition
 
 204 CFLAGS += -fno-reorder-functions
 
 205 CFLAGS += -fno-toplevel-reorder
 
 207 CFLAGS += -Wstrict-prototypes
 
 209 #CFLAGS += -fno-unit-at-a-time
 
 210 #CFLAGS += -Wunreachable-code
 
 211 #CFLAGS += -Wsign-compare
 
 212 CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
 
 213 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 
 214 CFLAGS += $(CSTANDARD)
 
 217 #---------------- Compiler Options C++ ----------------
 
 218 #  -g*:          generate debugging information
 
 219 #  -O*:          optimization level
 
 220 #  -f...:        tuning, see GCC manual and avr-libc documentation
 
 221 #  -Wall...:     warning level
 
 222 #  -Wa,...:      tell GCC to pass this to the assembler.
 
 223 #    -adhlns...: create assembler listing
 
 224 CPPFLAGS = -g$(DEBUG)
 
 225 CPPFLAGS += $(CPPDEFS)
 
 227 CPPFLAGS += -funsigned-char
 
 228 CPPFLAGS += -funsigned-bitfields
 
 229 CPPFLAGS += -fpack-struct
 
 230 CPPFLAGS += -fshort-enums
 
 231 CPPFLAGS += -fno-exceptions
 
 234 #CPPFLAGS += -mshort-calls
 
 235 #CPPFLAGS += -fno-unit-at-a-time
 
 236 #CPPFLAGS += -Wstrict-prototypes
 
 237 #CPPFLAGS += -Wunreachable-code
 
 238 #CPPFLAGS += -Wsign-compare
 
 239 CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
 
 240 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 
 241 #CPPFLAGS += $(CSTANDARD)
 
 244 #---------------- Assembler Options ----------------
 
 245 #  -Wa,...:   tell GCC to pass this to the assembler.
 
 246 #  -adhlns:   create listing
 
 247 #  -gstabs:   have the assembler create line number information; note that
 
 248 #             for use in COFF files, additional information about filenames
 
 249 #             and function names needs to be present in the assembler source
 
 250 #             files -- see avr-libc docs [FIXME: not yet described there]
 
 251 #  -listing-cont-lines: Sets the maximum number of continuation lines of hex 
 
 252 #       dump that will be displayed for a given single line of source input.
 
 253 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
 
 256 #---------------- Library Options ----------------
 
 257 # Minimalistic printf version
 
 258 PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
 
 260 # Floating point printf version (requires MATH_LIB = -lm below)
 
 261 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
 
 263 # If this is left blank, then it will use the Standard printf version.
 
 265 #PRINTF_LIB = $(PRINTF_LIB_MIN)
 
 266 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
 
 269 # Minimalistic scanf version
 
 270 SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
 
 272 # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
 
 273 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
 
 275 # If this is left blank, then it will use the Standard scanf version.
 
 277 #SCANF_LIB = $(SCANF_LIB_MIN)
 
 278 #SCANF_LIB = $(SCANF_LIB_FLOAT)
 
 284 # List any extra directories to look for libraries here.
 
 285 #     Each directory must be seperated by a space.
 
 286 #     Use forward slashes for directory separators.
 
 287 #     For a directory that has spaces, enclose it in quotes.
 
 292 #---------------- External Memory Options ----------------
 
 294 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
 
 295 # used for variables (.data/.bss) and heap (malloc()).
 
 296 #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
 
 298 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
 
 299 # only used for heap (malloc()).
 
 300 #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
 
 306 #---------------- Linker Options ----------------
 
 307 #  -Wl,...:     tell GCC to pass this to linker.
 
 308 #    -Map:      create map file
 
 309 #    --cref:    add cross reference to  map file
 
 310 LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
 
 311 LDFLAGS += -Wl,--relax
 
 312 LDFLAGS += -Wl,--gc-sections
 
 313 LDFLAGS += -Wl,--section-start=.text=$(BOOT_START)
 
 314 LDFLAGS += $(EXTMEMOPTS)
 
 315 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
 
 316 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
 
 317 #LDFLAGS += -T linker_script.x
 
 321 #---------------- Programming Options (avrdude) ----------------
 
 323 # Programming hardware: alf avr910 avrisp bascom bsd 
 
 324 # dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
 
 327 # to get a full listing.
 
 329 AVRDUDE_PROGRAMMER = jtagmkII
 
 331 # com1 = serial port. Use lpt1 to connect to parallel port.
 
 334 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
 
 335 #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 
 338 # Uncomment the following if you want avrdude's erase cycle counter.
 
 339 # Note that this counter needs to be initialized first using -Yn,
 
 340 # see avrdude manual.
 
 341 #AVRDUDE_ERASE_COUNTER = -y
 
 343 # Uncomment the following if you do /not/ wish a verification to be
 
 344 # performed after programming the device.
 
 345 AVRDUDE_NO_VERIFY = -V
 
 347 # Increase verbosity level.  Please use this when submitting bug
 
 348 # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
 
 349 # to submit bug reports.
 
 350 #AVRDUDE_VERBOSE = -v -v
 
 352 AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
 
 353 AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
 
 354 AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
 
 355 AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
 
 359 #---------------- Debugging Options ----------------
 
 361 # For simulavr only - target MCU frequency.
 
 362 DEBUG_MFREQ = $(F_CPU)
 
 364 # Set the DEBUG_UI to either gdb or insight.
 
 368 # Set the debugging back-end to either avarice, simulavr.
 
 369 DEBUG_BACKEND = avarice
 
 370 #DEBUG_BACKEND = simulavr
 
 373 GDBINIT_FILE = __avr_gdbinit
 
 375 # When using avarice settings for the JTAG
 
 378 # Debugging port used to communicate between GDB / avarice / simulavr.
 
 381 # Debugging host used to communicate between GDB / avarice / simulavr, normally
 
 382 #     just set to localhost unless doing some sort of crazy debugging when 
 
 383 #     avarice is running on a different computer.
 
 384 DEBUG_HOST = localhost
 
 388 #============================================================================
 
 391 # Define programs and commands.
 
 394 OBJCOPY = avr-objcopy
 
 395 OBJDUMP = avr-objdump
 
 407 MSG_ERRORS_NONE = Errors: none
 
 408 MSG_BEGIN = -------- begin --------
 
 409 MSG_END = --------  end  --------
 
 410 MSG_SIZE_BEFORE = Size before: 
 
 411 MSG_SIZE_AFTER = Size after:
 
 412 MSG_COFF = Converting to AVR COFF:
 
 413 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
 
 414 MSG_FLASH = Creating load file for Flash:
 
 415 MSG_EEPROM = Creating load file for EEPROM:
 
 416 MSG_EXTENDED_LISTING = Creating Extended Listing:
 
 417 MSG_SYMBOL_TABLE = Creating Symbol Table:
 
 418 MSG_LINKING = Linking:
 
 419 MSG_COMPILING = Compiling C:
 
 420 MSG_COMPILING_CPP = Compiling C++:
 
 421 MSG_ASSEMBLING = Assembling:
 
 422 MSG_CLEANING = Cleaning project:
 
 423 MSG_CREATING_LIBRARY = Creating library:
 
 428 # Define all object files.
 
 429 OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) 
 
 431 # Define all listing files.
 
 432 LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) 
 
 435 # Compiler flags to generate dependency files.
 
 436 GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
 
 439 # Combine all necessary flags and optional flags.
 
 440 # Add target processor to flags.
 
 441 ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
 
 442 ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
 
 443 ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 
 450 all: begin gccversion sizebefore build checkhooks checklibmode sizeafter end
 
 452 # Change the build target to build a HEX file or a library.
 
 453 build: elf hex eep lss sym
 
 462 LIBNAME=lib$(TARGET).a
 
 468 # AVR Studio 3.x does not check make's exit code but relies on
 
 469 # the following magic strings to be generated by the compile job.
 
 479 # Display size of file.
 
 480 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
 
 481 ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
 
 482 MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
 
 483 FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
 
 486         @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
 
 487         2>/dev/null; echo; fi
 
 490         @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
 
 491         2>/dev/null; echo; fi
 
 495         @echo ------- Unhooked LUFA Events -------
 
 496         @$(shell) (grep -s '^Event.*LUFA/.*\\.o' $(TARGET).map | \
 
 497                    cut -d' ' -f1 | cut -d'_' -f2- | grep ".*") || \
 
 499         @echo ----- End Unhooked LUFA Events -----
 
 503         @echo ----------- Library Mode -----------
 
 504         @$(shell) ($(CC) $(ALL_CFLAGS) -E -dM - < /dev/null \
 
 505                   | grep 'USB_\(DEVICE\|HOST\)_ONLY' | cut -d' ' -f2 | grep ".*") \
 
 506                   || echo "No specific mode (both device and host mode allowable)."
 
 507         @echo ------------------------------------
 
 509 # Display compiler version information.
 
 515 # Program the device.  
 
 516 program: $(TARGET).hex $(TARGET).eep
 
 517         $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 
 521 # Generate avr-gdb config/init file which does the following:
 
 522 #     define the reset signal, load the target file, connect to target, and set 
 
 523 #     a breakpoint at main().
 
 525         @$(REMOVE) $(GDBINIT_FILE)
 
 526         @echo define reset >> $(GDBINIT_FILE)
 
 527         @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
 
 528         @echo end >> $(GDBINIT_FILE)
 
 529         @echo file $(TARGET).elf >> $(GDBINIT_FILE)
 
 530         @echo target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)
 
 531 ifeq ($(DEBUG_BACKEND),simulavr)
 
 532         @echo load  >> $(GDBINIT_FILE)
 
 534         @echo break main >> $(GDBINIT_FILE)
 
 536 debug: gdb-config $(TARGET).elf
 
 537 ifeq ($(DEBUG_BACKEND), avarice)
 
 538         @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
 
 539         @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
 
 540         $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
 
 541         @$(WINSHELL) /c pause
 
 544         @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
 
 545         $(DEBUG_MFREQ) --port $(DEBUG_PORT)
 
 547         @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
 
 552 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
 
 553 COFFCONVERT = $(OBJCOPY) --debugging
 
 554 COFFCONVERT += --change-section-address .data-0x800000
 
 555 COFFCONVERT += --change-section-address .bss-0x800000
 
 556 COFFCONVERT += --change-section-address .noinit-0x800000
 
 557 COFFCONVERT += --change-section-address .eeprom-0x810000
 
 563         @echo $(MSG_COFF) $(TARGET).cof
 
 564         $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
 
 567 extcoff: $(TARGET).elf
 
 569         @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
 
 570         $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
 
 574 # Create final output files (.hex, .eep) from ELF output file.
 
 577         @echo $(MSG_FLASH) $@
 
 578         $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
 
 582         @echo $(MSG_EEPROM) $@
 
 583         -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
 
 584         --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
 
 586 # Create extended listing file from ELF output file.
 
 589         @echo $(MSG_EXTENDED_LISTING) $@
 
 590         $(OBJDUMP) -h -z -S $< > $@
 
 592 # Create a symbol table from ELF output file.
 
 595         @echo $(MSG_SYMBOL_TABLE) $@
 
 600 # Create library from object files.
 
 601 .SECONDARY : $(TARGET).a
 
 605         @echo $(MSG_CREATING_LIBRARY) $@
 
 609 # Link: create ELF output file from object files.
 
 610 .SECONDARY : $(TARGET).elf
 
 614         @echo $(MSG_LINKING) $@
 
 615         $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
 
 618 # Compile: create object files from C source files.
 
 621         @echo $(MSG_COMPILING) $<
 
 622         $(CC) -c $(ALL_CFLAGS) $< -o $@ 
 
 625 # Compile: create object files from C++ source files.
 
 626 $(OBJDIR)/%.o : %.cpp
 
 628         @echo $(MSG_COMPILING_CPP) $<
 
 629         $(CC) -c $(ALL_CPPFLAGS) $< -o $@ 
 
 632 # Compile: create assembler files from C source files.
 
 634         $(CC) -S $(ALL_CFLAGS) $< -o $@
 
 637 # Compile: create assembler files from C++ source files.
 
 639         $(CC) -S $(ALL_CPPFLAGS) $< -o $@
 
 642 # Assemble: create object files from assembler source files.
 
 645         @echo $(MSG_ASSEMBLING) $<
 
 646         $(CC) -c $(ALL_ASFLAGS) $< -o $@
 
 649 # Create preprocessed source for use in sending a bug report.
 
 651         $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ 
 
 654 # Target: clean project.
 
 655 clean: begin clean_list clean_binary end
 
 658         $(REMOVE) $(TARGET).hex
 
 661         @echo $(MSG_CLEANING)
 
 662         $(REMOVE) $(TARGET).eep
 
 663         $(REMOVE) $(TARGET).cof
 
 664         $(REMOVE) $(TARGET).elf
 
 665         $(REMOVE) $(TARGET).map
 
 666         $(REMOVE) $(TARGET).sym
 
 667         $(REMOVE) $(TARGET).lss
 
 668         $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
 
 669         $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
 
 670         $(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.o)
 
 671         $(REMOVE) $(ASRC:%.S=$(OBJDIR)/%.lst)
 
 672         $(REMOVE) $(SRC:.c=.s)
 
 673         $(REMOVE) $(SRC:.c=.d)
 
 674         $(REMOVE) $(SRC:.c=.i)
 
 679         @echo Generating Project Documentation...
 
 680         @doxygen Doxygen.conf
 
 681         @echo Documentation Generation Complete.
 
 686 # Create object files directory
 
 687 $(shell mkdir $(OBJDIR) 2>/dev/null)
 
 690 # Include the dependency files.
 
 691 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
 
 694 # Listing of phony targets.
 
 695 .PHONY : all checkhooks checklibmode begin  \
 
 696 finish end sizebefore sizeafter gccversion  \
 
 697 build elf hex eep lss sym coff extcoff      \
 
 698 clean clean_list clean_binary program debug \
 
 699 gdb-config doxygen clean_doxygen