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 | 05560bf | 2014-07-19 10:55:30 +0200 | [diff] [blame] | 33 | # in addition to the dependency below, create the file if it doesn't exist |
| 34 | # to silence stupid warnings about a file that would be generated anyway. |
| 35 | $(if $(wildcard .xcompile),,$(eval $(shell util/xcompile/xcompile $(XGCCPATH) > .xcompile))) |
| 36 | |
Patrick Georgi | 18ff4f1 | 2014-07-10 21:06:04 +0200 | [diff] [blame] | 37 | .xcompile: util/xcompile/xcompile |
| 38 | A=`mktemp $@.XXXXXX`; $< $(XGCCPATH) > $$A && mv $$A $@ 2> /dev/null |
| 39 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 40 | include .xcompile |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 41 | |
Jonathan Kollasch | 7ff5b44 | 2010-09-28 21:11:48 +0000 | [diff] [blame] | 42 | export top := $(CURDIR) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 43 | export src := src |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 44 | export srck := $(top)/util/kconfig |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 45 | export obj ?= build |
Patrick Georgi | a2acbc7 | 2010-04-16 22:48:57 +0000 | [diff] [blame] | 46 | export objutil ?= $(obj)/util |
| 47 | export objk := $(objutil)/kconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 48 | |
| 49 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 50 | export KCONFIG_AUTOHEADER := $(obj)/config.h |
| 51 | export KCONFIG_AUTOCONFIG := $(obj)/auto.conf |
Patrick Georgi | d520840 | 2014-04-11 20:24:06 +0200 | [diff] [blame] | 52 | export KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd |
| 53 | export KCONFIG_SPLITCONFIG := $(obj)/config |
| 54 | export KCONFIG_TRISTATE := $(obj)/tristate.conf |
| 55 | export KCONFIG_NEGATIVES := 1 |
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 | |
Edward O'Callaghan | 16407ab | 2014-10-30 11:36:42 +1100 | [diff] [blame] | 77 | HOSTCC := gcc |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 78 | HOSTCXX = g++ |
Patrick Georgi | b3a18ac | 2012-09-13 22:13:33 +0200 | [diff] [blame] | 79 | HOSTCFLAGS := -g |
| 80 | HOSTCXXFLAGS := -g |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 81 | |
| 82 | DOXYGEN := doxygen |
| 83 | DOXYGEN_OUTPUT_DIR := doxygen |
| 84 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 85 | all: real-all |
| 86 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 87 | # This include must come _before_ the pattern rules below! |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 88 | # Order _does_ matter for pattern rules. |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 89 | include util/kconfig/Makefile |
| 90 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 91 | # Three cases where we don't need fully populated $(obj) lists: |
| 92 | # 1. when no .config exists |
| 93 | # 2. when make config (in any flavour) is run |
| 94 | # 3. when make distclean is run |
| 95 | # Don't waste time on reading all Makefile.incs in these cases |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 96 | ifeq ($(strip $(HAVE_DOTCONFIG)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 97 | NOCOMPILE:=1 |
| 98 | endif |
| 99 | ifneq ($(MAKECMDGOALS),) |
Patrick Georgi | c38f3ae | 2014-04-26 15:29:10 +0200 | [diff] [blame] | 100 | ifneq ($(filter %config %clean cross%,$(MAKECMDGOALS)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 101 | NOCOMPILE:=1 |
| 102 | endif |
Patrick Georgi | 02ae0bf | 2013-02-09 15:45:02 +0100 | [diff] [blame] | 103 | ifeq ($(MAKECMDGOALS), %clean) |
Zheng Bao | 0fd93d6 | 2012-10-22 16:36:03 +0800 | [diff] [blame] | 104 | NOMKDIR:=1 |
| 105 | endif |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 106 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 107 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 108 | ifeq ($(NOCOMPILE),1) |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 109 | include $(TOPLEVEL)/Makefile.inc |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 110 | real-all: config |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 111 | |
| 112 | else |
| 113 | |
Patrick Georgi | 977b985 | 2010-09-24 22:15:54 +0000 | [diff] [blame] | 114 | include $(HAVE_DOTCONFIG) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 115 | |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 116 | ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) |
Edward O'Callaghan | dd91c7f | 2014-06-28 03:02:52 +1000 | [diff] [blame] | 117 | # FIXME: armv7/aarch64 won't build right now |
| 118 | # NOTE: clang puts compiler-rt under lib/linux/libclang_rt.builtins-i386.a |
| 119 | # this means the triple is i386-linux-elf instead of i386-none-elf |
| 120 | CFLAGS_x86_32 = -no-integrated-as -Qunused-arguments -target i386-linux-elf -m32 |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 121 | CC_x86_32:=clang |
Edward O'Callaghan | 16407ab | 2014-10-30 11:36:42 +1100 | [diff] [blame] | 122 | HOSTCC := clang |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 123 | |
| 124 | ifneq ($(CONFIG_MMX),y) |
| 125 | CFLAGS_x86_32 += -mno-mmx |
| 126 | endif |
| 127 | |
| 128 | # FIXME: we end up with conflicting flags with this, not clear on this part. |
| 129 | #ifneq ($(CONFIG_SSE),y) |
| 130 | #CFLAGS_x86_32 += -mno-sse |
| 131 | #endif |
| 132 | |
Gabe Black | 51edd54 | 2013-09-30 23:00:33 -0700 | [diff] [blame] | 133 | CFLAGS_arm = -no-integrated-as -Qunused-arguments -target arm-eabi -ccc-gcc-name $(CC_arm) |
| 134 | CC_arm:=clang |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 135 | |
| 136 | CFLAGS_aarch64 = -no-integrated-as -Qunused-arguments -target aarch64-eabi -ccc-gcc-name $(CC_aarch64) |
| 137 | CC_aarch64:=clang |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 138 | endif |
Patrick Georgi | 23d89cc | 2010-03-16 01:17:19 +0000 | [diff] [blame] | 139 | |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 140 | include toolchain.inc |
| 141 | |
Patrick Georgi | a84e98b | 2010-03-16 19:01:32 +0000 | [diff] [blame] | 142 | strip_quotes = $(subst ",,$(subst \",,$(1))) |
| 143 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 144 | # The primary target needs to be here before we include the |
| 145 | # other files |
| 146 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 147 | real-all: real-target |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 148 | |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 149 | # must come rather early |
| 150 | .SECONDEXPANSION: |
| 151 | |
Stefan Reinauer | 1425add | 2010-03-21 22:35:58 +0000 | [diff] [blame] | 152 | $(obj)/config.h: |
| 153 | $(MAKE) oldconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 154 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 155 | # Add a new class of source/object files to the build system |
| 156 | add-class= \ |
| 157 | $(eval $(1)-srcs:=) \ |
| 158 | $(eval $(1)-objs:=) \ |
| 159 | $(eval classes+=$(1)) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 160 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 161 | # Special classes are managed types with special behaviour |
| 162 | # On parse time, for each entry in variable $(1)-y |
| 163 | # a handler $(1)-handler is executed with the arguments: |
| 164 | # * $(1): directory the parser is in |
| 165 | # * $(2): current entry |
| 166 | add-special-class= \ |
| 167 | $(eval $(1):=) \ |
| 168 | $(eval special-classes+=$(1)) |
| 169 | |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 170 | # Clean -y variables, include Makefile.inc |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 171 | # Add paths to files in X-y to X-srcs |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 172 | # Add subdirs-y to subdirs |
| 173 | includemakefiles= \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 174 | $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \ |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 175 | $(eval -include $(1)) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 176 | $(foreach class,$(classes-y), $(call add-class,$(class))) \ |
| 177 | $(foreach class,$(classes), \ |
| 178 | $(eval $(class)-srcs+= \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 179 | $$(subst $(top)/,, \ |
Patrick Georgi | 29ddbb8 | 2011-05-20 23:31:41 +0000 | [diff] [blame] | 180 | $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y))))))) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 181 | $(foreach special,$(special-classes), \ |
| 182 | $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \ |
Jonathan Kollasch | 7ff5b44 | 2010-09-28 21:11:48 +0000 | [diff] [blame] | 183 | $(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y))))) |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 184 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 185 | # For each path in $(subdirs) call includemakefiles |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 186 | # Repeat until subdirs is empty |
| 187 | evaluate_subdirs= \ |
| 188 | $(eval cursubdirs:=$(subdirs)) \ |
| 189 | $(eval subdirs:=) \ |
| 190 | $(foreach dir,$(cursubdirs), \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 191 | $(eval $(call includemakefiles,$(dir)/Makefile.inc))) \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 192 | $(if $(subdirs),$(eval $(call evaluate_subdirs))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 193 | |
| 194 | # collect all object files eligible for building |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 195 | subdirs:=$(TOPLEVEL) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 196 | $(eval $(call evaluate_subdirs)) |
Patrick Georgi | 70c85ea | 2013-02-16 01:06:57 +0100 | [diff] [blame] | 197 | ifeq ($(FAILBUILD),1) |
| 198 | $(error cannot continue build) |
| 199 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 200 | |
Patrick Georgi | 94a4586 | 2011-10-25 14:32:21 -0700 | [diff] [blame] | 201 | # Eliminate duplicate mentions of source files in a class |
| 202 | $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) |
| 203 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 204 | src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs)))) |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 205 | $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class)))) |
Patrick Georgi | d3428b0 | 2010-02-24 13:18:01 +0000 | [diff] [blame] | 206 | |
Nico Huber | 963bed5 | 2013-05-15 11:47:51 +0200 | [diff] [blame] | 207 | # Save all objs before processing them (for dependency inclusion) |
| 208 | originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
| 209 | |
Patrick Georgi | 79f9010 | 2012-11-25 14:31:08 +0100 | [diff] [blame] | 210 | # Call post-processors if they're defined |
| 211 | $(foreach class,$(classes),\ |
| 212 | $(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs))))) |
| 213 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 214 | allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var))) |
| 215 | allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 216 | alldirs:=$(sort $(abspath $(dir $(allobjs)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 217 | |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 218 | # macro to define template macros that are used by use_template macro |
| 219 | define create_cc_template |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 220 | # $1 obj class |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 221 | # $2 source suffix (c, S) |
Patrick Georgi | 25b56c3 | 2014-05-25 00:11:35 +0200 | [diff] [blame] | 222 | # $3 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 | 25b56c3 | 2014-05-25 00:11:35 +0200 | [diff] [blame] | 225 | $(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(3) |
Patrick Georgi | 1cd76e7 | 2010-04-19 20:39:22 +0000 | [diff] [blame] | 226 | @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
Patrick Georgi | 25b56c3 | 2014-05-25 00:11:35 +0200 | [diff] [blame] | 227 | $(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -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 | 25b56c3 | 2014-05-25 00:11:35 +0200 | [diff] [blame] | 235 | $(eval $(call create_cc_template,$(class),$(type),$($(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 | |
Nico Huber | 963bed5 | 2013-05-15 11:47:51 +0200 | [diff] [blame] | 240 | DEPENDENCIES = $(originalobjs:.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) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 248 | @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME_$(class)) |
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 | d520840 | 2014-04-11 20:24:06 +0200 | [diff] [blame] | 254 | $(shell mkdir -p $(KCONFIG_SPLITCONFIG) $(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 |
Patrick Georgi | 02ae0bf | 2013-02-09 15:45:02 +0100 | [diff] [blame] | 269 | rm -rf $(obj) .xcompile |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 270 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 271 | clean: clean-for-update clean-target |
| 272 | rm -f .ccwrap |
Warren Turkal | 0e8f204 | 2010-09-27 21:14:19 +0000 | [diff] [blame] | 273 | |
Warren Turkal | a9fc330 | 2010-09-03 08:57:32 +0000 | [diff] [blame] | 274 | clean-cscope: |
| 275 | rm -f cscope.out |
| 276 | |
Patrick Georgi | 02ae0bf | 2013-02-09 15:45:02 +0100 | [diff] [blame] | 277 | distclean: clean |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 278 | rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 279 | |
Patrick Georgi | 18ff4f1 | 2014-07-10 21:06:04 +0200 | [diff] [blame] | 280 | .PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean doxygen doxy |