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

wirehaze git hosting

-Os
[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 -pedantic \
32 -pedantic-errors \
33 -Wall \
34 -Wextra \
35 -Wconversion \
36 -Wstrict-prototypes \
37 -Wshadow \
38 -Wundef \
39 -Wdouble-promotion \
40 -Os
41
42 LD := arm-none-eabi-ld
43 LDFLAGS := -nostdlib
44 LDLIBS :=
45
46 OC := arm-none-eabi-objcopy
47 OCFLAGS := --output-target=binary
48
49 # --------------------------------------------------------------------------- #
50
51 objs := kernel.o
52 lds := kernel.ld
53 LDFLAGS += -T $(lds)
54
55 elf := kernel.elf
56 bin := kernel.bin
57
58 # --------------------------------------------------------------------------- #
59
60 all : $(bin)
61
62 clean :
63 rm -f $(bin) $(elf) $(objs)
64
65 .PHONY : all clean
66
67 $(bin) : $(elf)
68 $(OC) $(OCFLAGS) $< $@
69
70 $(elf) : $(objs) $(lds)
71 $(LD) $(filter %.o,$^) $(LDFLAGS) $(LDLIBS) -o $@