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
|
2008-08-07 17:22:01 +02:00
|
|
|
XCC := CC=$(CC) $(LIBPAYLOAD_DIR)/bin/lpgcc
|
2008-04-10 02:05:41 +02:00
|
|
|
AS = $(LIBPAYLOAD_DIR)/bin/lpas
|
2008-08-07 17:22:01 +02:00
|
|
|
STRIP ?= strip
|
2008-04-10 02:05:41 +02:00
|
|
|
|
|
|
|
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 \
|
2008-07-08 18:18:38 +02:00
|
|
|
nvram_module.o bootlog_module.o ramdump_module.o lar_module.o \
|
2008-11-11 20:53:42 +01:00
|
|
|
multiboot_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
|
|
|
|
|
|
|
|
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-05-11 17:51:31 +02:00
|
|
|
$(TARGET): $(src)/.config $(OBJS)
|
2008-03-24 16:47:49 +01:00
|
|
|
$(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n"
|
2008-08-07 17:22:01 +02:00
|
|
|
$(Q)$(XCC) -o $@ $(OBJS)
|
2008-03-24 16:47:49 +01:00
|
|
|
$(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n"
|
2008-08-07 17:22:01 +02:00
|
|
|
$(Q)$(STRIP) -s $@
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
$(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-08-07 17:22:01 +02:00
|
|
|
$(Q)$(XCC) $(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-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
|
|
|
|