2008-03-20 01:11:05 +01:00
|
|
|
##
|
|
|
|
## This file is part of the coreinfo project.
|
|
|
|
##
|
|
|
|
## Copyright (C) 2008 Advanced Micro Devices, Inc.
|
2008-03-24 16:47:49 +01:00
|
|
|
## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de>
|
2008-03-20 01:11:05 +01:00
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; version 2 of the License.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
src := $(shell pwd)
|
|
|
|
srctree := $(src)
|
2015-06-30 01:10:16 +02:00
|
|
|
srck := $(src)/../../util/kconfig
|
2016-03-08 00:26:51 +01:00
|
|
|
coreinfo_obj := $(src)/build
|
2012-12-01 01:04:58 +01:00
|
|
|
objk := $(src)/build/util/kconfig
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
export KERNELVERSION := 0.1.0
|
2016-03-08 00:26:51 +01:00
|
|
|
export KCONFIG_AUTOHEADER := $(coreinfo_obj)/config.h
|
|
|
|
export KCONFIG_AUTOCONFIG := $(coreinfo_obj)/auto.conf
|
|
|
|
export KCONFIG_DEPENDENCIES := $(coreinfo_obj)/auto.conf.cmd
|
|
|
|
export KCONFIG_SPLITCONFIG := $(coreinfo_obj)/config
|
|
|
|
export KCONFIG_TRISTATE := $(coreinfo_obj)/tristate.conf
|
2015-06-30 01:10:16 +02:00
|
|
|
export KCONFIG_NEGATIVES := 1
|
|
|
|
export Kconfig := Kconfig
|
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
export V := $(V)
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
CONFIG_SHELL := sh
|
|
|
|
KBUILD_DEFCONFIG := configs/defconfig
|
|
|
|
UNAME_RELEASE := $(shell uname -r)
|
|
|
|
HAVE_DOTCONFIG := $(wildcard .config)
|
|
|
|
MAKEFLAGS += -rR --no-print-directory
|
|
|
|
|
|
|
|
# Make is silent per default, but 'make V=1' will show all compiler calls.
|
|
|
|
ifneq ($(V),1)
|
2015-07-01 00:22:12 +02:00
|
|
|
.SILENT:
|
2008-03-24 16:47:49 +01:00
|
|
|
endif
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
HOSTCC ?= gcc
|
|
|
|
HOSTCXX ?= g++
|
2008-03-24 16:47:49 +01:00
|
|
|
HOSTCFLAGS := -I$(srck) -I$(objk)
|
|
|
|
HOSTCXXFLAGS := -I$(srck) -I$(objk)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
LIBCONFIG_PATH := ../libpayload
|
2015-06-30 01:44:12 +02:00
|
|
|
LIBPAYLOAD_DIR := build/libpayload
|
2012-12-01 01:15:36 +01:00
|
|
|
HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/libpayload/lib/libpayload.a)
|
|
|
|
LIB_CONFIG ?= defconfig
|
2012-12-01 01:04:58 +01:00
|
|
|
OBJCOPY ?= objcopy
|
2008-04-10 02:05:41 +02:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
INCLUDES = -I$(coreinfo_obj) -include $(LIBPAYLOAD_DIR)/libpayload/include/kconfig.h
|
2008-03-31 22:30:18 +02:00
|
|
|
OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
|
2008-07-08 18:18:38 +02:00
|
|
|
nvram_module.o bootlog_module.o ramdump_module.o lar_module.o \
|
2009-07-07 17:10:13 +02:00
|
|
|
multiboot_module.o cbfs_module.o coreinfo.o
|
2016-03-08 00:26:51 +01:00
|
|
|
OBJS = $(patsubst %,$(coreinfo_obj)/%,$(OBJECTS))
|
|
|
|
TARGET = $(coreinfo_obj)/coreinfo.elf
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2015-11-17 06:33:48 +01:00
|
|
|
all: real-all
|
|
|
|
|
|
|
|
# in addition to the dependency below, create the file if it doesn't exist
|
|
|
|
# to silence warnings about a file that would be generated anyway.
|
|
|
|
$(if $(wildcard .xcompile),,$(eval $(shell ../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
|
|
|
|
.xcompile: ../../util/xcompile/xcompile
|
|
|
|
$< $(XGCCPATH) > $@.tmp
|
|
|
|
\mv -f $@.tmp $@ 2> /dev/null || rm -f $@.tmp $@
|
|
|
|
|
|
|
|
CONFIG_COMPILER_GCC := y
|
|
|
|
ARCH-y := x86_32
|
|
|
|
|
|
|
|
include .xcompile
|
|
|
|
|
|
|
|
CC := $(CC_$(ARCH-y))
|
|
|
|
AS := $(AS_$(ARCH-y))
|
|
|
|
OBJCOPY := $(OBJCOPY_$(ARCH-y))
|
|
|
|
|
2016-02-27 04:47:06 +01:00
|
|
|
LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc
|
|
|
|
LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/libpayload/bin/lpas
|
2015-11-17 06:33:48 +01:00
|
|
|
|
|
|
|
CFLAGS += -Wall -Werror -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES)
|
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
ifneq ($(strip $(HAVE_DOTCONFIG)),)
|
2008-03-24 16:47:49 +01:00
|
|
|
include $(src)/.config
|
2015-11-17 06:33:48 +01:00
|
|
|
real-all: $(TARGET)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload
|
2015-07-01 00:22:12 +02:00
|
|
|
printf " LPCC $(subst $(shell pwd)/,,$(@)) (LINK)\n"
|
|
|
|
$(LPCC) -o $@ $(OBJS)
|
|
|
|
$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
|
|
|
|
$(OBJCOPY) --strip-debug $@
|
|
|
|
$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(coreinfo_obj)/%.S.o: $(src)/%.S libpayload
|
2015-07-01 00:22:12 +02:00
|
|
|
printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(LPAS) -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(coreinfo_obj)/%.o: $(src)/%.c libpayload
|
2015-07-01 00:22:12 +02:00
|
|
|
printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(LPCC) $(CFLAGS) -c -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
else
|
2015-11-17 06:33:48 +01:00
|
|
|
real-all: config
|
2008-03-24 16:47:49 +01:00
|
|
|
endif
|
|
|
|
|
2016-01-25 22:01:55 +01:00
|
|
|
defaultbuild:
|
|
|
|
$(MAKE) olddefconfig
|
|
|
|
$(MAKE) all
|
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
|
|
|
|
libpayload:
|
2015-07-01 00:22:12 +02:00
|
|
|
printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
|
2012-12-01 01:15:36 +01:00
|
|
|
else
|
|
|
|
libpayload:
|
2015-07-01 00:22:12 +02:00
|
|
|
printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
|
2015-11-17 06:33:48 +01:00
|
|
|
$(MAKE) -C $(LIBCONFIG_PATH) distclean
|
|
|
|
$(MAKE) -C $(LIBCONFIG_PATH) $(LIB_CONFIG)
|
|
|
|
$(MAKE) -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install
|
2012-12-01 01:15:36 +01:00
|
|
|
endif
|
2012-12-01 01:04:58 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(coreinfo_obj)/config.h:
|
2015-06-30 01:44:12 +02:00
|
|
|
$(MAKE) oldconfig
|
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(shell mkdir -p $(coreinfo_obj) $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2008-03-20 01:11:05 +01:00
|
|
|
clean:
|
2016-03-08 20:29:33 +01:00
|
|
|
rm -rf build/*.elf build/*.o .xcompile
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
distclean: clean
|
2015-07-01 00:22:12 +02:00
|
|
|
rm -rf build
|
|
|
|
rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig*
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2015-06-30 01:10:16 +02:00
|
|
|
include $(srck)/Makefile
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
.PHONY: $(PHONY) prepare clean distclean
|