-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (35 loc) · 822 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
CROSS_COMPILE?=arm-none-eabi-
CC:=$(CROSS_COMPILE)gcc
LD:=$(CROSS_COMPILE)gcc
OBJDUMP:=$(CROSS_COMPILE)objdump
OUTPUT:=uhk
TARGETS:=$(OUTPUT).elf $(OUTPUT).lst $(OUTPUT).map
all: $(TARGETS)
OPTIMIZATION:=-Og
INCLUDES:=-I.
CFLAGS:=-Wall -march=armv6-m -mthumb $(OPTIMIZATION) $(INCLUDES)
LDFLAGS:=-nostartfiles -T mkl25z4.ld -Wl,-Map=$(OUTPUT).map
SOURCES:= \
_startup.c \
clock.c \
interrupts.c \
gpio.c \
main.c \
matrix.c \
pinmux.c \
tpm.c \
OBJECTS:=$(SOURCES:%.c=%.o)
DEPS:=$(SOURCES:%.c=%.d)
-include $(DEPS)
%.elf %.map: $(OBJECTS)
$(LD) $(LDFLAGS) -o $@ $^
%.lst: %.elf
$(OBJDUMP) -S $< > $@
clean:
rm -f $(TARGETS) $(OBJECTS) $(DEPS)
%.o: %.c
$(CC) $(CFLAGS) -MMD -c -o $@ $<
.DEFAULT_GOAL:=all
.PHONY: all clean
# Don't delete objects as intermediate files
.SECONDARY: $(OBJECTS)