]> git.cryptolib.org Git - avr-crypto-lib.git/blob - Makefile
+md5 (still buggy)
[avr-crypto-lib.git] / Makefile
1 PRG         = md5
2 # cryptotest
3 OBJ         = main-md5-test.o debug.o uart.o serial-tools.o md5.o
4 # main-cast5-test.o debug.o uart.o serial-tools.o cast5.o
5 # main.o debug.o uart.o serial-tools.o sha256-asm.o xtea-asm.o arcfour-asm.o prng.o cast5.o
6 MCU_TARGET     = atmega32
7 OPTIMIZE       = -Os
8
9 DEFS       =
10 LIBS       =
11
12 # You should not have to change anything below here.
13
14 CC           = avr-gcc
15
16 # Override is only needed by avr-lib build system.
17
18 override CFLAGS = -Wall -Wstrict-prototypes  $(OPTIMIZE) -mmcu=$(MCU_TARGET) 
19 $(DEFS)
20 override LDFLAGS       = -Wl,-Map,$(PRG).map
21 override ASFLAGS = -mmcu=$(MCU_TARGET)
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 FIG2DEV          = fig2dev
78 EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
79
80 dox: eps png pdf
81
82 eps: $(PRG).eps
83 png: $(PRG).png
84 pdf: $(PRG).pdf
85
86 %.eps: %.fig
87         $(FIG2DEV) -L eps $< $@
88
89 %.pdf: %.fig
90         $(FIG2DEV) -L pdf $< $@
91
92 %.png: %.fig
93         $(FIG2DEV) -L png $< $@