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 |
Vadim Bendebury | e469602 | 2015-04-25 11:34:35 -0700 | [diff] [blame] | 38 | $< $(XGCCPATH) > $@.tmp |
| 39 | \mv -f $@.tmp $@ 2> /dev/null |
Patrick Georgi | 18ff4f1 | 2014-07-10 21:06:04 +0200 | [diff] [blame] | 40 | |
Jonathan Kollasch | 7ff5b44 | 2010-09-28 21:11:48 +0000 | [diff] [blame] | 41 | export top := $(CURDIR) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 42 | export src := src |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 43 | export srck := $(top)/util/kconfig |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 44 | obj ?= build |
| 45 | override obj := $(subst $(top)/,,$(abspath $(obj))) |
| 46 | export obj |
Patrick Georgi | a2acbc7 | 2010-04-16 22:48:57 +0000 | [diff] [blame] | 47 | export objutil ?= $(obj)/util |
| 48 | export objk := $(objutil)/kconfig |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 49 | absobj := $(abspath $(obj)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 50 | |
| 51 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 52 | export KCONFIG_AUTOHEADER := $(obj)/config.h |
| 53 | export KCONFIG_AUTOCONFIG := $(obj)/auto.conf |
Patrick Georgi | d520840 | 2014-04-11 20:24:06 +0200 | [diff] [blame] | 54 | export KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd |
| 55 | export KCONFIG_SPLITCONFIG := $(obj)/config |
| 56 | export KCONFIG_TRISTATE := $(obj)/tristate.conf |
| 57 | export KCONFIG_NEGATIVES := 1 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 58 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 59 | # directory containing the toplevel Makefile.inc |
| 60 | TOPLEVEL := . |
| 61 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 62 | CONFIG_SHELL := sh |
| 63 | KBUILD_DEFCONFIG := configs/defconfig |
| 64 | UNAME_RELEASE := $(shell uname -r) |
Patrick Georgi | 89ec376 | 2010-12-08 19:58:30 +0000 | [diff] [blame] | 65 | DOTCONFIG ?= .config |
| 66 | KCONFIG_CONFIG = $(DOTCONFIG) |
| 67 | export KCONFIG_CONFIG |
| 68 | HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 69 | MAKEFLAGS += -rR --no-print-directory |
| 70 | |
| 71 | # 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] | 72 | Q:=@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 73 | ifneq ($(V),1) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 74 | ifneq ($(Q),) |
| 75 | .SILENT: |
| 76 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 77 | endif |
| 78 | |
Julius Werner | 808a429 | 2015-03-13 11:05:07 -0700 | [diff] [blame] | 79 | # Disable implicit/built-in rules to make Makefile errors fail fast. |
| 80 | .SUFFIXES: |
| 81 | |
Edward O'Callaghan | 16407ab | 2014-10-30 11:36:42 +1100 | [diff] [blame] | 82 | HOSTCC := gcc |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 83 | HOSTCXX = g++ |
Patrick Georgi | b3a18ac | 2012-09-13 22:13:33 +0200 | [diff] [blame] | 84 | HOSTCFLAGS := -g |
| 85 | HOSTCXXFLAGS := -g |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 86 | |
Patrick Georgi | 828e0e8 | 2015-04-04 15:50:20 +0200 | [diff] [blame] | 87 | PREPROCESS_ONLY := -E -P -x assembler-with-cpp -undef -I . |
| 88 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 89 | DOXYGEN := doxygen |
| 90 | DOXYGEN_OUTPUT_DIR := doxygen |
| 91 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 92 | all: real-all |
| 93 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 94 | # This include must come _before_ the pattern rules below! |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 95 | # Order _does_ matter for pattern rules. |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 96 | include util/kconfig/Makefile |
| 97 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 98 | # Three cases where we don't need fully populated $(obj) lists: |
| 99 | # 1. when no .config exists |
| 100 | # 2. when make config (in any flavour) is run |
| 101 | # 3. when make distclean is run |
| 102 | # Don't waste time on reading all Makefile.incs in these cases |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 103 | ifeq ($(strip $(HAVE_DOTCONFIG)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 104 | NOCOMPILE:=1 |
| 105 | endif |
| 106 | ifneq ($(MAKECMDGOALS),) |
Patrick Georgi | 7711c0d | 2015-02-17 12:21:32 +0100 | [diff] [blame] | 107 | ifneq ($(filter %config %clean cross% lint% what-jenkins-does,$(MAKECMDGOALS)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 108 | NOCOMPILE:=1 |
| 109 | endif |
Patrick Georgi | 02ae0bf | 2013-02-09 15:45:02 +0100 | [diff] [blame] | 110 | ifeq ($(MAKECMDGOALS), %clean) |
Zheng Bao | 0fd93d6 | 2012-10-22 16:36:03 +0800 | [diff] [blame] | 111 | NOMKDIR:=1 |
| 112 | endif |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 113 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 114 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 115 | ifeq ($(NOCOMPILE),1) |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 116 | include $(TOPLEVEL)/Makefile.inc |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 117 | real-all: config |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 118 | |
| 119 | else |
| 120 | |
Patrick Georgi | 977b985 | 2010-09-24 22:15:54 +0000 | [diff] [blame] | 121 | include $(HAVE_DOTCONFIG) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 122 | |
Patrick Georgi | 7b9762f | 2015-06-04 13:18:11 +0200 | [diff] [blame] | 123 | include .xcompile |
| 124 | |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 125 | ifneq ($(CONFIG_MMX),y) |
| 126 | CFLAGS_x86_32 += -mno-mmx |
| 127 | endif |
| 128 | |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 129 | include toolchain.inc |
| 130 | |
Patrick Georgi | a84e98b | 2010-03-16 19:01:32 +0000 | [diff] [blame] | 131 | strip_quotes = $(subst ",,$(subst \",,$(1))) |
| 132 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 133 | # The primary target needs to be here before we include the |
| 134 | # other files |
| 135 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 136 | real-all: real-target |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 137 | |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 138 | # must come rather early |
| 139 | .SECONDEXPANSION: |
| 140 | |
Stefan Reinauer | 1425add | 2010-03-21 22:35:58 +0000 | [diff] [blame] | 141 | $(obj)/config.h: |
| 142 | $(MAKE) oldconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 143 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 144 | # Add a new class of source/object files to the build system |
| 145 | add-class= \ |
| 146 | $(eval $(1)-srcs:=) \ |
| 147 | $(eval $(1)-objs:=) \ |
| 148 | $(eval classes+=$(1)) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 149 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 150 | # Special classes are managed types with special behaviour |
| 151 | # On parse time, for each entry in variable $(1)-y |
| 152 | # a handler $(1)-handler is executed with the arguments: |
| 153 | # * $(1): directory the parser is in |
| 154 | # * $(2): current entry |
| 155 | add-special-class= \ |
| 156 | $(eval $(1):=) \ |
| 157 | $(eval special-classes+=$(1)) |
| 158 | |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 159 | # Clean -y variables, include Makefile.inc |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 160 | # Add paths to files in X-y to X-srcs |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 161 | # Add subdirs-y to subdirs |
| 162 | includemakefiles= \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 163 | $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \ |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 164 | $(eval -include $(1)) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 165 | $(foreach class,$(classes-y), $(call add-class,$(class))) \ |
| 166 | $(foreach class,$(classes), \ |
| 167 | $(eval $(class)-srcs+= \ |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 168 | $$(subst $(absobj)/,$(obj)/, \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 169 | $$(subst $(top)/,, \ |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 170 | $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 171 | $(foreach special,$(special-classes), \ |
| 172 | $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \ |
Jonathan Kollasch | 7ff5b44 | 2010-09-28 21:11:48 +0000 | [diff] [blame] | 173 | $(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y))))) |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 174 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 175 | # For each path in $(subdirs) call includemakefiles |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 176 | # Repeat until subdirs is empty |
| 177 | evaluate_subdirs= \ |
| 178 | $(eval cursubdirs:=$(subdirs)) \ |
| 179 | $(eval subdirs:=) \ |
| 180 | $(foreach dir,$(cursubdirs), \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 181 | $(eval $(call includemakefiles,$(dir)/Makefile.inc))) \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 182 | $(if $(subdirs),$(eval $(call evaluate_subdirs))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 183 | |
| 184 | # collect all object files eligible for building |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 185 | subdirs:=$(TOPLEVEL) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 186 | $(eval $(call evaluate_subdirs)) |
Patrick Georgi | 70c85ea | 2013-02-16 01:06:57 +0100 | [diff] [blame] | 187 | ifeq ($(FAILBUILD),1) |
| 188 | $(error cannot continue build) |
| 189 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 190 | |
Patrick Georgi | 94a4586 | 2011-10-25 14:32:21 -0700 | [diff] [blame] | 191 | # Eliminate duplicate mentions of source files in a class |
| 192 | $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) |
| 193 | |
Patrick Georgi | db27306 | 2015-03-27 17:03:28 +0100 | [diff] [blame] | 194 | # Converts one or more source file paths to their corresponding build/ paths. |
| 195 | # Only .c and .S get converted to .o, other files (like .ld) keep their name. |
| 196 | # $1 stage name |
| 197 | # $2 file path (list) |
Julius Werner | a32b6f0 | 2015-03-12 23:17:16 -0700 | [diff] [blame] | 198 | src-to-obj=$(foreach file,$(2),$(subst .$(1),,$(basename $(patsubst src/%,$(obj)/%,$(file)))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file))))) |
Patrick Georgi | db27306 | 2015-03-27 17:03:28 +0100 | [diff] [blame] | 199 | |
Patrick Georgi | 10f86b0 | 2015-03-27 16:56:23 +0100 | [diff] [blame] | 200 | $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs)))) |
Patrick Georgi | d3428b0 | 2010-02-24 13:18:01 +0000 | [diff] [blame] | 201 | |
Nico Huber | 963bed5 | 2013-05-15 11:47:51 +0200 | [diff] [blame] | 202 | # Save all objs before processing them (for dependency inclusion) |
| 203 | originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
| 204 | |
Patrick Georgi | 79f9010 | 2012-11-25 14:31:08 +0100 | [diff] [blame] | 205 | # Call post-processors if they're defined |
| 206 | $(foreach class,$(classes),\ |
| 207 | $(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs))))) |
| 208 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 209 | allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var))) |
| 210 | allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 211 | alldirs:=$(sort $(abspath $(dir $(allobjs)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 212 | |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 213 | # macro to define template macros that are used by use_template macro |
| 214 | define create_cc_template |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 215 | # $1 obj class |
Patrick Georgi | 990e7c9 | 2015-04-03 10:47:15 +0200 | [diff] [blame] | 216 | # $2 source suffix (c, S, ld, ...) |
Marc Jones | a38ccfd | 2014-11-06 15:50:22 -0700 | [diff] [blame] | 217 | # $3 additional compiler flags |
| 218 | # $4 additional dependencies |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 219 | ifn$(EMPTY)def $(1)-objs_$(2)_template |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 220 | de$(EMPTY)fine $(1)-objs_$(2)_template |
Patrick Georgi | d69839b | 2015-04-03 10:32:17 +0200 | [diff] [blame] | 221 | $$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $(obj)/config.h $(4) |
Patrick Georgi | 1cd76e7 | 2010-04-19 20:39:22 +0000 | [diff] [blame] | 222 | @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
Patrick Georgi | 75fcaf9 | 2015-04-03 10:16:12 +0200 | [diff] [blame] | 223 | $(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) $(3) -c -o $$$$@ $$$$< |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 224 | en$(EMPTY)def |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 225 | end$(EMPTY)if |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 226 | endef |
| 227 | |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 228 | filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs)))) |
| 229 | $(foreach class,$(classes), \ |
| 230 | $(foreach type,$(call filetypes-of-class,$(class)), \ |
Patrick Georgi | 2459aee | 2015-03-27 15:27:21 +0100 | [diff] [blame] | 231 | $(eval $(class)-$(type)-ccopts += $(generic-$(type)-ccopts) $($(class)-generic-ccopts)) \ |
Patrick Georgi | 416ab38 | 2015-04-03 10:19:38 +0200 | [diff] [blame] | 232 | $(if $(generic-objs_$(type)_template_gen),$(eval $(call generic-objs_$(type)_template_gen,$(class))),\ |
| 233 | $(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] | 234 | |
Patrick Georgi | d69839b | 2015-04-03 10:32:17 +0200 | [diff] [blame] | 235 | foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(basename $(file))))) |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 236 | $(eval $(foreach class,$(classes),$(call foreach-src,$(class)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 237 | |
Julius Werner | f97b88b | 2014-12-05 12:32:09 -0800 | [diff] [blame] | 238 | DEPENDENCIES += $(addsuffix .d,$(basename $(allobjs))) |
Stefan Reinauer | 6bee951 | 2010-03-24 15:51:48 +0000 | [diff] [blame] | 239 | -include $(DEPENDENCIES) |
| 240 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 241 | printall: |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 242 | @$(foreach class,$(classes),echo $(class)-objs:=$($(class)-objs); ) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 243 | @echo alldirs:=$(alldirs) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 244 | @echo allsrcs=$(allsrcs) |
Stefan Reinauer | 6bee951 | 2010-03-24 15:51:48 +0000 | [diff] [blame] | 245 | @echo DEPENDENCIES=$(DEPENDENCIES) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 246 | @$(foreach class,$(special-classes),echo $(class):='$($(class))'; ) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 247 | |
| 248 | endif |
| 249 | |
Patrick Georgi | 40ad842 | 2011-05-21 22:18:59 +0000 | [diff] [blame] | 250 | ifndef NOMKDIR |
Patrick Georgi | d520840 | 2014-04-11 20:24:06 +0200 | [diff] [blame] | 251 | $(shell mkdir -p $(KCONFIG_SPLITCONFIG) $(objutil)/kconfig/lxdialog $(additional-dirs) $(alldirs)) |
Patrick Georgi | 40ad842 | 2011-05-21 22:18:59 +0000 | [diff] [blame] | 252 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 253 | |
Warren Turkal | a9fc330 | 2010-09-03 08:57:32 +0000 | [diff] [blame] | 254 | cscope: |
| 255 | cscope -bR |
| 256 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 257 | doxy: doxygen |
| 258 | doxygen: |
Nicky Sielicki | e08a2a5 | 2015-06-06 08:55:16 -0500 | [diff] [blame] | 259 | $(DOXYGEN) Documentation/Doxyfile.coreboot |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 260 | |
Martin Roth | d7689e4 | 2014-12-29 14:56:19 -0700 | [diff] [blame] | 261 | doxygen_simple: |
Nicky Sielicki | e08a2a5 | 2015-06-06 08:55:16 -0500 | [diff] [blame] | 262 | $(DOXYGEN) Documentation/Doxyfile.coreboot_simple |
Martin Roth | d7689e4 | 2014-12-29 14:56:19 -0700 | [diff] [blame] | 263 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 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 | |
Martin Roth | d7689e4 | 2014-12-29 14:56:19 -0700 | [diff] [blame] | 280 | .PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean doxygen doxy doxygen_simple |