]> wirehaze git hosting - stm32f411ceu6.git/blob - Makefile

wirehaze git hosting

3c19779dd381e2ce818e91b41b5942198987d304
[stm32f411ceu6.git] / Makefile
1 # GNU 'make'
2 #
3 # 10.2 Catalogue of Built-In Rules
4 # ================================
5 #
6 # Compiling C programs
7 # 'N.o' is made automatically from 'N.c' with a recipe of the form
8 # '$(CC) $(CPPFLAGS) $(CFLAGS) -c'.
9 #
10 # Assembling and preprocessing assembler programs
11 # 'N.o' is made automatically from 'N.s' by running the assembler,
12 # 'as'. The precise recipe is '$(AS) $(ASFLAGS)'.
13 #
14 # 'N.s' is made automatically from 'N.S' by running the C
15 # preprocessor, 'cpp'. The precise recipe is '$(CPP) $(CPPFLAGS)'.
16
17 CPP := arm-none-eabi-cpp
18 CPPFLAGS :=
19
20 AS := arm-none-eabi-as
21 ASFLAGS :=
22
23 CC := arm-none-eabi-gcc
24 CFLAGS := -march=armv7e-m+fp \
25 -mtune=cortex-m4 \
26 -mthumb \
27 -mfloat-abi=hard \
28 -std=gnu90 \
29 -ffreestanding \
30 -fsingle-precision-constant \
31 -Wall \
32 -Wextra \
33 -Wconversion \
34 -Wstrict-prototypes \
35 -Wmissing-prototypes \
36 -Wshadow \
37 -Wundef \
38 -Wdouble-promotion \
39 -Os
40
41 LD := arm-none-eabi-ld
42 LDFLAGS := -nostdlib
43 LDLIBS :=
44
45 OC := arm-none-eabi-objcopy
46 OCFLAGS := --output-target=binary
47
48 # --------------------------------------------------------------------------- #
49
50 objs := $(patsubst %.c, %.o, $(wildcard *.c))
51 lds := kernel.ld
52 LDFLAGS += -T $(lds)
53
54 elf := kernel.elf
55 bin := kernel.bin
56
57 # --------------------------------------------------------------------------- #
58
59 all : $(bin)
60
61 clean :
62 rm -f $(bin) $(elf) $(objs)
63
64 .PHONY : all clean
65
66 $(bin) : $(elf)
67 $(OC) $(OCFLAGS) $< $@
68
69 $(elf) : $(objs) $(lds)
70 $(LD) $(filter %.o,$^) $(LDFLAGS) $(LDLIBS) -o $@