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