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

wirehaze git hosting

initial commit
[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 # Preprocessor
18 CPP := arm-none-eabi-cpp
19 CPPFLAGS :=
20
21 # Assembler
22 AS := arm-none-eabi-as
23 ASFLAGS :=
24
25 # C Compiler
26 CC := arm-none-eabi-gcc
27 CFLAGS := -march=armv7e-m+fp \
28 -mtune=cortex-m4 \
29 -mthumb \
30 -mfloat-abi=hard \
31 -std=gnu90 \
32 -ffreestanding \
33 -fsingle-precision-constant \
34 -pedantic \
35 -pedantic-errors \
36 -Wall \
37 -Wextra \
38 -Wconversion \
39 -Wstrict-prototypes \
40 -Wshadow \
41 -Wundef \
42 -Wdouble-promotion
43
44 # Linker
45 LD := arm-none-eabi-ld
46 LDFLAGS := -nostdlib
47 LDLIBS :=
48
49 # objcopy
50 OC := arm-none-eabi-objcopy
51 OCFLAGS := --output-target=binary
52
53 # Build
54 objs := kernel.o
55 lds := kernel.ld
56 LDFLAGS += -T $(lds)
57
58 elf := kernel.elf
59 bin := kernel.bin
60
61 # Targets
62 all : $(bin)
63
64 clean :
65 rm -f $(bin) $(elf) $(objs)
66
67 .PHONY : all clean
68
69 $(bin) : $(elf)
70 $(OC) $(OCFLAGS) $< $@
71
72 $(elf) : $(objs) $(lds)
73 $(LD) $(filter %.o,$^) $(LDFLAGS) $(LDLIBS) -o $@