-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·47 lines (29 loc) · 949 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
41
42
43
44
45
46
47
CC=avr-gcc
CFLAGS=-g -std=gnu99 -Os -Wall -mcall-prologues -mmcu=attiny85 -DF_CPU=8000000
## Use short (8-bit) data types
##CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
LDFLAGS = -Wl,-Map,$(TARGET).map
## Optional, but often ends up with smaller code
LDFLAGS += -Wl,--gc-sections
OBJ2HEX=avr-objcopy
UISP=avrdude
TARGET=solderIt
C_FILES = $(wildcard *.c)
OBJS = $(C_FILES:.c=.o)
program : flash eeprom
flash : $(TARGET).hex
sudo $(UISP) -p t85 -c USBasp -v -U flash:w:$(TARGET).hex:i
eeprom : $(TARGET).eep
sudo $(UISP) -p t85 -c USBasp -v -U eeprom:w:$(TARGET).eep:i
build : $(TARGET).hex $(TARGET).eep
ls -l $(TARGET).*
%.hex : %.elf
$(OBJ2HEX) -R .eeprom -O ihex $< $@
%.eep : %.elf
$(OBJ2HEX) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
%.elf : $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
%.o : %.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
clean :
rm -f *.hex *.eep *.elf *.o