Subversion Repositories FlightCtrl

Rev

Rev 2081 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
#--------------------------------------------------------------------
2
# MCU name
2031 holgerb 3
MCU = atmega1284p
4
#MCU = atmega644p
1 ingob 5
F_CPU = 20000000
6
#-------------------------------------------------------------------
1051 killagreg 7
VERSION_MAJOR    =   0
2050 holgerb 8
VERSION_MINOR    =  88
2078 holgerb 9
VERSION_PATCH    =  4
1399 killagreg 10
VERSION_SERIAL_MAJOR = 11  	# Serial Protocol
11
VERSION_SERIAL_MINOR = 0  	# Serial Protocol
2037 holgerb 12
NC_SPI_COMPATIBLE = 31		# Navi-Kompatibilität
2093 - 13
MOD				 = ACC-HH
1 ingob 14
#-------------------------------------------------------------------
2034 holgerb 15
# ATMEGA644: 63487 is maximum
16
#-------------------------------------------------------------------
17
# 0 a
18
# 1 b
19
# 2 c
20
# 3 d
21
# 4 e
22
# 5 f
23
# 6 g
24
# 7 h
25
# 8 i
26
# 9 j
27
# 10 k
28
# 11 L
29
#-------------------------------------------------------------------
1 ingob 30
 
1419 ingob 31
# get SVN revision
32
REV := $(shell sh -c "cat .svn/entries | sed -n '4p'")
33
 
1561 killagreg 34
ifeq ($(MCU), atmega1284p)
1 ingob 35
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
1561 killagreg 36
 HEX_NAME = MEGA1284P
1571 killagreg 37
 LIBFC_EXT = 1284
595 hbuss 38
endif
1 ingob 39
 
595 hbuss 40
ifeq ($(MCU), atmega644p)
41
 FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
1 ingob 42
 HEX_NAME = MEGA644
1571 killagreg 43
 LIBFC_EXT = 644
1 ingob 44
endif
45
 
46
ifeq ($(F_CPU), 16000000)
47
 QUARZ = 16MHZ
48
endif
49
 
50
ifeq ($(F_CPU), 20000000)
51
 QUARZ = 20MHZ
52
endif
53
 
54
 
55
# Output format. (can be srec, ihex, binary)
56
FORMAT = ihex
57
 
58
# Target file name (without extension).
59
 
1051 killagreg 60
ifeq ($(VERSION_PATCH), 0)
2093 - 61
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV)_$(MOD)
297 holgerb 62
endif
1051 killagreg 63
ifeq ($(VERSION_PATCH), 1)
2093 - 64
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV)_$(MOD)
297 holgerb 65
endif
1051 killagreg 66
ifeq ($(VERSION_PATCH), 2)
2093 - 67
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV)_$(MOD)
297 holgerb 68
endif
1051 killagreg 69
ifeq ($(VERSION_PATCH), 3)
2093 - 70
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV)_$(MOD)
297 holgerb 71
endif
1051 killagreg 72
ifeq ($(VERSION_PATCH), 4)
2093 - 73
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV)_$(MOD)
297 holgerb 74
endif
1051 killagreg 75
ifeq ($(VERSION_PATCH), 5)
2093 - 76
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV)_$(MOD)
297 holgerb 77
endif
1051 killagreg 78
ifeq ($(VERSION_PATCH), 6)
2093 - 79
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV)_$(MOD)
469 hbuss 80
endif
1051 killagreg 81
ifeq ($(VERSION_PATCH), 7)
2093 - 82
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV)_$(MOD)
469 hbuss 83
endif
1051 killagreg 84
ifeq ($(VERSION_PATCH), 8)
2093 - 85
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV)_$(MOD)
855 hbuss 86
endif
1051 killagreg 87
ifeq ($(VERSION_PATCH), 9)
2093 - 88
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV)_$(MOD)
855 hbuss 89
endif
1051 killagreg 90
ifeq ($(VERSION_PATCH), 10)
2093 - 91
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV)_$(MOD)
882 hbuss 92
endif
1166 hbuss 93
ifeq ($(VERSION_PATCH), 11)
2093 - 94
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)L_SVN$(REV)_$(MOD)
1166 hbuss 95
endif
96
ifeq ($(VERSION_PATCH), 12)
2093 - 97
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV)_$(MOD)
1166 hbuss 98
endif
99
ifeq ($(VERSION_PATCH), 13)
2093 - 100
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV)_$(MOD)
1166 hbuss 101
endif
1171 hbuss 102
ifeq ($(VERSION_PATCH), 14)
2093 - 103
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV)_$(MOD)
1171 hbuss 104
endif
105
ifeq ($(VERSION_PATCH), 15)
2093 - 106
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV)_$(MOD)
1171 hbuss 107
endif
108
ifeq ($(VERSION_PATCH), 16)
2093 - 109
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV)_$(MOD)
1171 hbuss 110
endif
1694 holgerb 111
ifeq ($(VERSION_PATCH), 17)
2093 - 112
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV)_$(MOD)
1694 holgerb 113
endif
114
ifeq ($(VERSION_PATCH), 18)
2093 - 115
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)s_SVN$(REV)_$(MOD)
1694 holgerb 116
endif
117
ifeq ($(VERSION_PATCH), 19)
2093 - 118
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)t_SVN$(REV)_$(MOD)
1694 holgerb 119
endif
120
ifeq ($(VERSION_PATCH), 20)
2093 - 121
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)u_SVN$(REV)_$(MOD)
1694 holgerb 122
endif
1951 holgerb 123
ifeq ($(VERSION_PATCH), 21)
2093 - 124
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)v_SVN$(REV)_$(MOD)
1951 holgerb 125
endif
126
ifeq ($(VERSION_PATCH), 22)
2093 - 127
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)w_SVN$(REV)_$(MOD)
1951 holgerb 128
endif
129
ifeq ($(VERSION_PATCH), 23)
2093 - 130
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)x_SVN$(REV)_$(MOD)
1951 holgerb 131
endif
132
ifeq ($(VERSION_PATCH), 24)
2093 - 133
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)y_SVN$(REV)_$(MOD)
1951 holgerb 134
endif
135
ifeq ($(VERSION_PATCH), 25)
2093 - 136
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)z_SVN$(REV)_$(MOD)
1951 holgerb 137
endif
1 ingob 138
 
