coreboot/Makefile
Uwe Hermann ff7df4f7ad Add cross compilation support and simplify the far to complex serial
code (This goes hand in hand, as some parts of serial were hardcoded
to one architecture until now)

* include/uart8250.h: add TTYSx defines that are used in
  multiple places. formerly part of arch/x86/serial.c.
  Drop init_uart8250 (unused)
* lib/uart8250.c: drop arch/x86/config.h usage
  Drop init_uart8250 (unused)
* arch/powerpc/Kconfig, arch/x86/Kconfig: add CONFIG_ARCH to
  contain the directory name under LinuxBIOSv3/arch/
* arch/x86/console.c: drop some dead code. Drop hardcoded config.h values.
  use generic uart8250.h header
* arch/x86/cachemain.c: Drop hardcoded config.h values. Still use hardcoded
  ROM size for now. (To be changed later)
* arch/x86/config.h: dropped, no longer needed
* arch/x86/serial.c: factor out generically used defines to uart8250.h
* Makefile: use mainboard architecture instead of target architecture to choose
  include path.
  Read .xcompile if available (configure replacement).
  Create build.h with compile time and version.
* util/xcompile/xcompile: new file. Search for supported cross compilers
  linkers, assemblers (and potentially supported compiler flags etc)
  This is a very slick configure replacement.
* util/dtc/Makefile: fix Makefile for cross compilation

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@190 f3766cd6-281f-0410-b1cd-43a5c92072e9
2007-03-05 21:14:21 +00:00

132 lines
3.3 KiB
Makefile

##
## This file is part of the LinuxBIOS project.
##
## LinuxBIOS build system Lbuild
##
## Copyright (C) 2007 coresystems GmbH
##
## 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; either version 2 of the License, or
## (at your option) any later version.
##
## 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
##
VERSION = 3
PATCHLEVEL = 0
SUBLEVEL = 0
have_dotconfig := $(wildcard .config)
have_dotxcompile := $(wildcard .xcompile)
src:=$(shell pwd)
obj:=$(shell pwd)/lbobj
export src obj
# Do not print "Entering directory ..."
MAKEFLAGS += --no-print-directory
CC := gcc
CFLAGS := -Os -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Werror-implicit-function-declaration \
-fno-strict-aliasing -fno-common \
-ffreestanding -fno-builtin
HOSTCC := gcc
HOSTCXX := g++
HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
-Wno-unused -Wno-sign-compare -Wno-pointer-sign
DOXYGEN := doxygen
DOXYGEN_OUTPUT_DIR := doxygen
# make is silent per default. make V=1 will show all compiler calls.
ifneq ($(V),1)
Q := @
endif
KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
export KERNELVERSION
ifeq ($(strip $(have_dotconfig)),)
all:
$(Q)echo "Please run make menuconfig, xconfig or config first."
else
include $(src)/.config
ifneq ($(CONFIG_LOCALVERSION),)
LINUXBIOS_EXTRA_VERSION := -$(shell echo $(CONFIG_LOCALVERSION))
endif
all: prepare prepare2 $(obj)/linuxbios.rom
$(Q)echo "Build process finished."
ARCH:=$(shell echo $(CONFIG_ARCH))
MAINBOARDDIR=$(shell echo $(CONFIG_MAINBOARD_NAME))
LINUXBIOSINCLUDE := -I$(src) -Iinclude \
-I$(src)/include \
-I$(src)/include/cpu/generic/$(ARCH)/ \
-include $(obj)/config.h \
-include $(obj)/build.h
ifneq ($(strip $(have_dotxcompile)),)
include $(src)/.xcompile
CC := $(CC_$(ARCH))
AS := $(AS_$(ARCH))
LD := $(LD_$(ARCH))
endif
CPPFLAGS := $(LINUXBIOSINCLUDE)
CFLAGS += $(LINUXBIOSINCLUDE)
include lib/Makefile
include device/Makefile
include console/Makefile
include mainboard/$(MAINBOARDDIR)/Makefile
include arch/$(ARCH)/Makefile
endif
include util/Makefile
doc:
$(DOXYGEN) util/Doxyfile.LinuxBIOS
prepare:
$(Q)mkdir -p $(obj)
prepare2:
$(Q)cp $(src)/.tmpconfig.h $(obj)/config.h
$(Q)echo "#define LINUXBIOS_VERSION \"$(KERNELVERSION)\"" > $(obj)/build.h
$(Q)echo "#define LINUXBIOS_EXTRA_VERSION \"$(LINUXBIOS_EXTRA_VERSION)\"" >> $(obj)/build.h
$(Q)echo "#define LINUXBIOS_BUILD \"`date`\"" >> $(obj)/build.h
clean:
$(Q)echo -n "Cleaning up... "
$(Q)rm -rf $(obj)
$(Q)rm -rf $(DOXYGEN_OUTPUT_DIR)
$(Q)echo "done"
distclean: clean
$(Q)echo -n "Deleting config files... "
$(Q)rm -f .kconfig.d .config .tmpconfig.h .config.old
$(Q)echo "done"
%.o: %.c
$(Q)echo "Compiling $<"
$(Q)$(CC) $(CFLAGS) -o $@ -c $<
.PHONY: doc