1# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2# Copyright 2012-2019 IBM Corp
3
4#
5# If you want to build in another directory copy this file there and
6# fill in the following values
7#
8
9#
10# Prefix of cross toolchain, if anything
11# Example: CROSS= powerpc64-unknown-linux-gnu-
12#
13ARCH = $(shell uname -m)
14ifdef CROSS_COMPILE
15	CROSS ?= $(CROSS_COMPILE)
16endif
17ifneq ("$(ARCH)", "ppc64")
18ifneq ("$(ARCH)", "ppc64le")
19ifneq ($(shell which powerpc64-linux-gcc 2> /dev/null),)
20	CROSS ?= powerpc64-linux-
21else ifneq ($(shell which powerpc64le-linux-gcc 2> /dev/null),)
22	CROSS ?= powerpc64le-linux-
23else ifneq ($(shell which powerpc64-linux-gnu-gcc 2> /dev/null),)
24	CROSS ?= powerpc64-linux-gnu-
25else ifneq ($(shell which powerpc64le-linux-gnu-gcc 2> /dev/null),)
26	CROSS ?= powerpc64le-linux-gnu-
27endif
28endif
29endif
30
31#
32# Main debug switch
33#
34DEBUG ?= 0
35
36# Run tests under valgrind?
37USE_VALGRIND ?= 1
38
39#
40# Optional location of embedded linux kernel file
41# This can be a raw vmlinux, stripped vmlinux or
42# zImage.epapr
43#
44KERNEL ?=
45
46#
47# Optional build with advanced stack checking
48#
49STACK_CHECK ?= $(DEBUG)
50
51#
52# Experimental (unsupported) build options
53#
54# Little-endian does not yet build. Include it here to set ELF ABI.
55LITTLE_ENDIAN ?= 0
56# ELF v2 ABI is more efficient and compact
57ELF_ABI_v2 ?= $(LITTLE_ENDIAN)
58# Discard unreferenced code and data at link-time
59DEAD_CODE_ELIMINATION ?= 0
60# Try to build without FSP code
61CONFIG_FSP?=1
62
63#
64# Where is the source directory, must be a full path (no ~)
65# Example: SRC= /home/me/skiboot
66#
67SRC=$(CURDIR)
68
69#
70# Where to get information about this machine (subdir name)
71#
72DEVSRC=hdata
73
74#
75# default config file, see include config_*.h for more specifics
76#
77CONFIG := config.h
78
79include $(SRC)/Makefile.main
80