]> git.donarmstrong.com Git - tmk_firmware.git/blob - Makefile.common
d212424360c39552c759d2fd2467cbae6dc7e11b
[tmk_firmware.git] / Makefile.common
1 # Hey Emacs, this is a -*- makefile -*-
2 #----------------------------------------------------------------------------
3 # WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
4 #
5 # Released to the Public Domain
6 #
7 # Additional material for this makefile was written by:
8 # Peter Fleury
9 # Tim Henigan
10 # Colin O'Flynn
11 # Reiner Patommel
12 # Markus Pfaff
13 # Sander Pool
14 # Frederik Rouleau
15 # Carlos Lamas
16 #
17 #----------------------------------------------------------------------------
18 # On command line:
19 #
20 # make all = Make software.
21 #
22 # make clean = Clean out built project files.
23 #
24 # make coff = Convert ELF to AVR COFF.
25 #
26 # make extcoff = Convert ELF to AVR Extended COFF.
27 #
28 # make program = Download the hex file to the device, using avrdude.
29 #                Please customize the avrdude settings below first!
30 #
31 # make debug = Start either simulavr or avarice as specified for debugging, 
32 #              with avr-gdb or avr-insight as the front end for debugging.
33 #
34 # make filename.s = Just compile filename.c into the assembler code only.
35 #
36 # make filename.i = Create a preprocessed source file for use in submitting
37 #                   bug reports to the GCC project.
38 #
39 # To rebuild project do "make clean" then "make all".
40 #----------------------------------------------------------------------------
41
42 # Following variables need to be set in <target>/Makefile:
43 #       TARGET
44 #       COMMON_DIR
45 #       TARGET_DIR
46 #       TARGET_SRC
47 #       MCU
48 #       F_CPU
49
50
51 # List C source files here. (C dependencies are automatically generated.)
52 SRC =   tmk.c \
53         layer.c \
54         key_process.c \
55         usb_keyboard.c \
56         usb_mouse.c \
57         usb_debug.c \
58         usb_extra.c \
59         usb.c \
60         jump_bootloader.c \
61         print.c \
62         timer.c \
63         util.c
64 SRC +=  $(TARGET_SRC)
65
66 # C source file search path
67 VPATH = $(TARGET_DIR):$(COMMON_DIR)
68
69
70 # Output format. (can be srec, ihex, binary)
71 FORMAT = ihex
72
73
74 # Object files directory
75 #     To put object files in current directory, use a dot (.), do NOT make
76 #     this an empty or blank macro!
77 OBJDIR = .
78
79
80 # List C++ source files here. (C dependencies are automatically generated.)
81 CPPSRC = 
82
83
84 # List Assembler source files here.
85 #     Make them always end in a capital .S.  Files ending in a lowercase .s
86 #     will not be considered source files but generated files (assembler
87 #     output from the compiler), and will be deleted upon "make clean"!
88 #     Even though the DOS/Win* filesystem matches both .s and .S the same,
89 #     it will preserve the spelling of the filenames, and gcc itself does
90 #     care about how the name is spelled on its command-line.
91 ASRC =
92
93
94 # Optimization level, can be [0, 1, 2, 3, s]. 
95 #     0 = turn off optimization. s = optimize for size.
96 #     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
97 OPT = s
98
99
100 # Debugging format.
101 #     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
102 #     AVR Studio 4.10 requires dwarf-2.
103 #     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
104 DEBUG = dwarf-2
105
106
107 # List any extra directories to look for include files here.
108 #     Each directory must be seperated by a space.
109 #     Use forward slashes for directory separators.
110 #     For a directory that has spaces, enclose it in quotes.
111 EXTRAINCDIRS = $(TARGET_DIR) $(COMMON_DIR)
112
113
114 # Compiler flag to set the C Standard level.
115 #     c89   = "ANSI" C
116 #     gnu89 = c89 plus GCC extensions
117 #     c99   = ISO C99 standard (not yet fully implemented)
118 #     gnu99 = c99 plus GCC extensions
119 CSTANDARD = -std=gnu99
120
121
122 # Place -D or -U options here for C sources
123 CDEFS = -DF_CPU=$(F_CPU)UL
124 CDEFS += -DDESCRIPTION=$(DESCRIPTION)
125 CDEFS += -DVENDOR_ID=$(VENDOR_ID)
126 CDEFS += -DPRODUCT_ID=$(PRODUCT_ID)
127 CDEFS += -DMANUFACTURER=$(MANUFACTURER)
128 CDEFS += -DPRODUCT=$(PRODUCT)
129 ifdef MOUSE_DELAY_TIME
130 CDEFS += -DMOUSE_DELAY_TIME=$(MOUSE_DELAY_TIME)
131 endif
132 ifdef NKRO_ENABLE
133 CDEFS += -DNKRO_ENABLE
134 endif
135
136
137 # Place -D or -U options here for ASM sources
138 ADEFS = -DF_CPU=$(F_CPU)
139 ADEFS += -DDESCRIPTION=$(DESCRIPTION)
140 ADEFS += -DVENDOR_ID=$(VENDOR_ID)
141 ADEFS += -DPRODUCT_ID=$(PRODUCT_ID)
142 ADEFS += -DMANUFACTURER=$(MANUFACTURER)
143 ADEFS += -DPRODUCT=$(PRODUCT)
144 ifdef MOUSE_DELAY_TIME
145 ADEFS += -DMOUSE_DELAY_TIME=$(MOUSE_DELAY_TIME)
146 endif
147
148
149 # Place -D or -U options here for C++ sources
150 CPPDEFS = -DF_CPU=$(F_CPU)UL -DDESCRIPTION=$(DESCRIPTION) -DVENDOR_ID=$(VENDOR_ID) -DPRODUCT_ID=$(PRODUCT_ID)
151 #CPPDEFS += -D__STDC_LIMIT_MACROS
152 #CPPDEFS += -D__STDC_CONSTANT_MACROS
153 CPPDEFS += -DDESCRIPTION=$(DESCRIPTION)
154 CPPDEFS += -DVENDOR_ID=$(VENDOR_ID)
155 CPPDEFS += -DPRODUCT_ID=$(PRODUCT_ID)
156 CPPDEFS += -DMANUFACTURER=$(MANUFACTURER)
157 CPPDEFS += -DPRODUCT=$(PRODUCT)
158 ifdef MOUSE_DELAY_TIME
159 CPPDEFS += -DMOUSE_DELAY_TIME=$(MOUSE_DELAY_TIME)
160 endif
161
162
163
164 #---------------- Compiler Options C ----------------
165 #  -g*:          generate debugging information
166 #  -O*:          optimization level
167 #  -f...:        tuning, see GCC manual and avr-libc documentation
168 #  -Wall...:     warning level
169 #  -Wa,...:      tell GCC to pass this to the assembler.
170 #    -adhlns...: create assembler listing
171 CFLAGS = -g$(DEBUG)
172 CFLAGS += $(CDEFS)
173 CFLAGS += -O$(OPT)
174 CFLAGS += -funsigned-char
175 CFLAGS += -funsigned-bitfields
176 CFLAGS += -ffunction-sections
177 CFLAGS += -fpack-struct
178 CFLAGS += -fshort-enums
179 CFLAGS += -Wall
180 CFLAGS += -Wstrict-prototypes
181 #CFLAGS += -mshort-calls
182 #CFLAGS += -fno-unit-at-a-time
183 #CFLAGS += -Wundef
184 #CFLAGS += -Wunreachable-code
185 #CFLAGS += -Wsign-compare
186 CFLAGS += -Wa,-adhlns=$(@:%.o=$(OBJDIR)/%.lst)
187 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
188 CFLAGS += $(CSTANDARD)
189
190
191 #---------------- Compiler Options C++ ----------------
192 #  -g*:          generate debugging information
193 #  -O*:          optimization level
194 #  -f...:        tuning, see GCC manual and avr-libc documentation
195 #  -Wall...:     warning level
196 #  -Wa,...:      tell GCC to pass this to the assembler.
197 #    -adhlns...: create assembler listing
198 CPPFLAGS = -g$(DEBUG)
199 CPPFLAGS += $(CPPDEFS)
200 CPPFLAGS += -O$(OPT)
201 CPPFLAGS += -funsigned-char
202 CPPFLAGS += -funsigned-bitfields
203 CPPFLAGS += -fpack-struct
204 CPPFLAGS += -fshort-enums
205 CPPFLAGS += -fno-exceptions
206 CPPFLAGS += -Wall
207 CPPFLAGS += -Wundef
208 #CPPFLAGS += -mshort-calls
209 #CPPFLAGS += -fno-unit-at-a-time
210 #CPPFLAGS += -Wstrict-prototypes
211 #CPPFLAGS += -Wunreachable-code
212 #CPPFLAGS += -Wsign-compare
213 CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
214 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
215 #CPPFLAGS += $(CSTANDARD)
216
217
218 #---------------- Assembler Options ----------------
219 #  -Wa,...:   tell GCC to pass this to the assembler.
220 #  -adhlns:   create listing
221 #  -gstabs:   have the assembler create line number information; note that
222 #             for use in COFF files, additional information about filenames
223 #             and function names needs to be present in the assembler source
224 #             files -- see avr-libc docs [FIXME: not yet described there]
225 #  -listing-cont-lines: Sets the maximum number of continuation lines of hex 
226 #       dump that will be displayed for a given single line of source input.
227 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
228
229
230 #---------------- Library Options ----------------
231 # Minimalistic printf version
232 PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
233
234 # Floating point printf version (requires MATH_LIB = -lm below)
235 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
236
237 # If this is left blank, then it will use the Standard printf version.
238 PRINTF_LIB = 
239 #PRINTF_LIB = $(PRINTF_LIB_MIN)
240 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
241
242
243 # Minimalistic scanf version
244 SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
245
246 # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
247 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
248
249 # If this is left blank, then it will use the Standard scanf version.
250 SCANF_LIB = 
251 #SCANF_LIB = $(SCANF_LIB_MIN)
252 #SCANF_LIB = $(SCANF_LIB_FLOAT)
253
254
255 MATH_LIB = -lm
256
257
258 # List any extra directories to look for libraries here.
259 #     Each directory must be seperated by a space.
260 #     Use forward slashes for directory separators.
261 #     For a directory that has spaces, enclose it in quotes.
262 EXTRALIBDIRS = 
263
264
265
266 #---------------- External Memory Options ----------------
267
268 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
269 # used for variables (.data/.bss) and heap (malloc()).
270 #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
271
272 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
273 # only used for heap (malloc()).
274 #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
275
276 EXTMEMOPTS =
277
278
279
280 #---------------- Linker Options ----------------
281 #  -Wl,...:     tell GCC to pass this to linker.
282 #    -Map:      create map file
283 #    --cref:    add cross reference to  map file
284 LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
285 LDFLAGS += -Wl,--relax
286 LDFLAGS += -Wl,--gc-sections
287 LDFLAGS += $(EXTMEMOPTS)
288 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
289 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
290 #LDFLAGS += -T linker_script.x
291
292
293
294 #---------------- Programming Options (avrdude) ----------------
295
296 # Programming hardware
297 # Type: avrdude -c ?
298 # to get a full listing.
299 #
300 AVRDUDE_PROGRAMMER = stk500v2
301
302 # com1 = serial port. Use lpt1 to connect to parallel port.
303 AVRDUDE_PORT = com1    # programmer connected to serial device
304
305 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
306 #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
307
308
309 # Uncomment the following if you want avrdude's erase cycle counter.
310 # Note that this counter needs to be initialized first using -Yn,
311 # see avrdude manual.
312 #AVRDUDE_ERASE_COUNTER = -y
313
314 # Uncomment the following if you do /not/ wish a verification to be
315 # performed after programming the device.
316 #AVRDUDE_NO_VERIFY = -V
317
318 # Increase verbosity level.  Please use this when submitting bug
319 # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
320 # to submit bug reports.
321 #AVRDUDE_VERBOSE = -v -v
322
323 AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
324 AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
325 AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
326 AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
327
328
329
330 #---------------- Debugging Options ----------------
331
332 # For simulavr only - target MCU frequency.
333 DEBUG_MFREQ = $(F_CPU)
334
335 # Set the DEBUG_UI to either gdb or insight.
336 # DEBUG_UI = gdb
337 DEBUG_UI = insight
338
339 # Set the debugging back-end to either avarice, simulavr.
340 DEBUG_BACKEND = avarice
341 #DEBUG_BACKEND = simulavr
342
343 # GDB Init Filename.
344 GDBINIT_FILE = __avr_gdbinit
345
346 # When using avarice settings for the JTAG
347 JTAG_DEV = /dev/com1
348
349 # Debugging port used to communicate between GDB / avarice / simulavr.
350 DEBUG_PORT = 4242
351
352 # Debugging host used to communicate between GDB / avarice / simulavr, normally
353 #     just set to localhost unless doing some sort of crazy debugging when 
354 #     avarice is running on a different computer.
355 DEBUG_HOST = localhost
356
357
358
359 #============================================================================
360
361
362 # Define programs and commands.
363 SHELL = sh
364 CC = avr-gcc
365 OBJCOPY = avr-objcopy
366 OBJDUMP = avr-objdump
367 SIZE = avr-size
368 AR = avr-ar rcs
369 NM = avr-nm
370 AVRDUDE = avrdude
371 REMOVE = rm -f
372 REMOVEDIR = rm -rf
373 COPY = cp
374 WINSHELL = cmd
375
376
377 # Define Messages
378 # English
379 MSG_ERRORS_NONE = Errors: none
380 MSG_BEGIN = -------- begin --------
381 MSG_END = --------  end  --------
382 MSG_SIZE_BEFORE = Size before: 
383 MSG_SIZE_AFTER = Size after:
384 MSG_COFF = Converting to AVR COFF:
385 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
386 MSG_FLASH = Creating load file for Flash:
387 MSG_EEPROM = Creating load file for EEPROM:
388 MSG_EXTENDED_LISTING = Creating Extended Listing:
389 MSG_SYMBOL_TABLE = Creating Symbol Table:
390 MSG_LINKING = Linking:
391 MSG_COMPILING = Compiling C:
392 MSG_COMPILING_CPP = Compiling C++:
393 MSG_ASSEMBLING = Assembling:
394 MSG_CLEANING = Cleaning project:
395 MSG_CREATING_LIBRARY = Creating library:
396
397
398
399
400 # Define all object files.
401 OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
402
403 # Define all listing files.
404 LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
405
406
407 # Compiler flags to generate dependency files.
408 GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
409
410
411 # Combine all necessary flags and optional flags.
412 # Add target processor to flags.
413 ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
414 ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
415 ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
416
417
418
419
420
421 # Default target.
422 all: begin gccversion sizebefore build sizeafter end
423
424 # Change the build target to build a HEX file or a library.
425 build: elf hex eep lss sym
426 #build: lib
427
428
429 elf: $(TARGET).elf
430 hex: $(TARGET).hex
431 eep: $(TARGET).eep
432 lss: $(TARGET).lss
433 sym: $(TARGET).sym
434 LIBNAME=lib$(TARGET).a
435 lib: $(LIBNAME)
436
437
438
439 # Eye candy.
440 # AVR Studio 3.x does not check make's exit code but relies on
441 # the following magic strings to be generated by the compile job.
442 begin:
443         @echo
444         @echo $(MSG_BEGIN)
445
446 end:
447         @echo $(MSG_END)
448         @echo
449
450
451 # Display size of file.
452 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
453 #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
454 ELFSIZE = $(SIZE) $(TARGET).elf
455
456 sizebefore:
457         @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
458         2>/dev/null; echo; fi
459
460 sizeafter:
461         @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
462         2>/dev/null; echo; fi
463
464
465
466 # Display compiler version information.
467 gccversion : 
468         @$(CC) --version
469
470
471
472 # Program the device.  
473 program: $(TARGET).hex $(TARGET).eep
474         $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
475
476
477 # Generate avr-gdb config/init file which does the following:
478 #     define the reset signal, load the target file, connect to target, and set 
479 #     a breakpoint at main().
480 gdb-config: 
481         @$(REMOVE) $(GDBINIT_FILE)
482         @echo define reset >> $(GDBINIT_FILE)
483         @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
484         @echo end >> $(GDBINIT_FILE)
485         @echo file $(TARGET).elf >> $(GDBINIT_FILE)
486         @echo target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)
487 ifeq ($(DEBUG_BACKEND),simulavr)
488         @echo load  >> $(GDBINIT_FILE)
489 endif
490         @echo break main >> $(GDBINIT_FILE)
491
492 debug: gdb-config $(TARGET).elf
493 ifeq ($(DEBUG_BACKEND), avarice)
494         @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
495         @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
496         $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
497         @$(WINSHELL) /c pause
498
499 else
500         @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
501         $(DEBUG_MFREQ) --port $(DEBUG_PORT)
502 endif
503         @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
504
505
506
507
508 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
509 COFFCONVERT = $(OBJCOPY) --debugging
510 COFFCONVERT += --change-section-address .data-0x800000
511 COFFCONVERT += --change-section-address .bss-0x800000
512 COFFCONVERT += --change-section-address .noinit-0x800000
513 COFFCONVERT += --change-section-address .eeprom-0x810000
514
515
516
517 coff: $(TARGET).elf
518         @echo
519         @echo $(MSG_COFF) $(TARGET).cof
520         $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
521
522
523 extcoff: $(TARGET).elf
524         @echo
525         @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
526         $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
527
528
529
530 # Create final output files (.hex, .eep) from ELF output file.
531 %.hex: %.elf
532         @echo
533         @echo $(MSG_FLASH) $@
534         $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
535
536 %.eep: %.elf
537         @echo
538         @echo $(MSG_EEPROM) $@
539         -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
540         --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
541
542 # Create extended listing file from ELF output file.
543 %.lss: %.elf
544         @echo
545         @echo $(MSG_EXTENDED_LISTING) $@
546         $(OBJDUMP) -h -S -z $< > $@
547
548 # Create a symbol table from ELF output file.
549 %.sym: %.elf
550         @echo
551         @echo $(MSG_SYMBOL_TABLE) $@
552         $(NM) -n $< > $@
553
554
555
556 # Create library from object files.
557 .SECONDARY : $(TARGET).a
558 .PRECIOUS : $(OBJ)
559 %.a: $(OBJ)
560         @echo
561         @echo $(MSG_CREATING_LIBRARY) $@
562         $(AR) $@ $(OBJ)
563
564
565 # Link: create ELF output file from object files.
566 .SECONDARY : $(TARGET).elf
567 .PRECIOUS : $(OBJ)
568 %.elf: $(OBJ)
569         @echo
570         @echo $(MSG_LINKING) $@
571         $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
572
573
574 # Compile: create object files from C source files.
575 $(OBJDIR)/%.o : %.c
576         @echo
577         @echo $(MSG_COMPILING) $<
578         $(CC) -c $(ALL_CFLAGS) $< -o $@ 
579
580
581 # Compile: create object files from C++ source files.
582 $(OBJDIR)/%.o : %.cpp
583         @echo
584         @echo $(MSG_COMPILING_CPP) $<
585         $(CC) -c $(ALL_CPPFLAGS) $< -o $@ 
586
587
588 # Compile: create assembler files from C source files.
589 %.s : %.c
590         $(CC) -S $(ALL_CFLAGS) $< -o $@
591
592
593 # Compile: create assembler files from C++ source files.
594 %.s : %.cpp
595         $(CC) -S $(ALL_CPPFLAGS) $< -o $@
596
597
598 # Assemble: create object files from assembler source files.
599 $(OBJDIR)/%.o : %.S
600         @echo
601         @echo $(MSG_ASSEMBLING) $<
602         $(CC) -c $(ALL_ASFLAGS) $< -o $@
603
604
605 # Create preprocessed source for use in sending a bug report.
606 %.i : %.c
607         $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ 
608
609
610 # Target: clean project.
611 clean: begin clean_list end
612
613 clean_list :
614         @echo
615         @echo $(MSG_CLEANING)
616         $(REMOVE) $(TARGET).hex
617         $(REMOVE) $(TARGET).eep
618         $(REMOVE) $(TARGET).cof
619         $(REMOVE) $(TARGET).elf
620         $(REMOVE) $(TARGET).map
621         $(REMOVE) $(TARGET).sym
622         $(REMOVE) $(TARGET).lss
623         $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
624         $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
625         $(REMOVE) $(SRC:.c=.s)
626         $(REMOVE) $(SRC:.c=.d)
627         $(REMOVE) $(SRC:.c=.i)
628         $(REMOVEDIR) .dep
629
630
631 # Create object files directory
632 $(shell mkdir $(OBJDIR) 2>/dev/null)
633
634
635 # Include the dependency files.
636 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
637
638
639 # Listing of phony targets.
640 .PHONY : all begin finish end sizebefore sizeafter gccversion \
641 build elf hex eep lss sym coff extcoff \
642 clean clean_list program debug gdb-config