1419 ingob 139
 
1 ingob 140
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization.
141
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
1490 killagreg 142
OPT = s
1491 killagreg 143
#OPT = 2
1 ingob 144
 
145
##########################################################################################################
146
# List C source files here. (C dependencies are automatically generated.)
1622 killagreg 147
SRC = main.c uart.c timer0.c analog.c menu.c eeprom.c
1426 ingob 148
SRC += twimaster.c rc.c fc.c GPS.c spi.c led.c Spektrum.c
1636 ingob 149
SRC += mymath.c jetimenu.c capacity.c debug.c
2034 holgerb 150
SRC += hottmenu.c sbus.c user_receiver.c
1 ingob 151
##########################################################################################################
152
 
153
 
154
# List Assembler source files here.
155
# Make them always end in a capital .S.  Files ending in a lowercase .s
156
# will not be considered source files but generated files (assembler
157
# output from the compiler), and will be deleted upon "make clean"!
158
# Even though the DOS/Win* filesystem matches both .s and .S the same,
159
# it will preserve the spelling of the filenames, and gcc itself does
160
# care about how the name is spelled on its command-line.
1330 killagreg 161
ASRC = isqrt.S
1 ingob 162
 
163
 
164
 
165
# List any extra directories to look for include files here.
166
#     Each directory must be seperated by a space.
167
EXTRAINCDIRS =
168
 
169
 
170
# Optional compiler flags.
171
#  -g:        generate debugging information (for GDB, or for COFF conversion)
172
#  -O*:       optimization level
173
#  -f...:     tuning, see gcc manual and avr-libc documentation
174
#  -Wall...:  warning level
175
#  -Wa,...:   tell GCC to pass this to the assembler.
176
#    -ahlms:  create assembler listing
1444 ingob 177
CFLAGS = -O$(OPT) -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=$(<:%.c=%.lst) $(patsubst %,-I%,$(EXTRAINCDIRS))
1 ingob 178
 
1491 killagreg 179
 
1 ingob 180
# Set a "language standard" compiler flag.
181
#   Unremark just one line below to set the language standard to use.
182
#   gnu99 = C99 + GNU extensions. See GCC manual for more information.
183
#CFLAGS += -std=c89
184
#CFLAGS += -std=gnu89
185
#CFLAGS += -std=c99
186
CFLAGS += -std=gnu99
187
 
1491 killagreg 188
# shrink code size
189
CFLAGS += -mtiny-stack
190
#CFLAGS += -fno-inline-functions
191
CFLAGS += -mcall-prologues
192
 
1444 ingob 193
CFLAGS += -DF_CPU=$(F_CPU) -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DNC_SPI_COMPATIBLE=$(NC_SPI_COMPATIBLE)
1 ingob 194
 
195
 
196
# Optional assembler flags.
197
#  -Wa,...:   tell GCC to pass this to the assembler.
198
#  -ahlms:    create listing
199
#  -gstabs:   have the assembler create line number information; note that
200
#             for use in COFF files, additional information about filenames
201
#             and function names needs to be present in the assembler source
202
#             files -- see avr-libc docs [FIXME: not yet described there]
203
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
204
 
205
 
206
 
207
# Optional linker flags.
208
#  -Wl,...:   tell GCC to pass this to linker.
209
#  -Map:      create map file
210
#  --cref:    add cross reference to  map file
211
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
212
 
