blob: 096e9c60cf4f93a81440048fd441cf001483c737 [file] [log] [blame]
Patrick Georgi8480c0b2020-05-08 22:50:46 +02001## SPDX-License-Identifier: GPL-2.0-only
Jordan Crouse7249f792008-03-20 00:11:05 +00002
Nico Huber11326002020-12-27 21:03:34 +01003unexport $(COREBOOT_EXPORTS)
4
Martin Roth6116f362016-03-08 12:32:40 -07005src := $(CURDIR)
Nico Huber552163e2020-11-15 19:32:26 +01006obj := build
7
Marc Jones5d01b762012-11-30 17:04:58 -07008srctree := $(src)
Stefan Reinauer0ab2b252015-06-29 16:10:16 -07009srck := $(src)/../../util/kconfig
Marc Jones5d01b762012-11-30 17:04:58 -070010objk := $(src)/build/util/kconfig
Uwe Hermann2216d1b2008-03-24 15:47:49 +000011
Nico Huber552163e2020-11-15 19:32:26 +010012LIBPAYLOAD_DEFCONFIG ?= $(src)/../libpayload/configs/defconfig-tinycurses
Stefan Reinauer0ab2b252015-06-29 16:10:16 -070013
Nico Huber552163e2020-11-15 19:32:26 +010014PAYLOAD_DEPS := $(obj)/config.h
15
16OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
17 nvram_module.o bootlog_module.o ramdump_module.o \
18 multiboot_module.o cbfs_module.o timestamps_module.o coreinfo.o
19OBJS = $(patsubst %,$(obj)/%,$(OBJECTS))
20TARGET = $(obj)/coreinfo.elf
21
22ARCH := x86_32
23
24all: real-all
25
26include ../libpayload/Makefile.payload
27
28ifeq ($(filter %clean,$(MAKECMDGOALS)),)
29export KERNELVERSION := 0.1.0
30export KCONFIG_AUTOHEADER := $(obj)/config.h
31export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
32export KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd
33export KCONFIG_SPLITCONFIG := $(obj)/config
34export KCONFIG_TRISTATE := $(obj)/tristate.conf
35export KCONFIG_CONFIG := $(CURDIR)/.config
36export KCONFIG_NEGATIVES := 1
Patrick Georgi53ea1d42019-11-22 16:55:58 +010037export KBUILD_KCONFIG := Kconfig
Uwe Hermann2216d1b2008-03-24 15:47:49 +000038
39CONFIG_SHELL := sh
40KBUILD_DEFCONFIG := configs/defconfig
41UNAME_RELEASE := $(shell uname -r)
42HAVE_DOTCONFIG := $(wildcard .config)
43MAKEFLAGS += -rR --no-print-directory
44
Marc Jones5d01b762012-11-30 17:04:58 -070045HOSTCC ?= gcc
46HOSTCXX ?= g++
Uwe Hermann2216d1b2008-03-24 15:47:49 +000047HOSTCFLAGS := -I$(srck) -I$(objk)
48HOSTCXXFLAGS := -I$(srck) -I$(objk)
49
Nico Huber552163e2020-11-15 19:32:26 +010050CFLAGS += -I$(obj) -I../../src/commonlib/include
Martin Rothcacbcf42015-11-16 22:33:48 -070051
Marc Jones5d01b762012-11-30 17:04:58 -070052ifneq ($(strip $(HAVE_DOTCONFIG)),)
Uwe Hermann2216d1b2008-03-24 15:47:49 +000053include $(src)/.config
Martin Rothcacbcf42015-11-16 22:33:48 -070054real-all: $(TARGET)
Jordan Crouse7249f792008-03-20 00:11:05 +000055
Jacob Garber5e6c30b2019-10-02 18:55:23 -060056ifeq ($(CONFIG_LTO),y)
57CFLAGS += -flto
58endif
59
Marc Jones5d01b762012-11-30 17:04:58 -070060else
Martin Rothcacbcf42015-11-16 22:33:48 -070061real-all: config
Uwe Hermann2216d1b2008-03-24 15:47:49 +000062endif
63
Martin Roth50943b12016-01-25 14:01:55 -070064defaultbuild:
65 $(MAKE) olddefconfig
66 $(MAKE) all
67
Nico Huber552163e2020-11-15 19:32:26 +010068$(obj)/config.h:
Stefan Reinauerccc55fd2015-06-29 16:44:12 -070069 $(MAKE) oldconfig
70
Nico Huber552163e2020-11-15 19:32:26 +010071$(shell mkdir -p $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
Uwe Hermann2216d1b2008-03-24 15:47:49 +000072
Patrick Georgi53ea1d42019-11-22 16:55:58 +010073include $(srck)/Makefile.inc
Patrick Georgi0ffef882017-01-19 23:20:14 +010074
Nico Huber552163e2020-11-15 19:32:26 +010075.PHONY: $(PHONY) prepare all real-all defaultbuild
Patrick Georgi0ffef882017-01-19 23:20:14 +010076
77else
78
Uwe Hermann2216d1b2008-03-24 15:47:49 +000079distclean: clean
Nico Huber552163e2020-11-15 19:32:26 +010080 rm -f .config*
Jordan Crouse7249f792008-03-20 00:11:05 +000081
Nico Huber552163e2020-11-15 19:32:26 +010082.PHONY: distclean
Patrick Georgi0ffef882017-01-19 23:20:14 +010083endif