-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (30 loc) · 775 Bytes
/
Makefile
File metadata and controls
43 lines (30 loc) · 775 Bytes
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
#name of program
NAME = morse
SOURCES = $(NAME).c
# cpu frequency
F_CPU = 16000000L
#####################################################################
.PHONY: all clean upload
MCU_TARGET = atmega32
CFLAGS = -std=gnu99 -mmcu=$(MCU_TARGET) -DF_CPU=$(F_CPU) -O2
CXXFLAGS = $(CFLAGS)
LDFLAGS = -mmcu=$(MCU_TARGET)
CC = avr-gcc
CXX = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
KAMPROG = kamprogavrc -d -f
all: $(SOURCES) $(NAME).hex upload
$(NAME): $(NAME).hex
$(NAME).elf: $(SOURCES)
$(CC) $(CFLAGS) -o $(NAME).elf $(SOURCES)
$(NAME).hex: $(NAME).elf
$(OBJCOPY) -O ihex $(NAME).elf $(NAME).hex
upload: $(NAME).hex
$(KAMPROG) $(NAME).hex
# listing
lst: $(NAME).lst
%.lst: %.elf
$(OBJDUMP) -h -S $< > $@
clean:
rm -f *.hex *.o *.cof *.s *.lst *.elf