213
# Additional libraries
214
 
215
# Minimalistic printf version
216
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min
217
 
218
# Floating point printf version (requires -lm below)
219
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
220
 
221
# -lm = math library
222
LDFLAGS += -lm
223
 
1571 killagreg 224
LDFLAGS += libfc$(LIBFC_EXT).a
1 ingob 225
 
226
##LDFLAGS += -T./linkerfile/avr5.x
227
 
228
 
229
 
230
# Programming support using avrdude. Settings and variables.
231
 
232
# Programming hardware: alf avr910 avrisp bascom bsd
233
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
234
#
235
# Type: avrdude -c ?
236
# to get a full listing.
237
#
595 hbuss 238
#AVRDUDE_PROGRAMMER = dt006
1 ingob 239
#AVRDUDE_PROGRAMMER = stk200
240
#AVRDUDE_PROGRAMMER = ponyser
595 hbuss 241
AVRDUDE_PROGRAMMER = avrispv2
1 ingob 242
#falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden
243
 
595 hbuss 244
#AVRDUDE_PORT = com1    # programmer connected to serial device
245
#AVRDUDE_PORT = lpt1    # programmer connected to parallel port
246
AVRDUDE_PORT = usb # programmer connected to USB
1 ingob 247
 
248
#AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
249
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS)
250
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
251
 
595 hbuss 252
#avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex
1 ingob 253
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
254
 
255
# Uncomment the following if you want avrdude's erase cycle counter.
256
# Note that this counter needs to be initialized first using -Yn,
257
# see avrdude manual.
258
#AVRDUDE_ERASE += -y
259
 
260
# Uncomment the following if you do /not/ wish a verification to be
261
# performed after programming the device.
262
AVRDUDE_FLAGS += -V
263
 
264
# Increase verbosity level.  Please use this when submitting bug
265
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
266
# to submit bug reports.
267
#AVRDUDE_FLAGS += -v -v
268
 
269
# ---------------------------------------------------------------------------
270
# Define directories, if needed.
271
DIRAVR = c:/winavr
272
DIRAVRBIN = $(DIRAVR)/bin
273
DIRAVRUTILS = $(DIRAVR)/utils/bin
274
DIRINC = .
275
DIRLIB = $(DIRAVR)/avr/lib
276
 
277
 
278
# Define programs and commands.
279
SHELL = sh
280
 
281
CC = avr-gcc
282
 
283
OBJCOPY = avr-objcopy
284
OBJDUMP = avr-objdump
285
SIZE = avr-size
286
 
287
# Programming support using avrdude.
288
AVRDUDE = avrdude
289
 
290
REMOVE = rm -f
291
COPY = cp
292
 
293
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
1642 killagreg 294
ELFSIZE = $(SIZE) -x -A $(TARGET).elf
1561 killagreg 295
LIMITS = $(SIZE) --mcu=$(MCU) -C $(TARGET).elf
1 ingob 296
 
1490 killagreg 297
 
1 ingob 298
# Define Messages
299
# English
300
MSG_ERRORS_NONE = Errors: none
301
MSG_BEGIN = -------- begin --------
302
MSG_END = --------  end  --------
303
MSG_SIZE_BEFORE = Size before:
304
MSG_SIZE_AFTER = Size after:
305
MSG_COFF = Converting to AVR COFF:
306
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
307
MSG_FLASH = Creating load file for Flash:
308
MSG_EEPROM = Creating load file for EEPROM:
309
MSG_EXTENDED_LISTING = Creating Extended Listing:
310
MSG_SYMBOL_TABLE = Creating Symbol Table:
311
MSG_LINKING = Linking:
312
MSG_COMPILING = Compiling:
313
MSG_ASSEMBLING = Assembling:
314
MSG_CLEANING = Cleaning project:
315
 
316
 
317
# Define all object files.
1424 ingob 318
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
1 ingob 319
 
320
# Define all listing files.
321
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
322
 
323
# Combine all necessary flags and optional flags.
324
# Add target processor to flags.
325
#ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS)
326
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
327
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
328
 
329
 
330
# Default target.
1444 ingob 331
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex sizeafter finished end
1 ingob 332
 
333
 
334
# Eye candy.
335
# AVR Studio 3.x does not check make's exit code but relies on
336
# the following magic strings to be generated by the compile job.
337
begin:
338
	@echo
339
	@echo $(MSG_BEGIN)
340
 
341
finished:
342
	@echo $(MSG_ERRORS_NONE)
343
 
344
end:
345
	@echo $(MSG_END)
346
	@echo
347
 
348
 
349
# Display size of file.
350
sizebefore:
1490 killagreg 351
	@if [ -f $(TARGET).elf ]; then echo Size before:; $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi
