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