Rev Author Line No. Line
1234 kaklik 1 PRG = glg
2 OBJ = main.o tff.o mmc.o
3 MCU_TARGET = atmega168
4 OPTIMIZE = -Os -mcall-prologues
5 DEFS =
6 LIBS =
7 DEBUG = dwarf-2
8  
9 CC = avr-gcc
10 ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
11 ALL_ASFLAGS = -mmcu=$(MCU_TARGET) -I. -x assembler-with-cpp $(ASFLAGS)
12 CFLAGS = -g$(DEBUG) -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
13 LDFLAGS = -Wl,-Map,$(PRG).map
14  
15 OBJCOPY = avr-objcopy
16 OBJDUMP = avr-objdump
17 SIZE = avr-size
18  
19  
20  
21 all: $(PRG).elf lst text size
22  
23 $(PRG).elf: $(OBJ)
24 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
25  
26  
27 clean:
28 rm -rf *.o $(PRG).elf *.eps *.bak *.a
29 rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
30 rm -rf $(PRG).hex
31  
32  
33  
34 size: $(PRG).elf
35 $(SIZE) $(PRG).elf
36  
37 lst: $(PRG).lst
38 %.lst: %.elf
39 $(OBJDUMP) -h -S $< > $@
40  
41 %.o : %.S
42 $(CC) -c $(ALL_ASFLAGS) $< -o $@
43  
44  
45  
46 text: hex
47 hex: $(PRG).hex
48  
49 %.hex: %.elf
50 $(OBJCOPY) -j .text -j .data -O ihex $< $@
51  
52