X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=Makefile;h=2723efbbebfd404eb5bb004768aa43fa8de5c582;hb=refs%2Fheads%2FWIP;hp=05b54e298e67d4edca5f7f7b4ee0131b1cebcd76;hpb=71b8480921731c20521b80acae2db9d622acfa05;p=coreboot.git diff --git a/Makefile b/Makefile index 05b54e298..2723efbbe 100644 --- a/Makefile +++ b/Makefile @@ -6,25 +6,35 @@ ## Copyright (C) 2009-2010 coresystems GmbH ## Copyright (C) 2011 secunet Security Networks AG ## -## 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. +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## 1. Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## 2. Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## 3. The name of the author may not be used to endorse or promote products +## derived from this software without specific prior written permission. ## -## 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 +## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. ## ifeq ($(INNER_SCANBUILD),y) CC_real:=$(CC) endif -$(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile > .xcompile))) +$(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile $(XGCCPATH) > .xcompile))) include .xcompile ifeq ($(INNER_SCANBUILD),y) @@ -44,6 +54,9 @@ export objk := $(objutil)/kconfig export KCONFIG_AUTOHEADER := $(obj)/config.h export KCONFIG_AUTOCONFIG := $(obj)/auto.conf +# directory containing the toplevel Makefile.inc +TOPLEVEL := . + CONFIG_SHELL := sh KBUILD_DEFCONFIG := configs/defconfig UNAME_RELEASE := $(shell uname -r) @@ -61,7 +74,6 @@ ifneq ($(Q),) endif endif -CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E HOSTCC = gcc HOSTCXX = g++ HOSTCFLAGS := -I$(srck) -I$(objk) -g @@ -73,9 +85,8 @@ DOXYGEN_OUTPUT_DIR := doxygen all: real-all -# This include must come _before_ he pattern rules below! +# This include must come _before_ the pattern rules below! # Order _does_ matter for pattern rules. -include Makefile.inc include util/kconfig/Makefile # Three cases where we don't need fully populated $(obj) lists: @@ -93,6 +104,7 @@ endif endif ifeq ($(NOCOMPILE),1) +include $(TOPLEVEL)/Makefile.inc real-all: config else @@ -101,13 +113,13 @@ include $(HAVE_DOTCONFIG) ifneq ($(INNER_SCANBUILD),y) ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) -CC:=clang -m32 +CC:=clang -m32 -mno-mmx -mno-sse HOSTCC:=clang endif endif ifeq ($(CONFIG_CCACHE),y) -CCACHE:=$(wildcard $(addsuffix /ccache,$(subst :, ,$(PATH)))) +CCACHE:=$(word 1,$(wildcard $(addsuffix /ccache,$(subst :, ,$(PATH))))) ifeq ($(CCACHE),) $(error ccache selected, but not found in PATH) endif @@ -174,7 +186,7 @@ includemakefiles= \ $(foreach class,$(classes), \ $(eval $(class)-srcs+= \ $$(subst $(top)/,, \ - $$(abspath $$(addprefix $(dir $(1)),$$($(class)-y)))))) \ + $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y))))))) \ $(foreach special,$(special-classes), \ $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \ $(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y))))) @@ -189,9 +201,12 @@ evaluate_subdirs= \ $(if $(subdirs),$(eval $(call evaluate_subdirs))) # collect all object files eligible for building -subdirs:=. +subdirs:=$(TOPLEVEL) $(eval $(call evaluate_subdirs)) +# Eliminate duplicate mentions of source files in a class +$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) + src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs)))) $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class)))) @@ -204,9 +219,10 @@ define create_cc_template # $1 obj class # $2 source suffix (c, S) # $3 additional compiler flags +# $4 additional dependencies ifn$(EMPTY)def $(1)-objs_$(2)_template de$(EMPTY)fine $(1)-objs_$(2)_template -$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h +$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4) @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" $(CC) $(3) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$< en$(EMPTY)def @@ -216,7 +232,7 @@ endef filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs)))) $(foreach class,$(classes), \ $(foreach type,$(call filetypes-of-class,$(class)), \ - $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts))))) + $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps))))) foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file)))))) $(eval $(foreach class,$(classes),$(call foreach-src,$(class)))) @@ -234,7 +250,9 @@ printall: endif +ifndef NOMKDIR $(shell mkdir -p $(obj) $(objutil)/kconfig/lxdialog $(additional-dirs) $(alldirs)) +endif cscope: cscope -bR @@ -258,7 +276,7 @@ clean: clean-for-update clean-target clean-cscope: rm -f cscope.out -distclean: clean-cscope +distclean: rm -rf $(obj) rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile