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