-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
40 lines (31 loc) · 812 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
CC= avr-gcc
CFLAGS= -O2 -Wall -mmcu=attiny13
LDFLAGS= -Wl,-Ttiny13flash.x -nostdlib -g
DEFS=-DTEST=0
INCLUDE=-I.
TARGET=main.elf
OBJS=
LIBS := $(LIBS) -lgcc
all: $(TARGET)
CANDLE=candle
test: DEFS=-DTEST=3
test: $(TARGET)
clean:
rm -f *.dis *.bin *.hex *.elf
%.elf: %.c $(OBJS)
$(CC) -S $(DEFS) $(INCLUDE) ${CFLAGS} $<
$(CC) -o $@ $(DEFS) $(INCLUDE) ${CFLAGS} $(LDFLAGS) $< $(OBJS) $(LIBS)
avr-objcopy -O binary $@ $(@:.elf=.bin)
avr-objcopy -O ihex $@ $(@:.elf=.hex)
avr-objdump $@ -dS >$(@:.elf=.dis)
candle: $(TARGET)
rm -rf $(CANDLE)
mkdir $(CANDLE)
cp -avi *.bin *.hex *.c *.h *.x Makefile *.png $(CANDLE)/
7z a -r candle.7z $(CANDLE)/
%.o: %.c
${CC} -c -o $@ $(DEFS) $(INCLUDE) ${CFLAGS} $<
dep:
makedepend $(DEFS) $(INCLUDE) -o.elf -Y *.c
# DO NOT DELETE
main.elf: tiny13a.h stdint.h