Merge remote-tracking branch 'remotes/origin/master'
[microwatt.git] / hello_world / Makefile
1 ARCH = $(shell uname -m)
2 ifneq ("$(ARCH)", "ppc64")
3 ifneq ("$(ARCH)", "ppc64le")
4 CROSS_COMPILE ?= powerpc64le-linux-gnu-
5 endif
6 endif
7
8 CC = $(CROSS_COMPILE)gcc
9 LD = $(CROSS_COMPILE)ld
10 OBJCOPY = $(CROSS_COMPILE)objcopy
11
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
13 ASFLAGS = $(CFLAGS)
14 LDFLAGS = -T powerpc.lds
15
16 all: hello_world.hex
17
18 hello_world.elf: hello_world.o head.o console.o
19 $(LD) $(LDFLAGS) -o $@ $^
20
21 hello_world.bin: hello_world.elf
22 $(OBJCOPY) -O binary $^ $@
23
24 hello_world.hex: hello_world.bin
25 ../scripts/bin2hex.py $^ > $@
26
27 clean:
28 @rm -f *.o hello_world.elf hello_world.bin hello_world.hex