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.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program; if not, write to the Free Software
|
2013-02-23 18:37:27 +01:00
|
|
|
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2008-03-20 01:11:05 +01:00
|
|
|
##
|
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
src := $(shell pwd)
|
|
|
|
srctree := $(src)
|
|
|
|
srck := $(src)/util/kconfig
|
|
|
|
obj := $(src)/build
|
|
|
|
objk := $(src)/build/util/kconfig
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
export KERNELVERSION := 0.1.0
|
|
|
|
export KCONFIG_AUTOHEADER := $(obj)/config.h
|
|
|
|
export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
|
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)
|
|
|
|
Q := @
|
|
|
|
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
|
|
|
|
LIBPAYLOAD_DIR := ./libpayloadbin
|
|
|
|
LPCC := $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc
|
|
|
|
LPAS := $(LIBPAYLOAD_DIR)/libpayload/bin/lpas
|
|
|
|
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
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
INCLUDES = -I$(obj)
|
2008-04-10 02:05:41 +02:00
|
|
|
CFLAGS := -Wall -Werror -Os $(INCLUDES)
|
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
|
2008-03-31 22:30:18 +02:00
|
|
|
OBJS = $(patsubst %,$(obj)/%,$(OBJECTS))
|
2008-03-24 16:47:49 +01:00
|
|
|
TARGET = $(obj)/coreinfo.elf
|
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
ifneq ($(strip $(HAVE_DOTCONFIG)),)
|
2008-03-24 16:47:49 +01:00
|
|
|
include $(src)/.config
|
2008-11-12 00:41:08 +01:00
|
|
|
all: $(TARGET)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
$(TARGET): $(src)/.config $(OBJS) prepare libpayload
|
2012-12-01 01:04:58 +01:00
|
|
|
$(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)$(LPCC) -o $@ $(OBJS)
|
|
|
|
$(Q)$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
|
|
|
|
$(Q)$(OBJCOPY) --strip-debug $@
|
|
|
|
$(Q)$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
$(obj)/%.S.o: $(src)/%.S libpayload
|
2012-12-01 01:04:58 +01:00
|
|
|
$(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)$(LPAS) -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
$(obj)/%.o: $(src)/%.c libpayload
|
2012-12-01 01:04:58 +01:00
|
|
|
$(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)$(LPCC) $(CFLAGS) -c -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
else
|
|
|
|
all: config
|
2008-03-24 16:47:49 +01:00
|
|
|
endif
|
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
|
|
|
|
libpayload:
|
|
|
|
$(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
|
|
|
|
else
|
|
|
|
libpayload:
|
|
|
|
$(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
|
|
|
|
$(Q)make -C $(LIBCONFIG_PATH) distclean
|
|
|
|
$(Q)make -C $(LIBCONFIG_PATH) $(LIB_CONFIG)
|
|
|
|
$(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install
|
|
|
|
endif
|
2012-12-01 01:04:58 +01:00
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
prepare:
|
|
|
|
$(Q)mkdir -p $(obj)/util/kconfig/lxdialog
|
|
|
|
|
2008-03-20 01:11:05 +01:00
|
|
|
clean:
|
2008-05-11 17:51:31 +02:00
|
|
|
$(Q)rm -rf build/*.elf build/*.o
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
distclean: clean
|
2008-04-04 00:20:35 +02:00
|
|
|
$(Q)rm -rf build
|
2008-03-24 16:47:49 +01:00
|
|
|
$(Q)rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig*
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
include util/kconfig/Makefile
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
.PHONY: $(PHONY) prepare clean distclean
|
2008-03-20 01:11:05 +01:00
|
|
|
|