-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile.examples
35 lines (28 loc) · 1.11 KB
/
Makefile.examples
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
# To reproduce builds on Ubuntu 16.04, install following packages:
# gcc-multilib-arm-linux-gnueabihf
# gcc-multilib-mips-linux-gnu
# gcc-multilib-mipsel-linux-gnu
# gcc-multilib-powerpc-linux-gnu
# gcc-multilib-powerpc64-linux-gnu
# gcc-multilib-s390x-linux-gnu
# gcc-multilib-sparc64-linux-gnu
all: \
example-arm_32_arm.elf \
example-arm_32_thumb1.elf \
example-arm_32_thumb2.elf \
example-x86_32.elf \
example-x86_64.elf \
CFLAGS = -fno-exceptions -Wl,--build-id=none
example-x86_32.elf: example.c
gcc -m32 $(CFLAGS) $^ -o $@
example-x86_64.elf: example.c
gcc -m64 $(CFLAGS) $^ -o $@
# Startup code may still be Thumb2, force entry point directly to our main
example-arm_32_arm.elf: example.c
arm-linux-gnueabihf-gcc-5 -marm -march=armv6 -Wl,--entry,main $(CFLAGS) $^ -o $@
# Startup code may still be ARM/Thumb2, force entry point directly to our main
example-arm_32_thumb1.elf: example.c
arm-linux-gnueabihf-gcc-5 -mthumb -march=armv6 -mfloat-abi=soft -Wl,--thumb-entry,main $(CFLAGS) $^ -o $@
# Thumb2 is default
example-arm_32_thumb2.elf: example.c
arm-linux-gnueabihf-gcc-5 $(CFLAGS) $^ -o $@