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