Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
96 gunterl 1
PRG            = main
2
OBJ            = main.o \
3
 
4
MCU_TARGET     = atmega88
5
OPTIMIZE       = -O1
6
 
7
DEFS           =
8
LIBS           =
9
 
10
# You should not have to change anything below here.
11
 
12
CC             = avr-gcc
13
 
14
# Override is only needed by avr-lib build system.
15
 
16
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
17
override LDFLAGS       = -Wl,-Map,$(PRG).map
18
 
19
OBJCOPY        = avr-objcopy
20
OBJDUMP        = avr-objdump
21
 
22
all: $(PRG).elf lst text eeprom
23
 
24
$(PRG).elf: $(OBJ)
25
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
26
 
27
clean:
28
	rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
29
	rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
30
 
31
lst:  $(PRG).lst
32
 
33
%.lst: %.elf
34
	$(OBJDUMP) -h -S $< > $@
35
 
36
# Rules for building the .text rom images
37
 
38
text: hex bin srec
39
 
40
hex:  $(PRG).hex
41
bin:  $(PRG).bin
42
srec: $(PRG).srec
43
 
44
%.hex: %.elf
45
	$(OBJCOPY) -j .text -j .data -O ihex $< $@
46
 
47
%.srec: %.elf
48
	$(OBJCOPY) -j .text -j .data -O srec $< $@
49
 
50
%.bin: %.elf
51
	$(OBJCOPY) -j .text -j .data -O binary $< $@
52
 
53
# Rules for building the .eeprom rom images
54
 
55
eeprom: ehex ebin esrec
56
 
57
ehex:  $(PRG)_eeprom.hex
58
ebin:  $(PRG)_eeprom.bin
59
esrec: $(PRG)_eeprom.srec
60
 
61
%_eeprom.hex: %.elf
62
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
63
 
64
%_eeprom.srec: %.elf
65
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
66
 
67
%_eeprom.bin: %.elf
68
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
69
 
70
# Every thing below here is used by avr-libc's build system and can be ignored
71
# by the casual user.
72
 
73
FIG2DEV                 = fig2dev
74
EXTRA_CLEAN_FILES       = *.bin *.srec
75
 
76
dox: eps png pdf
77
 
78
eps: $(PRG).eps
79
png: $(PRG).png
80
pdf: $(PRG).pdf
81
 
82
%.eps: %.fig
83
	$(FIG2DEV) -L eps $< $@
84
 
85
%.pdf: %.fig
86
	$(FIG2DEV) -L pdf $< $@
87
 
88
%.png: %.fig
89
	$(FIG2DEV) -L png $< $@
90