1 ingob 352
sizeafter:
1490 killagreg 353
	@if [ -f $(TARGET).elf ]; then echo Size after:; $(ELFSIZE); $(HEXSIZE); $(LIMITS); echo; fi
1 ingob 354
 
355
 
356
# Display compiler version information.
357
gccversion :
358
	@$(CC) --version
359
 
360
 
361
# Convert ELF to COFF for use in debugging / simulating in
362
# AVR Studio or VMLAB.
363
COFFCONVERT=$(OBJCOPY) --debugging \
364
	--change-section-address .data-0x800000 \
365
	--change-section-address .bss-0x800000 \
366
	--change-section-address .noinit-0x800000 \
367
	--change-section-address .eeprom-0x810000
368
 
369
 
370
coff: $(TARGET).elf
371
	@echo
372
	@echo $(MSG_COFF) $(TARGET).cof
373
	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
374
 
375
 
376
extcoff: $(TARGET).elf
377
	@echo
378
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
379
	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
380
 
381
 
382
 
383
 
384
# Program the device.
385
program: $(TARGET).hex $(TARGET).eep
386
	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
387
 
388
 
389
 
390
 
391
# Create final output files (.hex, .eep) from ELF output file.
392
%.hex: %.elf
393
	@echo
394
	@echo $(MSG_FLASH) $@
395
	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
396
 
397
%.eep: %.elf
398
	@echo
399
	@echo $(MSG_EEPROM) $@
400
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
401
	--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
402
 
403
# Create extended listing file from ELF output file.
404
%.lss: %.elf
405
	@echo
406
	@echo $(MSG_EXTENDED_LISTING) $@
407
	$(OBJDUMP) -h -S $< > $@
408
 
409
# Create a symbol table from ELF output file.
410
%.sym: %.elf
411
	@echo
412
	@echo $(MSG_SYMBOL_TABLE) $@
413
	avr-nm -n $< > $@
414
 
415
 
416
 
417
# Link: create ELF output file from object files.
418
.SECONDARY : $(TARGET).elf
419
.PRECIOUS : $(OBJ)
420
%.elf: $(OBJ)
421
	@echo
422
	@echo $(MSG_LINKING) $@
423
	$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
424
 
425
 
426
# Compile: create object files from C source files.
427
%.o : %.c
428
	@echo
429
	@echo $(MSG_COMPILING) $<
430
	$(CC) -c $(ALL_CFLAGS) $< -o $@
431
 
432
 
433
# Compile: create assembler files from C source files.
434
%.s : %.c
435
	$(CC) -S $(ALL_CFLAGS) $< -o $@
436
 
437
 
438
# Assemble: create object files from assembler source files.
439
%.o : %.S
440
	@echo
441
	@echo $(MSG_ASSEMBLING) $<
442
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
443
 
444
 
445
 
446
 
447
 
448
 
449
# Target: clean project.
450
clean: begin clean_list finished end
451
 
452
clean_list :
453
	@echo
454
	@echo $(MSG_CLEANING)
1431 ingob 455
	$(REMOVE) Flight-Ctrl_*.hex
1444 ingob 456
	$(REMOVE) Flight-Ctrl_*.eep
1 ingob 457
	$(REMOVE) $(TARGET).obj
458
	$(REMOVE) $(TARGET).cof
1444 ingob 459
	$(REMOVE) Flight-Ctrl_*.elf
460
	$(REMOVE) Flight-Ctrl_*.map
1 ingob 461
	$(REMOVE) $(TARGET).obj
462
	$(REMOVE) $(TARGET).a90
1444 ingob 463
	$(REMOVE) Flight-Ctrl_*.sym
1 ingob 464
	$(REMOVE) $(TARGET).lnk
465
	$(REMOVE) $(TARGET).lss
1431 ingob 466
	$(REMOVE) $(OBJ)
1 ingob 467
	$(REMOVE) $(LST)
468
	$(REMOVE) $(SRC:.c=.s)
469
	$(REMOVE) $(SRC:.c=.d)
1419 ingob 470
	$(REMOVE) $(SRC:.c=.o)
1 ingob 471
 
472
 
473
# Automatically generate C source code dependencies.
474
# (Code originally taken from the GNU make user manual and modified
475
# (See README.txt Credits).)
476
#
477
# Note that this will work with sh (bash) and sed that is shipped with WinAVR
478
# (see the SHELL variable defined above).
479
# This may not work with other shells or other seds.
480
#
481
%.d: %.c
482
	set -e; $(CC) -MM $(ALL_CFLAGS) $< \
483
	| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \
484
	[ -s $@ ] || rm -f $@
485
 
486
 
487
# Remove the '-' if you want to see the dependency files generated.
1444 ingob 488
-include $(SRC:%.c=%.d)
1 ingob 489
 
490
 
491
 
492
# Listing of phony targets.
493
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \
494
	clean clean_list program
495