Debian Codegraph @

doc/examples/stdiodemo/Makefile

raw
1 PRG = stdiodemo
2 OBJ = stdiodemo.o hd44780.o lcd.o uart.o
3 MCU_TARGET = atmega16
4 OPTIMIZE = -Os
5
6 DEFS =
7 LIBS =
8
9 # You should not have to change anything below here.
10
11 CC = avr-gcc
12
13 CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
14 LDFLAGS = -Wl,-Map,$(PRG).map
15
16 OBJCOPY = avr-objcopy
17 OBJDUMP = avr-objdump
18
19 #all: $(PRG).elf lst text eeprom
20 all: $(PRG).elf lst text
21
22 $(PRG).elf: $(OBJ)
23 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
24
25 clean:
26 rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
27 rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
28
29 lst: $(PRG).lst
30
31 %.lst: %.elf
32 $(OBJDUMP) -h -S $< > $@
33
34 # Rules for building the .text rom images
35
36 text: hex bin srec
37
38 hex: $(PRG).hex
39 bin: $(PRG).bin
40 srec: $(PRG).srec
41
42 %.hex: %.elf
43 $(OBJCOPY) -j .text -j .data -O ihex $< $@
44
45 %.srec: %.elf
46 $(OBJCOPY) -j .text -j .data -O srec $< $@
47
48 %.bin: %.elf
49 $(OBJCOPY) -j .text -j .data -O binary $< $@
50
51 # Rules for building the .eeprom rom images
52
53 eeprom: ehex ebin esrec
54
55 ehex: $(PRG)_eeprom.hex
56 ebin: $(PRG)_eeprom.bin
57 esrec: $(PRG)_eeprom.srec
58
59 %_eeprom.hex: %.elf
60 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
61
62 %_eeprom.srec: %.elf
63 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
64
65 %_eeprom.bin: %.elf
66 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
67
68 # Every thing below here is used by avr-libc's build system and can be ignored
69 # by the casual user.
70
71 JPEGFILES = stdiodemo-setup.jpg
72
73 JPEG2PNM = jpegtopnm
74 PNM2EPS = pnmtops
75 JPEGRESOLUTION = 180
76 EXTRA_CLEAN_FILES = *.hex *.bin *.srec *.eps
77
78 dox: ${JPEGFILES:.jpg=.eps}
79
80 %.eps: %.jpg
81 $(JPEG2PNM) $< |\
82 $(PNM2EPS) -noturn -dpi $(JPEGRESOLUTION) -equalpixels \
83 > $@