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
|
2008-03-31 22:30:18 +02:00
|
|
|
INCLUDES = -I../libpayload/include -Ibuild \
|
2008-03-24 16:47:49 +01:00
|
|
|
-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-31 22:30:18 +02:00
|
|
|
OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
|
|
|
|
nvram_module.o coreinfo.o
|
|
|
|
OBJS = $(patsubst %,$(obj)/%,$(OBJECTS))
|
2008-03-24 16:47:49 +01:00
|
|
|
TARGET = $(obj)/coreinfo.elf
|
|
|
|
|
|
|
|
ifeq ($(strip $(HAVE_DOTCONFIG)),)
|
|
|
|
|
2008-04-04 00:20:35 +02:00
|
|
|
all: config
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
include $(src)/.config
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2008-03-27 21:46:49 +01:00
|
|
|
all: prepare $(TARGET)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
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-04-04 00:20:35 +02:00
|
|
|
$(Q)rm -rf build/util build/*.conf build/*.cmd 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
|
|
|
|