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
|
|
|
|
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
##
|
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
export src := $(shell pwd)
|
|
|
|
export srctree := $(src)
|
|
|
|
export srck := $(src)/util/kconfig
|
|
|
|
export obj := $(src)/build
|
|
|
|
export objk := $(src)/build/util/kconfig
|
|
|
|
|
|
|
|
export KERNELVERSION := 0.1.0
|
|
|
|
export KCONFIG_AUTOHEADER := $(obj)/config.h
|
|
|
|
export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
|
|
|
|
|
|
|
|
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
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
HOSTCC = gcc
|
|
|
|
HOSTCXX = g++
|
|
|
|
HOSTCFLAGS := -I$(srck) -I$(objk)
|
|
|
|
HOSTCXXFLAGS := -I$(srck) -I$(objk)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
CC = gcc
|
|
|
|
CROSS_CFLAGS = -m32
|
|
|
|
INCLUDES = -I../libpayload/include \
|
|
|
|
-I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | \
|
|
|
|
head -n 1 | cut -d' ' -f2)include
|
2008-03-20 02:11:28 +01:00
|
|
|
LIBPAYLOAD = ../libpayload/libpayload.a
|
|
|
|
LIBGCC := $(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name)
|
2008-03-20 21:05:22 +01:00
|
|
|
CFLAGS := -Wall -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
|
2008-03-24 16:47:49 +01:00
|
|
|
MODULES = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o
|
2008-03-20 01:11:05 +01:00
|
|
|
OBJECTS = coreinfo.o
|
2008-03-24 16:47:49 +01:00
|
|
|
OBJS = $(patsubst %,$(obj)/%,$(OBJECTS)) $(patsubst %,$(obj)/%,$(MODULES))
|
|
|
|
TARGET = $(obj)/coreinfo.elf
|
|
|
|
|
|
|
|
ifeq ($(strip $(HAVE_DOTCONFIG)),)
|
|
|
|
|
|
|
|
all:
|
|
|
|
$(Q)printf "Please run make config/menuconfig/xconfig/gconfig first.\n"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
include $(src)/.config
|
2008-03-20 01:11:05 +01:00
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
2008-03-24 16:47:49 +01:00
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
$(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)#ld --verbose -T ../libpayload/libpayload.ldscript -o $@ $(OBJS) \
|
|
|
|
#--whole-archive $(LIBPAYLOAD) --no-whole-archive $(LIBGCC)
|
|
|
|
$(Q)ld -T ../libpayload/libpayload.ldscript -o $@ $(OBJS) \
|
|
|
|
../libpayload/i386/head.o $(LIBPAYLOAD) $(LIBGCC)
|
|
|
|
$(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)strip -s $@
|
|
|
|
|
|
|
|
$(obj)/%.S.o: $(src)/%.S
|
|
|
|
$(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)$(AS) --32 -o $@ $<
|
|
|
|
|
|
|
|
$(obj)/%.o: $(src)/%.c
|
|
|
|
$(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)$(CC) $(CROSS_CFLAGS) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
prepare:
|
|
|
|
$(Q)mkdir -p $(obj)/util/kconfig/lxdialog
|
|
|
|
|
2008-03-20 01:11:05 +01:00
|
|
|
clean:
|
2008-03-24 16:47:49 +01:00
|
|
|
$(Q)rm -rf build
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
$(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
|
|
|
|