]> git.cryptolib.org Git - avr-crypto-lib.git/blob - Makefile
+DES/3DES
[avr-crypto-lib.git] / Makefile
1 PRG         = tdes-test
2 # camellia
3 # cryptotest
4 CAMELLIA_OBJ    = main-camellia-test.o debug.o uart.o serial-tools.o camellia.o camellia-asm.o
5 SKIPJACK_OBJ    = main-skipjack-test.o debug.o uart.o serial-tools.o skipjack.o
6 SHA1_OBJ                = main-sha1-test.o debug.o uart.o serial-tools.o sha1-asm.o
7 MD5_OBJ                 = main-md5-test.o debug.o uart.o serial-tools.o md5.o
8 CAST5_OBJ               = main-cast5-test.o debug.o uart.o serial-tools.o cast5.o
9 RC6_OBJ                 = main-rc6-test.o debug.o uart.o serial-tools.o rc6.o
10 Multi_OBJ               = main.o debug.o uart.o serial-tools.o sha256-asm.o xtea-asm.o arcfour-asm.o prng.o cast5.o
11 DES_OBJ                 = main-des-test.o debug.o uart.o serial-tools.o des.o
12 TDES_OBJ            = main-tdes-test.o debug.o uart.o serial-tools.o des.o
13 SEED_OBJ            = main-seed-test.o debug.o uart.o serial-tools.o seed.o seed-asm.o
14 SHABEA_OBJ          = main-shabea-test.o debug.o uart.o serial-tools.o shabea.o sha256-asm.o
15
16 OBJ = $(TDES_OBJ)
17 MCU_TARGET     = atmega32
18 OPTIMIZE       = -Os
19
20 FLASHCMD       = avrdude -p $(MCU_TARGET) -P /dev/ttyUSB0 -c avr911 -U flash:w:$(PRG).hex
21 #  -U eeprom:w:$(PRG)_eeprom.hex
22 #uisp -dprog=bsd -dlpt=/dev/parport1 --upload if=$(PRG).hex
23 ERASECMD       = 
24
25 DEFS       =
26 LIBS       =
27
28 # You should not have to change anything below here.
29
30 CC           = avr-gcc
31
32 # Override is only needed by avr-lib build system.
33
34 override CFLAGS = -pedantic -std=c99 -Wall -Wstrict-prototypes  $(OPTIMIZE) -mmcu=$(MCU_TARGET) 
35 $(DEFS)
36 override LDFLAGS       = -Wl,-Map,$(PRG).map
37 override ASFLAGS           = -mmcu=$(MCU_TARGET)
38
39 OBJCOPY = avr-objcopy
40 OBJDUMP = avr-objdump
41
42 all: $(PRG).elf lst text eeprom
43
44 $(PRG).elf: $(OBJ)
45         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
46
47 #rc6-test: 
48
49 clean:
50         rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak 
51         rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
52
53 flash:
54         $(ERASECMD)
55         $(FLASHCMD)
56         
57 lst:  $(PRG).lst
58
59 %.lst: %.elf
60         $(OBJDUMP) -h -S $< > $@
61
62 # Rules for building the .text rom images
63
64 text: hex bin srec
65
66 hex:  $(PRG).hex
67 bin:  $(PRG).bin
68 srec: $(PRG).srec
69
70 %.hex: %.elf
71         $(OBJCOPY) -j .text -j .data -O ihex $< $@
72
73 %.srec: %.elf
74         $(OBJCOPY) -j .text -j .data -O srec $< $@
75
76 %.bin: %.elf
77         $(OBJCOPY) -j .text -j .data -O binary $< $@
78
79 # Rules for building the .eeprom rom images
80
81 eeprom: ehex ebin esrec
82
83 ehex:  $(PRG)_eeprom.hex
84 ebin:  $(PRG)_eeprom.bin
85 esrec: $(PRG)_eeprom.srec
86
87 %_eeprom.hex: %.elf
88         $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
89
90 %_eeprom.srec: %.elf
91         $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
92
93 %_eeprom.bin: %.elf
94         $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
95
96 # Every thing below here is used by avr-libc's build system and can be ignored
97 # by the casual user.
98
99 FIG2DEV          = fig2dev
100 EXTRA_CLEAN_FILES       = *.hex *.bin *.srec
101
102 dox: eps png pdf
103
104 eps: $(PRG).eps
105 png: $(PRG).png
106 pdf: $(PRG).pdf
107
108 %.eps: %.fig
109         $(FIG2DEV) -L eps $< $@
110
111 %.pdf: %.fig
112         $(FIG2DEV) -L pdf $< $@
113
114 %.png: %.fig
115         $(FIG2DEV) -L png $< $@