summaryrefslogtreecommitdiff
path: root/payloads/coreinfo/Makefile
blob: 9655e24cc333e468d5bb41aba8c502f0cbec5b7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
## SPDX-License-Identifier: GPL-2.0-only

unexport $(COREBOOT_EXPORTS)

src := $(CURDIR)
obj := build

srctree := $(src)
srck := $(src)/../../util/kconfig
objk := $(src)/build/util/kconfig

LIBPAYLOAD_DEFCONFIG ?= $(src)/../libpayload/configs/defconfig-tinycurses

PAYLOAD_DEPS := $(obj)/config.h

OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
	  nvram_module.o bootlog_module.o ramdump_module.o \
	  multiboot_module.o cbfs_module.o timestamps_module.o coreinfo.o
OBJS    = $(patsubst %,$(obj)/%,$(OBJECTS))
TARGET  = $(obj)/coreinfo.elf

ARCH := x86_32

all: real-all

include ../libpayload/Makefile.payload

ifeq ($(filter %clean,$(MAKECMDGOALS)),)
export KERNELVERSION		:= 0.1.0
export KCONFIG_AUTOHEADER	:= $(obj)/config.h
export KCONFIG_AUTOCONFIG	:= $(obj)/auto.conf
export KCONFIG_DEPENDENCIES	:= $(obj)/auto.conf.cmd
export KCONFIG_SPLITCONFIG	:= $(obj)/config
export KCONFIG_TRISTATE		:= $(obj)/tristate.conf
export KCONFIG_CONFIG		:= $(CURDIR)/.config
export KCONFIG_NEGATIVES	:= 1
export KBUILD_KCONFIG		:= Kconfig

CONFIG_SHELL := sh
KBUILD_DEFCONFIG := configs/defconfig
UNAME_RELEASE := $(shell uname -r)
HAVE_DOTCONFIG := $(wildcard .config)
MAKEFLAGS += -rR --no-print-directory

HOSTCC ?= gcc
HOSTCXX ?= g++
HOSTCFLAGS := -I$(srck) -I$(objk)
HOSTCXXFLAGS := -I$(srck) -I$(objk)

CFLAGS += -I$(obj) -I../../src/commonlib/include

ifneq ($(strip $(HAVE_DOTCONFIG)),)
include $(src)/.config
real-all: $(TARGET)

ifeq ($(CONFIG_LTO),y)
CFLAGS += -flto
endif

else
real-all: config
endif

defaultbuild:
	$(MAKE) olddefconfig
	$(MAKE) all

$(obj)/config.h:
	$(MAKE) oldconfig

$(shell mkdir -p $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))

include $(srck)/Makefile.mk

.PHONY: $(PHONY) prepare all real-all defaultbuild

else

distclean: clean
	rm -f .config*

.PHONY: distclean
endif