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