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

wirehaze git hosting

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