forked from entropia/kuechenlicht
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (30 loc) · 920 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
OBJS = src/startup.o \
src/irq.o \
src/main.o \
src/pwm.o \
src/systick.o \
src/drv/sysinit.o \
src/drv/syscon.o \
src/drv/clock.o \
src/drv/gpio.o \
src/drv/sct.o \
src/drv/swm.o \
src/drv/iocon.o
COMPILER_PREFIX=arm-none-eabi
CFLAGS=-mthumb -mcpu=cortex-m0plus -Os -g -flto -fno-common -ffreestanding -Wall -Wno-unused-function -Wextra -Werror -std=c99
LDFLAGS=-Wl,--gc-sections -Os -flto -g -nostartfiles -mthumb -mcpu=cortex-m0plus
CC=$(COMPILER_PREFIX)-gcc
LD=$(COMPILER_PREFIX)-ld
OBJCOPY=$(COMPILER_PREFIX)-objcopy
SIZE=$(COMPILER_PREFIX)-size
GDB=$(COMPILER_PREFIX)-gdb
all: kuechenlicht.bin
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ -Iinclude/ $<
kuechenlicht.elf: $(OBJS)
$(CC) -o $@ -T linker.ld $(LDFLAGS) $(OBJS) -lgcc
$(SIZE) $@
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
clean:
rm -f $(OBJS) kuechenlicht.elf kuechenlicht.bin