Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 1 | ## |
| 2 | ## This file is part of the coreboot project. |
| 3 | ## |
| 4 | ## Copyright (C) 2008 Advanced Micro Devices, Inc. |
| 5 | ## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de> |
Stefan Reinauer | 8ed1b6d | 2010-01-19 21:13:44 +0000 | [diff] [blame] | 6 | ## Copyright (C) 2009-2010 coresystems GmbH |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 7 | ## Copyright (C) 2011 secunet Security Networks AG |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 8 | ## |
Patrick Georgi | 3bda044 | 2011-06-30 15:48:57 +0200 | [diff] [blame] | 9 | ## Redistribution and use in source and binary forms, with or without |
| 10 | ## modification, are permitted provided that the following conditions |
| 11 | ## are met: |
| 12 | ## 1. Redistributions of source code must retain the above copyright |
| 13 | ## notice, this list of conditions and the following disclaimer. |
| 14 | ## 2. Redistributions in binary form must reproduce the above copyright |
| 15 | ## notice, this list of conditions and the following disclaimer in the |
| 16 | ## documentation and/or other materials provided with the distribution. |
| 17 | ## 3. The name of the author may not be used to endorse or promote products |
| 18 | ## derived from this software without specific prior written permission. |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 19 | ## |
Patrick Georgi | 3bda044 | 2011-06-30 15:48:57 +0200 | [diff] [blame] | 20 | ## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 21 | ## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | ## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 24 | ## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | ## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 26 | ## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 | ## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | ## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | ## SUCH DAMAGE. |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 31 | ## |
| 32 | |
Patrick Georgi | 020f51f | 2010-03-14 21:25:03 +0000 | [diff] [blame] | 33 | ifeq ($(INNER_SCANBUILD),y) |
| 34 | CC_real:=$(CC) |
| 35 | endif |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 36 | |
Marc Jones | 616da1e | 2011-10-07 17:20:30 -0600 | [diff] [blame] | 37 | $(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile $(XGCCPATH) > .xcompile))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 38 | include .xcompile |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 39 | |
Patrick Georgi | 020f51f | 2010-03-14 21:25:03 +0000 | [diff] [blame] | 40 | ifeq ($(INNER_SCANBUILD),y) |
| 41 | CC:=$(CC_real) |
| 42 | HOSTCC:=$(CC_real) --hostcc |
| 43 | HOSTCXX:=$(CC_real) --hostcxx |
| 44 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 45 | |
Jonathan Kollasch | 7ff5b44 | 2010-09-28 21:11:48 +0000 | [diff] [blame] | 46 | export top := $(CURDIR) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 47 | export src := src |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 48 | export srck := $(top)/util/kconfig |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 49 | export obj ?= build |
Patrick Georgi | a2acbc7 | 2010-04-16 22:48:57 +0000 | [diff] [blame] | 50 | export objutil ?= $(obj)/util |
| 51 | export objk := $(objutil)/kconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 52 | |
| 53 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 54 | export KCONFIG_AUTOHEADER := $(obj)/config.h |
| 55 | export KCONFIG_AUTOCONFIG := $(obj)/auto.conf |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 56 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 57 | # directory containing the toplevel Makefile.inc |
| 58 | TOPLEVEL := . |
| 59 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 60 | CONFIG_SHELL := sh |
| 61 | KBUILD_DEFCONFIG := configs/defconfig |
| 62 | UNAME_RELEASE := $(shell uname -r) |
Patrick Georgi | 89ec376 | 2010-12-08 19:58:30 +0000 | [diff] [blame] | 63 | DOTCONFIG ?= .config |
| 64 | KCONFIG_CONFIG = $(DOTCONFIG) |
| 65 | export KCONFIG_CONFIG |
| 66 | HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 67 | MAKEFLAGS += -rR --no-print-directory |
| 68 | |
| 69 | # Make is silent per default, but 'make V=1' will show all compiler calls. |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 70 | Q:=@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 71 | ifneq ($(V),1) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 72 | ifneq ($(Q),) |
| 73 | .SILENT: |
| 74 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 75 | endif |
| 76 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 77 | HOSTCC = gcc |
| 78 | HOSTCXX = g++ |
Patrick Georgi | b3a18ac | 2012-09-13 22:13:33 +0200 | [diff] [blame] | 79 | HOSTCFLAGS := -g |
| 80 | HOSTCXXFLAGS := -g |
Stefan Reinauer | 68a564f | 2010-03-16 01:02:18 +0000 | [diff] [blame] | 81 | LIBGCC_FILE_NAME := $(shell test -r `$(CC) -print-libgcc-file-name` && $(CC) -print-libgcc-file-name) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 82 | |
| 83 | DOXYGEN := doxygen |
| 84 | DOXYGEN_OUTPUT_DIR := doxygen |
| 85 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 86 | all: real-all |
| 87 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 88 | # This include must come _before_ the pattern rules below! |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 89 | # Order _does_ matter for pattern rules. |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 90 | include util/kconfig/Makefile |
| 91 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 92 | # Three cases where we don't need fully populated $(obj) lists: |
| 93 | # 1. when no .config exists |
| 94 | # 2. when make config (in any flavour) is run |
| 95 | # 3. when make distclean is run |
| 96 | # Don't waste time on reading all Makefile.incs in these cases |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 97 | ifeq ($(strip $(HAVE_DOTCONFIG)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 98 | NOCOMPILE:=1 |
| 99 | endif |
| 100 | ifneq ($(MAKECMDGOALS),) |
| 101 | ifneq ($(filter %config distclean,$(MAKECMDGOALS)),) |
| 102 | NOCOMPILE:=1 |
| 103 | endif |
| 104 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 105 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 106 | ifeq ($(NOCOMPILE),1) |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 107 | include $(TOPLEVEL)/Makefile.inc |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 108 | real-all: config |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 109 | |
| 110 | else |
| 111 | |
Patrick Georgi | 977b985 | 2010-09-24 22:15:54 +0000 | [diff] [blame] | 112 | include $(HAVE_DOTCONFIG) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 113 | |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 114 | ifneq ($(INNER_SCANBUILD),y) |
| 115 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Patrick Georgi | fe9210f | 2012-03-11 20:44:22 +0100 | [diff] [blame] | 116 | CC:=clang -m32 -mno-mmx -mno-sse |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 117 | HOSTCC:=clang |
| 118 | endif |
| 119 | endif |
| 120 | |
Patrick Georgi | 516a2a7 | 2010-03-25 21:45:25 +0000 | [diff] [blame] | 121 | ifeq ($(CONFIG_CCACHE),y) |
Patrick Georgi | 96dafaf | 2011-05-20 22:14:07 +0000 | [diff] [blame] | 122 | CCACHE:=$(word 1,$(wildcard $(addsuffix /ccache,$(subst :, ,$(PATH))))) |
Patrick Georgi | 516a2a7 | 2010-03-25 21:45:25 +0000 | [diff] [blame] | 123 | ifeq ($(CCACHE),) |
| 124 | $(error ccache selected, but not found in PATH) |
| 125 | endif |
Patrick Georgi | 977b985 | 2010-09-24 22:15:54 +0000 | [diff] [blame] | 126 | CCACHE:=CCACHE_COMPILERCHECK=content CCACHE_BASEDIR=$(top) $(CCACHE) |
Patrick Georgi | 516a2a7 | 2010-03-25 21:45:25 +0000 | [diff] [blame] | 127 | CC := $(CCACHE) $(CC) |
| 128 | HOSTCC := $(CCACHE) $(HOSTCC) |
| 129 | HOSTCXX := $(CCACHE) $(HOSTCXX) |
| 130 | ROMCC := $(CCACHE) $(ROMCC) |
| 131 | endif |
| 132 | |
Patrick Georgi | a84e98b | 2010-03-16 19:01:32 +0000 | [diff] [blame] | 133 | strip_quotes = $(subst ",,$(subst \",,$(1))) |
| 134 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 135 | # The primary target needs to be here before we include the |
| 136 | # other files |
| 137 | |
Patrick Georgi | 020f51f | 2010-03-14 21:25:03 +0000 | [diff] [blame] | 138 | ifeq ($(INNER_SCANBUILD),y) |
| 139 | CONFIG_SCANBUILD_ENABLE:= |
| 140 | endif |
| 141 | |
| 142 | ifeq ($(CONFIG_SCANBUILD_ENABLE),y) |
| 143 | ifneq ($(CONFIG_SCANBUILD_REPORT_LOCATION),) |
| 144 | CONFIG_SCANBUILD_REPORT_LOCATION:=-o $(CONFIG_SCANBUILD_REPORT_LOCATION) |
| 145 | endif |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 146 | real-all: |
Patrick Georgi | 020f51f | 2010-03-14 21:25:03 +0000 | [diff] [blame] | 147 | echo '#!/bin/sh' > .ccwrap |
| 148 | echo 'CC="$(CC)"' >> .ccwrap |
| 149 | echo 'if [ "$$1" = "--hostcc" ]; then shift; CC="$(HOSTCC)"; fi' >> .ccwrap |
| 150 | echo 'if [ "$$1" = "--hostcxx" ]; then shift; CC="$(HOSTCXX)"; fi' >> .ccwrap |
| 151 | echo 'eval $$CC $$*' >> .ccwrap |
| 152 | chmod +x .ccwrap |
| 153 | scan-build $(CONFIG_SCANBUILD_REPORT_LOCATION) -analyze-headers --use-cc=$(top)/.ccwrap --use-c++=$(top)/.ccwrap $(MAKE) INNER_SCANBUILD=y |
| 154 | else |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 155 | real-all: real-target |
Patrick Georgi | 020f51f | 2010-03-14 21:25:03 +0000 | [diff] [blame] | 156 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 157 | |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 158 | # must come rather early |
| 159 | .SECONDEXPANSION: |
| 160 | |
Stefan Reinauer | 1425add | 2010-03-21 22:35:58 +0000 | [diff] [blame] | 161 | $(obj)/config.h: |
| 162 | $(MAKE) oldconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 163 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 164 | # Add a new class of source/object files to the build system |
| 165 | add-class= \ |
| 166 | $(eval $(1)-srcs:=) \ |
| 167 | $(eval $(1)-objs:=) \ |
| 168 | $(eval classes+=$(1)) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 169 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 170 | # Special classes are managed types with special behaviour |
| 171 | # On parse time, for each entry in variable $(1)-y |
| 172 | # a handler $(1)-handler is executed with the arguments: |
| 173 | # * $(1): directory the parser is in |
| 174 | # * $(2): current entry |
| 175 | add-special-class= \ |
| 176 | $(eval $(1):=) \ |
| 177 | $(eval special-classes+=$(1)) |
| 178 | |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 179 | # Clean -y variables, include Makefile.inc |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 180 | # Add paths to files in X-y to X-srcs |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 181 | # Add subdirs-y to subdirs |
| 182 | includemakefiles= \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 183 | $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \ |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 184 | $(eval -include $(1)) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 185 | $(foreach class,$(classes-y), $(call add-class,$(class))) \ |
| 186 | $(foreach class,$(classes), \ |
| 187 | $(eval $(class)-srcs+= \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 188 | $$(subst $(top)/,, \ |
Patrick Georgi | 29ddbb8 | 2011-05-20 23:31:41 +0000 | [diff] [blame] | 189 | $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y))))))) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 190 | $(foreach special,$(special-classes), \ |
| 191 | $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \ |
Jonathan Kollasch | 7ff5b44 | 2010-09-28 21:11:48 +0000 | [diff] [blame] | 192 | $(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y))))) |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 193 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 194 | # For each path in $(subdirs) call includemakefiles |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 195 | # Repeat until subdirs is empty |
| 196 | evaluate_subdirs= \ |
| 197 | $(eval cursubdirs:=$(subdirs)) \ |
| 198 | $(eval subdirs:=) \ |
| 199 | $(foreach dir,$(cursubdirs), \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 200 | $(eval $(call includemakefiles,$(dir)/Makefile.inc))) \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 201 | $(if $(subdirs),$(eval $(call evaluate_subdirs))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 202 | |
| 203 | # collect all object files eligible for building |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 204 | subdirs:=$(TOPLEVEL) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 205 | $(eval $(call evaluate_subdirs)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 206 | |
Patrick Georgi | 94a4586 | 2011-10-25 14:32:21 -0700 | [diff] [blame] | 207 | # Eliminate duplicate mentions of source files in a class |
| 208 | $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) |
| 209 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 210 | src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs)))) |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 211 | $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class)))) |
Patrick Georgi | d3428b0 | 2010-02-24 13:18:01 +0000 | [diff] [blame] | 212 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 213 | allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var))) |
| 214 | allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 215 | alldirs:=$(sort $(abspath $(dir $(allobjs)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 216 | |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 217 | # macro to define template macros that are used by use_template macro |
| 218 | define create_cc_template |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 219 | # $1 obj class |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 220 | # $2 source suffix (c, S) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 221 | # $3 additional compiler flags |
Patrick Georgi | 57205c7 | 2011-03-08 20:49:18 +0000 | [diff] [blame] | 222 | # $4 additional dependencies |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 223 | ifn$(EMPTY)def $(1)-objs_$(2)_template |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 224 | de$(EMPTY)fine $(1)-objs_$(2)_template |
Patrick Georgi | 57205c7 | 2011-03-08 20:49:18 +0000 | [diff] [blame] | 225 | $(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4) |
Patrick Georgi | 1cd76e7 | 2010-04-19 20:39:22 +0000 | [diff] [blame] | 226 | @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 227 | $(CC) $(3) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$< |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 228 | en$(EMPTY)def |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 229 | end$(EMPTY)if |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 230 | endef |
| 231 | |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 232 | filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs)))) |
| 233 | $(foreach class,$(classes), \ |
| 234 | $(foreach type,$(call filetypes-of-class,$(class)), \ |
Patrick Georgi | 57205c7 | 2011-03-08 20:49:18 +0000 | [diff] [blame] | 235 | $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps))))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 236 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 237 | foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file)))))) |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 238 | $(eval $(foreach class,$(classes),$(call foreach-src,$(class)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 239 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 240 | DEPENDENCIES = $(allobjs:.o=.d) |
Stefan Reinauer | 6bee951 | 2010-03-24 15:51:48 +0000 | [diff] [blame] | 241 | -include $(DEPENDENCIES) |
| 242 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 243 | printall: |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 244 | @$(foreach class,$(classes),echo $(class)-objs:=$($(class)-objs); ) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 245 | @echo alldirs:=$(alldirs) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 246 | @echo allsrcs=$(allsrcs) |
Stefan Reinauer | 6bee951 | 2010-03-24 15:51:48 +0000 | [diff] [blame] | 247 | @echo DEPENDENCIES=$(DEPENDENCIES) |
Stefan Reinauer | 68a564f | 2010-03-16 01:02:18 +0000 | [diff] [blame] | 248 | @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 249 | @$(foreach class,$(special-classes),echo $(class):='$($(class))'; ) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 250 | |
| 251 | endif |
| 252 | |
Patrick Georgi | 40ad842 | 2011-05-21 22:18:59 +0000 | [diff] [blame] | 253 | ifndef NOMKDIR |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 254 | $(shell mkdir -p $(obj) $(objutil)/kconfig/lxdialog $(additional-dirs) $(alldirs)) |
Patrick Georgi | 40ad842 | 2011-05-21 22:18:59 +0000 | [diff] [blame] | 255 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 256 | |
Warren Turkal | a9fc330 | 2010-09-03 08:57:32 +0000 | [diff] [blame] | 257 | cscope: |
| 258 | cscope -bR |
| 259 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 260 | doxy: doxygen |
| 261 | doxygen: |
Stefan Reinauer | 1bbad5c | 2010-02-10 15:36:53 +0000 | [diff] [blame] | 262 | $(DOXYGEN) documentation/Doxyfile.coreboot |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 263 | |
| 264 | doxyclean: doxygen-clean |
| 265 | doxygen-clean: |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 266 | rm -rf $(DOXYGEN_OUTPUT_DIR) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 267 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 268 | clean-for-update: doxygen-clean clean-for-update-target |
| 269 | rm -f $(allobjs) .xcompile |
Stefan Reinauer | 6bee951 | 2010-03-24 15:51:48 +0000 | [diff] [blame] | 270 | rm -f $(DEPENDENCIES) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 271 | rmdir -p $(alldirs) 2>/dev/null >/dev/null || true |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 272 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 273 | clean: clean-for-update clean-target |
| 274 | rm -f .ccwrap |
Warren Turkal | 0e8f204 | 2010-09-27 21:14:19 +0000 | [diff] [blame] | 275 | |
Warren Turkal | a9fc330 | 2010-09-03 08:57:32 +0000 | [diff] [blame] | 276 | clean-cscope: |
| 277 | rm -f cscope.out |
| 278 | |
zbao | d086d51 | 2012-03-23 10:26:28 +0800 | [diff] [blame] | 279 | distclean: |
Myles Watson | 1af297c | 2010-01-06 16:59:18 +0000 | [diff] [blame] | 280 | rm -rf $(obj) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 281 | rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 282 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 283 | .PHONY: $(PHONY) clean clean-cscope cscope distclean doxygen doxy .xcompile |