-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (28 loc) · 777 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
PROJECT=saRTOS
SOURCES=main.c
LIBRARY=
INCPATHS=
LIBPATHS=
MCU=atmega1280
LDFLAGS=-g -mmcu=$(MCU)
CFLAGS=-c -Wall -g -Os -mmcu=$(MCU)
CC=avr-gcc
OBJCOPY=avr-objcopy
# Automatic generation of some important lists
OBJECTS=$(SOURCES:.c=.o)
INCFLAGS=$(foreach TMP,$(INCPATHS),-I$(TMP))
LIBFLAGS=$(foreach TMP,$(LIBPATHS),-L$(TMP))
# Set up the output file names for the different output types
BINARY=$(PROJECT)
all: $(SOURCES) $(BINARY)
$(BINARY): $(OBJECTS)
$(CC) $(LIBFLAGS) $(OBJECTS) $(LDFLAGS) -o [email protected]
$(OBJCOPY) -j .text -j .data -O ihex [email protected] [email protected]
.c.o:
$(CC) $(INCFLAGS) $(CFLAGS) -fPIC $< -o $@
distclean: clean
rm -f $(BINARY)
clean:
rm -f $(OBJECTS)
upload:
avrdude -DV -p $(MCU) -P /dev/ttyUSB0 -c arduino -b 57600 -U flash:w:$(PROJECT).hex:i