]> git.cryptolib.org Git - avr-crypto-lib.git/blob - Makefile
documentation upgrade; most docu still missing but a first step is done
[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 #rc6-test: 
33
34 clean:
35         rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
36         rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
37
38 lst:  $(PRG).lst
39
40 %.lst: %.elf
41         $(OBJDUMP) -h -S $< > $@
42
43 # Rules for building the .text rom images
44
45 text: hex bin srec
46
47 hex:  $(PRG).hex
48 bin:  $(PRG).bin
49 srec: $(PRG).srec
50
51 %.hex: %.elf
52         $(OBJCOPY) -j .text -j .data -O ihex $< $@
53
54 %.srec: %.elf
55         $(OBJCOPY) -j .text -j .data -O srec $< $@
56
57 %.bin: %.elf
58         $(OBJCOPY) -j .text -j .data -O binary $< $@
59
60 # Rules for building the .eeprom rom images
61
62 eeprom: ehex ebin esrec
63
64 ehex:  $(PRG)_eeprom.hex
65 ebin:  $(PRG)_eeprom.bin
66 esrec: $(PRG)_eeprom.srec
67
68 %_eeprom.hex: %.elf
69         $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
70
71 %_eeprom.srec: %.elf
72         $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
73
74 %_eeprom.bin: %.elf
75         $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
76
77 # Every thing below here is used by avr-libc's build system and can be ignored
78 # by the casual user.
79
80 FIG2DEV          = fig2dev
81 EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
82
83 dox: eps png pdf
84
85 eps: $(PRG).eps
86 png: $(PRG).png
87 pdf: $(PRG).pdf
88
89 %.eps: %.fig
90         $(FIG2DEV) -L eps $< $@
91
92 %.pdf: %.fig
93         $(FIG2DEV) -L pdf $< $@
94
95 %.png: %.fig
96         $(FIG2DEV) -L png $< $@