1 ARCH
= $(shell uname
-m
)
2 ifneq ("$(ARCH)", "ppc64")
3 ifneq ("$(ARCH)", "ppc64le")
4 CROSS_COMPILE ?
= powerpc64le-linux-gnu-
8 CC
= $(CROSS_COMPILE
)gcc
9 LD
= $(CROSS_COMPILE
)ld
10 OBJCOPY
= $(CROSS_COMPILE
)objcopy
12 CFLAGS
= -Os
-g
-Wall
-std
=c99
-msoft-float
-mno-string
-mno-multiple
-mno-vsx
-mno-altivec
-mlittle-endian
-fno-stack-protector
-mstrict-align
-ffreestanding
-fdata-sections
-ffunction-sections
14 LDFLAGS
= -T powerpc.lds
18 hello_world.elf
: hello_world.o head.o console.o
19 $(LD
) $(LDFLAGS
) -o
$@
$^
21 hello_world.bin
: hello_world.elf
22 $(OBJCOPY
) -O binary
$^
$@
24 hello_world.hex
: hello_world.bin
25 ..
/scripts
/bin2hex.py
$^
> $@
28 @
rm -f
*.o hello_world.elf hello_world.bin hello_world.hex