-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) · 1.33 KB
/
Makefile
File metadata and controls
68 lines (56 loc) · 1.33 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
TARGET=clocky
SOURCES=clocky.c
MCU=msp430g2452
#MCU=msp430g2553
#MCU=msp430g2231
#CFLAGS = -mmcu=$(MCU) -g -Os -Wall -Wunused $(INCLUDES)
CFLAGS = -mmcu=$(MCU) -g -O0 -Wall -Wunused $(INCLUDES)
ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=$(TARGET).map
CC = msp430-gcc
LD = msp430-ld
AR = msp430-ar
AS = msp430-gcc
GASP = msp430-gasp
NM = msp430-nm
OBJCOPY = msp430-objcopy
RANLIB = msp430-ranlib
STRIP = msp430-strip
SIZE = msp430-size
READELF = msp430-readelf
MAKETXT = srec_cat
CP = cp -p
RM = rm -f
MV = mv
DEPEND = $(SOURCES:.c=.d)
OBJECTS = $(SOURCES:.c=.o)
all: $(TARGET).elf $(TARGET).hex $(TARGET).txt
$(TARGET).elf: $(OBJECTS)
@echo "Linking $@"
$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
@echo
@echo ">>>>> Size of firmware <<<<<"
$(SIZE) $(TARGET).elf
@echo
%.hex: %.elf
$(OBJCOPY) -O ihex $< $@
%.txt: %.hex
$(MAKETXT) -O $@ -TITXT $< -I
%.o: %.c
@echo "Compiling $<"
$(CC) -c $(CFLAGS) -o $@ $<
%.lst: %.c
$(CC) -c $(CFLAGS) -Wa,-anlhd $< > $@
ifneq ($(MAKECMDGOALS), clean)
-include $(DEPEND)
endif
%.d: %.c
@echo "Generating dependencies $@ from $<";
$(CC) -M ${CFLAGS} $< >$@
#.SILENT:
.PHONY: clean
clean:
$(RM) $(OBJECTS)
$(RM) $(TARGET).{elf,hex,map,txt}
$(RM) $(SOURCES:.c=.lst)
$(RM) $(DEPEND)