1 | HAS_PPC64 := y |
---|
2 | |
---|
3 | CC := $(CROSS_COMPILE)gcc |
---|
4 | LD := $(CROSS_COMPILE)ld |
---|
5 | |
---|
6 | # These are goodess that applies to all source. |
---|
7 | C_WARNINGS := -Wredundant-decls |
---|
8 | |
---|
9 | # _no_ common code can have packed data structures or we are in touble. |
---|
10 | C_WARNINGS += -Wpacked |
---|
11 | |
---|
12 | CFLAGS := -m64 -ffreestanding -fno-builtin -fno-common -fno-strict-aliasing |
---|
13 | CFLAGS += -iwithprefix include -Wall -Werror -pipe |
---|
14 | CFLAGS += -I$(BASEDIR)/include |
---|
15 | CFLAGS += -I$(BASEDIR)/include/asm-powerpc/mach-generic |
---|
16 | CFLAGS += -I$(BASEDIR)/include/asm-powerpc/mach-default |
---|
17 | CFLAGS += $(C_WARNINGS) |
---|
18 | CFLAGS += -msoft-float -O2 |
---|
19 | CFLAGS-$(debug) += -O0 # last one wins |
---|
20 | CFLAGS-$(papr_vterm) += -DPAPR_VDEVICE -DPAPR_VTERM |
---|
21 | |
---|
22 | LDFLAGS += -m elf64ppc |
---|
23 | |
---|
24 | # |
---|
25 | # command to embed a binary inside a .o |
---|
26 | # |
---|
27 | %.o: %.bin |
---|
28 | $(CROSS_COMPILE)objcopy --input-target=binary \ |
---|
29 | --output-target=elf64-powerpc \ |
---|
30 | --binary-architecture=powerpc \ |
---|
31 | --redefine-sym _binary_$*_bin_start=$*_start \ |
---|
32 | --redefine-sym _binary_$*_bin_end=$*_end \ |
---|
33 | --redefine-sym _binary_$*_bin_size=$*_size \ |
---|
34 | $< $@ |
---|
35 | |
---|
36 | # Test for at least GCC v3.2.x. |
---|
37 | gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/') |
---|
38 | ifeq ($(call gcc-ver,1),1) |
---|
39 | $(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x) |
---|
40 | endif |
---|
41 | ifeq ($(call gcc-ver,1),2) |
---|
42 | $(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x) |
---|
43 | endif |
---|
44 | ifeq ($(call gcc-ver,1),3) |
---|
45 | ifeq ($(call gcc-ver,2),0) |
---|
46 | $(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x) |
---|
47 | endif |
---|
48 | ifeq ($(call gcc-ver,2),1) |
---|
49 | $(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x) |
---|
50 | endif |
---|
51 | endif |
---|