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-04-10 02:05:41 +02:00
|
|
|
LIBPAYLOAD_DIR := ../libpayload
|
|
|
|
CC = $(LIBPAYLOAD_DIR)/bin/lpgcc
|
|
|
|
AS = $(LIBPAYLOAD_DIR)/bin/lpas
|
|
|
|
|
|
|
|
INCLUDES = -Ibuild
|
|
|
|
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 \
|
|
|
|
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"
|
2008-04-10 02:05:41 +02:00
|
|
|
$(Q)$(CC) -o $@ $(OBJS)
|
2008-03-24 16:47:49 +01:00
|
|
|
$(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n"
|
|
|
|
$(Q)strip -s $@
|
|
|
|
|
|
|
|
$(obj)/%.S.o: $(src)/%.S
|
|
|
|
$(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n"
|
2008-04-10 02:05:41 +02:00
|
|
|
$(Q)$(AS) -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
$(obj)/%.o: $(src)/%.c
|
|
|
|
$(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n"
|
2008-04-10 02:05:41 +02:00
|
|
|
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
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
|
|
|
|