Jacob Garber | 005fe89 | 2020-05-12 22:37:39 -0600 | [diff] [blame] | 1 | ## SPDX-License-Identifier: BSD-3-Clause |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 2 | |
Himanshu Sahdev | d1e18d9 | 2019-09-16 15:55:03 +0530 | [diff] [blame] | 3 | ifneq ($(words $(CURDIR)),1) |
| 4 | $(error Error: Path to the main directory cannot contain spaces) |
| 5 | endif |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 6 | top := $(CURDIR) |
| 7 | src := src |
| 8 | srck := $(top)/util/kconfig |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 9 | obj ?= build |
| 10 | override obj := $(subst $(top)/,,$(abspath $(obj))) |
Raul E Rangel | 81ff33c | 2019-07-11 10:44:21 -0600 | [diff] [blame] | 11 | xcompile ?= $(obj)/xcompile |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 12 | objutil ?= $(obj)/util |
| 13 | objk := $(objutil)/kconfig |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 14 | absobj := $(abspath $(obj)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 15 | |
Nico Huber | 10a879e | 2021-03-06 13:12:34 +0100 | [diff] [blame] | 16 | additional-dirs := |
| 17 | |
Yu-Ping Wu | 0beddb5 | 2020-03-09 10:58:37 +0800 | [diff] [blame] | 18 | VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib) |
| 19 | |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 20 | COREBOOT_EXPORTS := COREBOOT_EXPORTS |
| 21 | COREBOOT_EXPORTS += top src srck obj objutil objk |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 22 | |
Alexander Couzens | be756f1 | 2019-09-13 04:22:12 +0200 | [diff] [blame] | 23 | # reproducible builds |
| 24 | LANG:=C |
| 25 | LC_ALL:=C |
| 26 | TZ:=UTC0 |
Martin Roth | 6318f1f | 2021-05-09 10:26:10 -0600 | [diff] [blame] | 27 | ifneq ($(NOCOMPILE),1) |
Alexander Couzens | cbe2ed4 | 2021-03-09 03:31:07 +0100 | [diff] [blame] | 28 | SOURCE_DATE_EPOCH := $(shell $(top)/util/genbuild_h/genbuild_h.sh . | sed -n 's/^.define COREBOOT_BUILD_EPOCH\>.*"\(.*\)".*/\1/p') |
Martin Roth | 6318f1f | 2021-05-09 10:26:10 -0600 | [diff] [blame] | 29 | endif |
Alexander Couzens | ada431e | 2021-03-09 03:29:18 +0100 | [diff] [blame] | 30 | # don't use COREBOOT_EXPORTS to ensure build steps outside the coreboot build system |
| 31 | # are reproducible |
Alexander Couzens | cbe2ed4 | 2021-03-09 03:31:07 +0100 | [diff] [blame] | 32 | export LANG LC_ALL TZ SOURCE_DATE_EPOCH |
Alexander Couzens | be756f1 | 2019-09-13 04:22:12 +0200 | [diff] [blame] | 33 | |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 34 | DOTCONFIG ?= $(top)/.config |
| 35 | KCONFIG_CONFIG = $(DOTCONFIG) |
Nico Huber | 533bc0a | 2019-01-01 19:03:33 +0100 | [diff] [blame] | 36 | KCONFIG_AUTOADS := $(obj)/cb-config.ads |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 37 | KCONFIG_AUTOHEADER := $(obj)/config.h |
| 38 | KCONFIG_AUTOCONFIG := $(obj)/auto.conf |
| 39 | KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd |
Patrick Georgi | 53ea1d4 | 2019-11-22 16:55:58 +0100 | [diff] [blame] | 40 | KCONFIG_SPLITCONFIG := $(obj)/config/ |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 41 | KCONFIG_TRISTATE := $(obj)/tristate.conf |
| 42 | KCONFIG_NEGATIVES := 1 |
| 43 | KCONFIG_STRICT := 1 |
Nico Huber | 533bc0a | 2019-01-01 19:03:33 +0100 | [diff] [blame] | 44 | KCONFIG_PACKAGE := CB.Config |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 45 | |
| 46 | COREBOOT_EXPORTS += KCONFIG_CONFIG KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG |
| 47 | COREBOOT_EXPORTS += KCONFIG_DEPENDENCIES KCONFIG_SPLITCONFIG KCONFIG_TRISTATE |
| 48 | COREBOOT_EXPORTS += KCONFIG_NEGATIVES KCONFIG_STRICT |
Nico Huber | 533bc0a | 2019-01-01 19:03:33 +0100 | [diff] [blame] | 49 | COREBOOT_EXPORTS += KCONFIG_AUTOADS KCONFIG_PACKAGE |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 50 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 51 | # directory containing the toplevel Makefile.inc |
| 52 | TOPLEVEL := . |
| 53 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 54 | CONFIG_SHELL := sh |
| 55 | KBUILD_DEFCONFIG := configs/defconfig |
| 56 | UNAME_RELEASE := $(shell uname -r) |
Patrick Georgi | 89ec376 | 2010-12-08 19:58:30 +0000 | [diff] [blame] | 57 | HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG)) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 58 | MAKEFLAGS += -rR --no-print-directory |
| 59 | |
| 60 | # 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] | 61 | Q:=@ |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 62 | ifneq ($(V),1) |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 63 | ifneq ($(Q),) |
| 64 | .SILENT: |
Nico Huber | 7325ac5 | 2020-02-16 11:47:52 +0100 | [diff] [blame] | 65 | MAKEFLAGS += -s |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 66 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 67 | endif |
| 68 | |
Julius Werner | 808a429 | 2015-03-13 11:05:07 -0700 | [diff] [blame] | 69 | # Disable implicit/built-in rules to make Makefile errors fail fast. |
| 70 | .SUFFIXES: |
| 71 | |
Patrick Georgi | b3a18ac | 2012-09-13 22:13:33 +0200 | [diff] [blame] | 72 | HOSTCFLAGS := -g |
| 73 | HOSTCXXFLAGS := -g |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 74 | |
Patrick Georgi | 828e0e8 | 2015-04-04 15:50:20 +0200 | [diff] [blame] | 75 | PREPROCESS_ONLY := -E -P -x assembler-with-cpp -undef -I . |
| 76 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 77 | DOXYGEN := doxygen |
| 78 | DOXYGEN_OUTPUT_DIR := doxygen |
| 79 | |
Nico Huber | 7a1fbdb | 2017-08-23 23:48:13 +0200 | [diff] [blame] | 80 | export $(COREBOOT_EXPORTS) |
| 81 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 82 | all: real-all |
| 83 | |
Martin Roth | 4eea174 | 2015-11-25 11:50:04 -0700 | [diff] [blame] | 84 | help_coreboot help:: |
| 85 | @echo '*** coreboot platform targets ***' |
Martin Roth | 76f14b2 | 2015-11-18 13:09:23 -0700 | [diff] [blame] | 86 | @echo ' Use "make [target] V=1" for extra build debug information' |
| 87 | @echo ' all - Build coreboot' |
| 88 | @echo ' clean - Remove coreboot build artifacts' |
| 89 | @echo ' distclean - Remove build artifacts and config files' |
| 90 | @echo ' doxygen - Build doxygen documentation for coreboot' |
Martin Roth | b1574e3 | 2016-07-07 15:50:28 -0600 | [diff] [blame] | 91 | @echo ' doxyplatform - Build doxygen documentation for the current platform' |
Patrick Rudolph | f664321 | 2020-05-17 20:04:12 +0200 | [diff] [blame] | 92 | @echo ' sphinx - Build sphinx documentation for coreboot' |
| 93 | @echo ' sphinx-lint - Build sphinx documenttion for coreboot with warnings as errors' |
Martin Roth | 763e493 | 2018-01-27 16:42:43 -0700 | [diff] [blame] | 94 | @echo ' filelist - Show files used in current build' |
Martin Roth | 76f14b2 | 2015-11-18 13:09:23 -0700 | [diff] [blame] | 95 | @echo ' printall - print makefile info for debugging' |
Werner Zeh | 2de6410 | 2016-01-12 12:45:49 +0100 | [diff] [blame] | 96 | @echo ' gitconfig - set up git to submit patches to coreboot' |
Martin Roth | 76f14b2 | 2015-11-18 13:09:23 -0700 | [diff] [blame] | 97 | @echo ' ctags / ctags-project - make ctags file for all of coreboot or current board' |
| 98 | @echo ' cscope / cscope-project - make cscope.out file for coreboot or current board' |
| 99 | @echo |
| 100 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 101 | # This include must come _before_ the pattern rules below! |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 102 | # Order _does_ matter for pattern rules. |
Patrick Georgi | 3e8ef10 | 2019-11-22 16:54:17 +0100 | [diff] [blame] | 103 | include $(srck)/Makefile.inc |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 104 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 105 | # Three cases where we don't need fully populated $(obj) lists: |
| 106 | # 1. when no .config exists |
| 107 | # 2. when make config (in any flavour) is run |
| 108 | # 3. when make distclean is run |
| 109 | # Don't waste time on reading all Makefile.incs in these cases |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 110 | ifeq ($(strip $(HAVE_DOTCONFIG)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 111 | NOCOMPILE:=1 |
| 112 | endif |
| 113 | ifneq ($(MAKECMDGOALS),) |
Elyes HAOUAS | 91fb139 | 2020-01-20 15:33:11 +0100 | [diff] [blame] | 114 | ifneq ($(filter %config %clean cross% clang iasl lint% help% what-jenkins-does,$(MAKECMDGOALS)),) |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 115 | NOCOMPILE:=1 |
| 116 | endif |
Raul E Rangel | 5592cfd | 2019-07-23 11:13:40 -0600 | [diff] [blame] | 117 | ifneq ($(filter %clean lint% help% what-jenkins-does,$(MAKECMDGOALS)),) |
Zheng Bao | 0fd93d6 | 2012-10-22 16:36:03 +0800 | [diff] [blame] | 118 | NOMKDIR:=1 |
Jakub Czapiga | a4819b3 | 2021-04-13 16:07:05 +0200 | [diff] [blame] | 119 | UNIT_TEST:=1 |
Zheng Bao | 0fd93d6 | 2012-10-22 16:36:03 +0800 | [diff] [blame] | 120 | endif |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 121 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 122 | |
Jakub Czapiga | a4819b3 | 2021-04-13 16:07:05 +0200 | [diff] [blame] | 123 | ifneq ($(filter help%, $(MAKECMDGOALS)), ) |
| 124 | NOCOMPILE:=1 |
| 125 | UNIT_TEST:=1 |
| 126 | else |
Paul Fagerburg | de6cbac | 2021-05-11 09:56:48 -0600 | [diff] [blame] | 127 | ifneq ($(filter %-test %-tests %coverage-report, $(MAKECMDGOALS)),) |
| 128 | ifneq ($(filter-out %-test %-tests %coverage-report, $(MAKECMDGOALS)),) |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 129 | $(error Cannot mix unit-tests targets with other targets) |
| 130 | endif |
| 131 | UNIT_TEST:=1 |
| 132 | NOCOMPILE:= |
| 133 | endif |
Jakub Czapiga | a4819b3 | 2021-04-13 16:07:05 +0200 | [diff] [blame] | 134 | endif |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 135 | |
Raul E Rangel | 81ff33c | 2019-07-11 10:44:21 -0600 | [diff] [blame] | 136 | $(xcompile): util/xcompile/xcompile |
Raul E Rangel | 6325ce2 | 2019-07-10 16:46:34 -0600 | [diff] [blame] | 137 | rm -f $@ |
| 138 | $< $(XGCCPATH) > $@.tmp |
| 139 | \mv -f $@.tmp $@ 2> /dev/null |
| 140 | rm -f $@.tmp |
| 141 | |
Patrick Georgi | cf036d1 | 2010-04-21 06:36:20 +0000 | [diff] [blame] | 142 | ifeq ($(NOCOMPILE),1) |
Patrick Georgi | b351875f | 2020-07-06 15:31:58 +0000 | [diff] [blame] | 143 | # We also don't use .xcompile in the no-compile situations, so |
| 144 | # provide some reasonable defaults. |
| 145 | HOSTCC ?= $(if $(shell type gcc 2>/dev/null),gcc,cc) |
| 146 | HOSTCXX ?= g++ |
| 147 | |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 148 | include $(TOPLEVEL)/Makefile.inc |
Martin Roth | 6797557 | 2016-03-07 16:38:52 -0700 | [diff] [blame] | 149 | include $(TOPLEVEL)/payloads/Makefile.inc |
Martin Roth | e624e27 | 2017-07-31 11:52:58 -0600 | [diff] [blame] | 150 | include $(TOPLEVEL)/util/testing/Makefile.inc |
Werner Zeh | b7f1c2d | 2019-10-04 07:01:13 +0200 | [diff] [blame] | 151 | -include $(TOPLEVEL)/site-local/Makefile.inc |
Jakub Czapiga | a4819b3 | 2021-04-13 16:07:05 +0200 | [diff] [blame] | 152 | include $(TOPLEVEL)/tests/Makefile.inc |
Martin Roth | 20aa043 | 2017-01-26 10:51:43 -0700 | [diff] [blame] | 153 | real-all: |
| 154 | @echo "Error: Expected config file ($(DOTCONFIG)) not present." >&2 |
| 155 | @echo "Please specify a config file or run 'make menuconfig' to" >&2 |
| 156 | @echo "generate a new config file." >&2 |
| 157 | @exit 1 |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 158 | else |
| 159 | |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 160 | ifneq ($(UNIT_TEST),1) |
Paul Kocialkowski | 585c781 | 2016-07-13 11:00:41 +0200 | [diff] [blame] | 161 | include $(DOTCONFIG) |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 162 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 163 | |
Raul E Rangel | 81ff33c | 2019-07-11 10:44:21 -0600 | [diff] [blame] | 164 | # The toolchain requires xcompile to determine the ARCH_SUPPORTED, so we can't |
| 165 | # wait for make to generate the file. |
| 166 | $(if $(wildcard $(xcompile)),, $(shell \ |
| 167 | mkdir -p $(dir $(xcompile)) && \ |
| 168 | util/xcompile/xcompile $(XGCCPATH) > $(xcompile) || rm -f $(xcompile))) |
Patrick Georgi | 0ffef88 | 2017-01-19 23:20:14 +0100 | [diff] [blame] | 169 | |
Raul E Rangel | 81ff33c | 2019-07-11 10:44:21 -0600 | [diff] [blame] | 170 | include $(xcompile) |
Patrick Georgi | 6dda31d | 2015-11-19 15:15:33 +0100 | [diff] [blame] | 171 | |
| 172 | ifneq ($(XCOMPILE_COMPLETE),1) |
Raul E Rangel | 81ff33c | 2019-07-11 10:44:21 -0600 | [diff] [blame] | 173 | $(shell rm -f $(xcompile)) |
| 174 | $(error $(xcompile) deleted because it's invalid. \ |
Patrick Georgi | 6dda31d | 2015-11-19 15:15:33 +0100 | [diff] [blame] | 175 | Restarting the build should fix that, or explain the problem) |
| 176 | endif |
Patrick Georgi | 7b9762f | 2015-06-04 13:18:11 +0200 | [diff] [blame] | 177 | |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 178 | ifneq ($(CONFIG_MMX),y) |
| 179 | CFLAGS_x86_32 += -mno-mmx |
| 180 | endif |
| 181 | |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 182 | ifneq ($(UNIT_TEST),1) |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 183 | include toolchain.inc |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 184 | endif |
Patrick Georgi | cc84a00 | 2014-05-14 21:05:35 +0200 | [diff] [blame] | 185 | |
Zheng Bao | 0764892 | 2015-11-13 10:42:27 +0800 | [diff] [blame] | 186 | strip_quotes = $(strip $(subst ",,$(subst \",,$(1)))) |
Martin Roth | bbf1399 | 2016-01-25 15:59:24 -0700 | [diff] [blame] | 187 | # fix makefile syntax highlighting after strip macro \" ")) |
Patrick Georgi | a84e98b | 2010-03-16 19:01:32 +0000 | [diff] [blame] | 188 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 189 | # The primary target needs to be here before we include the |
| 190 | # other files |
| 191 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 192 | real-all: real-target |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 193 | |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 194 | # must come rather early |
| 195 | .SECONDEXPANSION: |
Raul E Rangel | cc6dc90 | 2018-08-06 16:13:32 -0600 | [diff] [blame] | 196 | .DELETE_ON_ERROR: |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 197 | |
Jonathan Neuschäfer | d2c0242 | 2018-12-11 13:06:40 +0100 | [diff] [blame] | 198 | $(KCONFIG_AUTOHEADER): $(KCONFIG_CONFIG) $(objutil)/kconfig/conf |
Patrick Georgi | 53ea1d4 | 2019-11-22 16:55:58 +0100 | [diff] [blame] | 199 | $(MAKE) olddefconfig |
| 200 | $(MAKE) syncconfig |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 201 | |
Nico Huber | 533bc0a | 2019-01-01 19:03:33 +0100 | [diff] [blame] | 202 | $(KCONFIG_AUTOCONFIG): $(KCONFIG_AUTOHEADER) |
| 203 | true |
| 204 | |
Nico Huber | eafc815 | 2019-10-25 12:47:14 +0200 | [diff] [blame] | 205 | $(KCONFIG_AUTOADS): $(KCONFIG_CONFIG) $(KCONFIG_AUTOHEADER) $(objutil)/kconfig/toada |
Nico Huber | 533bc0a | 2019-01-01 19:03:33 +0100 | [diff] [blame] | 206 | $(objutil)/kconfig/toada CB.Config <$< >$@ |
| 207 | |
Nico Huber | b567977 | 2019-01-01 22:06:01 +0100 | [diff] [blame] | 208 | $(obj)/%/$(notdir $(KCONFIG_AUTOADS)): $(KCONFIG_AUTOADS) |
| 209 | cp $< $@ |
| 210 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 211 | # Add a new class of source/object files to the build system |
| 212 | add-class= \ |
| 213 | $(eval $(1)-srcs:=) \ |
| 214 | $(eval $(1)-objs:=) \ |
| 215 | $(eval classes+=$(1)) |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 216 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 217 | # Special classes are managed types with special behaviour |
| 218 | # On parse time, for each entry in variable $(1)-y |
| 219 | # a handler $(1)-handler is executed with the arguments: |
| 220 | # * $(1): directory the parser is in |
| 221 | # * $(2): current entry |
| 222 | add-special-class= \ |
| 223 | $(eval $(1):=) \ |
| 224 | $(eval special-classes+=$(1)) |
| 225 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 226 | # Converts one or more source file paths to their corresponding build/ paths. |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 227 | # Only .ads, adb, .c and .S get converted to .o, other files (like .ld) keep |
| 228 | # their name. |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 229 | # $1 stage name |
| 230 | # $2 file path (list) |
Nico Huber | 98fc426 | 2016-01-23 01:24:33 +0100 | [diff] [blame] | 231 | src-to-obj=\ |
| 232 | $(patsubst $(obj)/%,$(obj)/$(1)/%,\ |
| 233 | $(patsubst $(obj)/$(1)/%,$(obj)/%,\ |
Nico Huber | d011b6b | 2016-10-05 17:41:31 +0200 | [diff] [blame] | 234 | $(patsubst 3rdparty/%,$(obj)/%,\ |
Nico Huber | 98fc426 | 2016-01-23 01:24:33 +0100 | [diff] [blame] | 235 | $(patsubst src/%,$(obj)/%,\ |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 236 | $(patsubst %.ads,%.o,\ |
| 237 | $(patsubst %.adb,%.o,\ |
Nico Huber | 98fc426 | 2016-01-23 01:24:33 +0100 | [diff] [blame] | 238 | $(patsubst %.c,%.o,\ |
| 239 | $(patsubst %.S,%.o,\ |
Nico Huber | d011b6b | 2016-10-05 17:41:31 +0200 | [diff] [blame] | 240 | $(subst .$(1),,$(2)))))))))) |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 241 | |
| 242 | # Converts one or more source file paths to the corresponding build/ paths |
| 243 | # of their Ada library information (.ali) files. |
| 244 | # $1 stage name |
| 245 | # $2 file path (list) |
| 246 | src-to-ali=\ |
| 247 | $(patsubst $(obj)/%,$(obj)/$(1)/%,\ |
| 248 | $(patsubst $(obj)/$(1)/%,$(obj)/%,\ |
Nico Huber | d011b6b | 2016-10-05 17:41:31 +0200 | [diff] [blame] | 249 | $(patsubst 3rdparty/%,$(obj)/%,\ |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 250 | $(patsubst src/%,$(obj)/%,\ |
| 251 | $(patsubst %.ads,%.ali,\ |
| 252 | $(patsubst %.adb,%.ali,\ |
| 253 | $(subst .$(1),,\ |
Nico Huber | d011b6b | 2016-10-05 17:41:31 +0200 | [diff] [blame] | 254 | $(filter %.ads %.adb,$(2))))))))) |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 255 | |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 256 | # Clean -y variables, include Makefile.inc |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 257 | # Add paths to files in X-y to X-srcs |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 258 | # Add subdirs-y to subdirs |
| 259 | includemakefiles= \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 260 | $(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \ |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 261 | $(eval -include $(1)) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 262 | $(foreach class,$(classes-y), $(call add-class,$(class))) \ |
Arthur Heymans | 5e5fd41 | 2019-06-04 13:16:28 +0200 | [diff] [blame] | 263 | $(foreach special,$(special-classes), \ |
| 264 | $(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 265 | $(foreach class,$(classes), \ |
| 266 | $(eval $(class)-srcs+= \ |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 267 | $$(subst $(absobj)/,$(obj)/, \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 268 | $$(subst $(top)/,, \ |
Vadim Bendebury | 5f7e4f0 | 2015-05-06 21:00:10 -0700 | [diff] [blame] | 269 | $$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y)))))))) \ |
Patrick Georgi | 64b8fba | 2017-10-28 05:26:01 -0400 | [diff] [blame] | 270 | $(eval subdirs+=$$(subst $(CURDIR)/,,$$(wildcard $$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))) |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 271 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 272 | # For each path in $(subdirs) call includemakefiles |
Patrick Georgi | 47d68d8 | 2010-03-06 21:18:43 +0000 | [diff] [blame] | 273 | # Repeat until subdirs is empty |
| 274 | evaluate_subdirs= \ |
| 275 | $(eval cursubdirs:=$(subdirs)) \ |
| 276 | $(eval subdirs:=) \ |
| 277 | $(foreach dir,$(cursubdirs), \ |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 278 | $(eval $(call includemakefiles,$(dir)/Makefile.inc))) \ |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 279 | $(if $(subdirs),$(eval $(call evaluate_subdirs))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 280 | |
| 281 | # collect all object files eligible for building |
Patrick Georgi | e38d0a6 | 2011-03-01 08:09:22 +0000 | [diff] [blame] | 282 | subdirs:=$(TOPLEVEL) |
Julius Werner | e91d170 | 2017-03-20 15:32:15 -0700 | [diff] [blame] | 283 | postinclude-hooks := |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 284 | |
| 285 | # Don't iterate through Makefile.incs under src/ when building tests |
| 286 | ifneq ($(UNIT_TEST),1) |
Patrick Georgi | 51e142f | 2010-03-27 17:18:39 +0000 | [diff] [blame] | 287 | $(eval $(call evaluate_subdirs)) |
Jan Dabros | ef1c968 | 2020-03-28 00:15:03 +0100 | [diff] [blame] | 288 | else |
| 289 | include $(TOPLEVEL)/tests/Makefile.inc |
| 290 | endif |
| 291 | |
Patrick Georgi | 70c85ea | 2013-02-16 01:06:57 +0100 | [diff] [blame] | 292 | ifeq ($(FAILBUILD),1) |
| 293 | $(error cannot continue build) |
| 294 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 295 | |
Julius Werner | e91d170 | 2017-03-20 15:32:15 -0700 | [diff] [blame] | 296 | # Run hooks registered by subdirectories that need to be evaluated after all files have been parsed |
| 297 | $(eval $(postinclude-hooks)) |
| 298 | |
Patrick Georgi | 94a4586 | 2011-10-25 14:32:21 -0700 | [diff] [blame] | 299 | # Eliminate duplicate mentions of source files in a class |
| 300 | $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) |
| 301 | |
Nico Huber | b567977 | 2019-01-01 22:06:01 +0100 | [diff] [blame] | 302 | # Build Kconfig .ads if necessary |
| 303 | ifeq ($(CONFIG_RAMSTAGE_ADA),y) |
| 304 | ramstage-srcs += $(obj)/ramstage/$(notdir $(KCONFIG_AUTOADS)) |
| 305 | endif |
| 306 | |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 307 | # To track dependencies, we need all Ada specification (.ads) files in |
| 308 | # *-srcs. Extract / filter all specification files that have a matching |
| 309 | # body (.adb) file here (specifications without a body are valid sources |
| 310 | # in Ada). |
| 311 | $(foreach class,$(classes),$(eval $(class)-extra-specs := \ |
| 312 | $(filter \ |
| 313 | $(addprefix %/,$(patsubst %.adb,%.ads,$(notdir $(filter %.adb,$($(class)-srcs))))), \ |
| 314 | $(filter %.ads,$($(class)-srcs))))) |
| 315 | $(foreach class,$(classes),$(eval $(class)-srcs := \ |
| 316 | $(filter-out $($(class)-extra-specs),$($(class)-srcs)))) |
| 317 | |
Patrick Georgi | 10f86b0 | 2015-03-27 16:56:23 +0100 | [diff] [blame] | 318 | $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs)))) |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 319 | $(foreach class,$(classes),$(eval $(class)-alis:=$(call src-to-ali,$(class),$($(class)-srcs)))) |
| 320 | |
| 321 | # For Ada includes |
| 322 | $(foreach class,$(classes),$(eval $(class)-ada-dirs:=$(sort $(dir $(filter %.ads %.adb,$($(class)-srcs)) $($(class)-extra-specs))))) |
Patrick Georgi | d3428b0 | 2010-02-24 13:18:01 +0000 | [diff] [blame] | 323 | |
Nico Huber | 963bed5 | 2013-05-15 11:47:51 +0200 | [diff] [blame] | 324 | # Save all objs before processing them (for dependency inclusion) |
| 325 | originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
| 326 | |
Patrick Georgi | 79f9010 | 2012-11-25 14:31:08 +0100 | [diff] [blame] | 327 | # Call post-processors if they're defined |
| 328 | $(foreach class,$(classes),\ |
| 329 | $(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs))))) |
| 330 | |
Patrick Georgi | 5826265 | 2011-02-17 20:47:49 +0000 | [diff] [blame] | 331 | allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var))) |
| 332 | allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 333 | alldirs:=$(sort $(abspath $(dir $(allobjs)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 334 | |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 335 | # Reads dependencies from an Ada library information (.ali) file |
| 336 | # Only basenames (with suffix) are preserved so we have to look the |
| 337 | # paths up in $($(stage)-srcs). |
| 338 | # $1 stage name |
| 339 | # $2 ali file |
| 340 | create_ada_deps=$$(if $(2),\ |
| 341 | gnat.adc \ |
| 342 | $$(filter \ |
| 343 | $$(addprefix %/,$$(shell sed -ne's/^D \([^\t]\+\).*$$$$/\1/p' $(2) 2>/dev/null)), \ |
| 344 | $$($(1)-srcs) $$($(1)-extra-specs))) |
| 345 | |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 346 | # macro to define template macros that are used by use_template macro |
| 347 | define create_cc_template |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 348 | # $1 obj class |
Patrick Georgi | 990e7c9 | 2015-04-03 10:47:15 +0200 | [diff] [blame] | 349 | # $2 source suffix (c, S, ld, ...) |
Marc Jones | a38ccfd | 2014-11-06 15:50:22 -0700 | [diff] [blame] | 350 | # $3 additional compiler flags |
| 351 | # $4 additional dependencies |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 352 | ifn$(EMPTY)def $(1)-objs_$(2)_template |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 353 | de$(EMPTY)fine $(1)-objs_$(2)_template |
Nico Huber | 1850aa6 | 2017-09-03 23:42:58 +0200 | [diff] [blame] | 354 | ifn$(EMPTY)eq ($(filter ads adb,$(2)),) |
Nico Huber | b567977 | 2019-01-01 22:06:01 +0100 | [diff] [blame] | 355 | $$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $$(call create_ada_deps,$1,$$(call src-to-ali,$1,$$(1).$2)) $(4) |
Nico Huber | 1850aa6 | 2017-09-03 23:42:58 +0200 | [diff] [blame] | 356 | @printf " GCC $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
| 357 | $(GCC_$(1)) \ |
| 358 | $$$$(ADAFLAGS_$(1)) $$$$(addprefix -I,$$$$($(1)-ada-dirs)) \ |
| 359 | $(3) -c -o $$$$@ $$$$< |
| 360 | el$(EMPTY)se |
| 361 | $$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $(KCONFIG_AUTOHEADER) $(4) |
Patrick Georgi | 1cd76e7 | 2010-04-19 20:39:22 +0000 | [diff] [blame] | 362 | @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 363 | $(CC_$(1)) \ |
Nico Huber | 1850aa6 | 2017-09-03 23:42:58 +0200 | [diff] [blame] | 364 | -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) \ |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 365 | $(3) -c -o $$$$@ $$$$< |
Nico Huber | 1850aa6 | 2017-09-03 23:42:58 +0200 | [diff] [blame] | 366 | end$(EMPTY)if |
Patrick Georgi patrick.georgi | c5f773d | 2010-03-16 12:01:13 +0000 | [diff] [blame] | 367 | en$(EMPTY)def |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 368 | end$(EMPTY)if |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 369 | endef |
| 370 | |
Patrick Georgi | b8cdd9b | 2011-02-17 20:48:45 +0000 | [diff] [blame] | 371 | filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs)))) |
| 372 | $(foreach class,$(classes), \ |
| 373 | $(foreach type,$(call filetypes-of-class,$(class)), \ |
Patrick Georgi | 2459aee | 2015-03-27 15:27:21 +0100 | [diff] [blame] | 374 | $(eval $(class)-$(type)-ccopts += $(generic-$(type)-ccopts) $($(class)-generic-ccopts)) \ |
Patrick Georgi | 416ab38 | 2015-04-03 10:19:38 +0200 | [diff] [blame] | 375 | $(if $(generic-objs_$(type)_template_gen),$(eval $(call generic-objs_$(type)_template_gen,$(class))),\ |
| 376 | $(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] | 377 | |
Patrick Georgi | d69839b | 2015-04-03 10:32:17 +0200 | [diff] [blame] | 378 | 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] | 379 | $(eval $(foreach class,$(classes),$(call foreach-src,$(class)))) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 380 | |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 381 | # To supported complex package initializations, we need to call the |
| 382 | # emitted code explicitly. gnatbind gathers all the calls for us |
| 383 | # and exports them as a procedure $(stage)_adainit(). Every stage that |
| 384 | # uses Ada code has to call it! |
| 385 | define gnatbind_template |
| 386 | # $1 class |
| 387 | $$(obj)/$(1)/b__$(1).adb: $$$$(filter-out $$(obj)/$(1)/b__$(1).ali,$$$$($(1)-alis)) |
| 388 | @printf " BIND $$(subst $$(obj)/,,$$@)\n" |
| 389 | # We have to give gnatbind a simple filename (without leading |
| 390 | # path components) so just cd there. |
| 391 | cd $$(dir $$@) && \ |
| 392 | $$(GNATBIND_$(1)) -a -n \ |
Nico Huber | be5492a | 2015-09-29 16:41:19 +0200 | [diff] [blame] | 393 | --RTS=$$(absobj)/libgnat-$$(ARCH-$(1)-y)/ \ |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 394 | -L$(1)_ada -o $$(notdir $$@) \ |
| 395 | $$(subst $$(dir $$@),,$$^) |
| 396 | $$(obj)/$(1)/b__$(1).o: $$(obj)/$(1)/b__$(1).adb |
Nico Huber | 1850aa6 | 2017-09-03 23:42:58 +0200 | [diff] [blame] | 397 | @printf " GCC $$(subst $$(obj)/,,$$@)\n" |
| 398 | $(GCC_$(1)) $$(ADAFLAGS_$(1)) -c -o $$@ $$< |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 399 | $(1)-objs += $$(obj)/$(1)/b__$(1).o |
Nico Huber | ddb2465 | 2016-09-19 11:50:04 +0200 | [diff] [blame] | 400 | $($(1)-alis): %.ali: %.o ; |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 401 | endef |
| 402 | |
Nico Huber | be5492a | 2015-09-29 16:41:19 +0200 | [diff] [blame] | 403 | $(eval $(foreach class,$(filter-out libgnat-%,$(classes)), \ |
Nico Huber | 2e09d2b | 2016-01-14 01:13:33 +0100 | [diff] [blame] | 404 | $(if $($(class)-alis),$(call gnatbind_template,$(class))))) |
| 405 | |
Julius Werner | f97b88b | 2014-12-05 12:32:09 -0800 | [diff] [blame] | 406 | DEPENDENCIES += $(addsuffix .d,$(basename $(allobjs))) |
Stefan Reinauer | 6bee951 | 2010-03-24 15:51:48 +0000 | [diff] [blame] | 407 | -include $(DEPENDENCIES) |
| 408 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 409 | printall: |
Martin Roth | 09b6444 | 2016-06-05 10:52:43 -0600 | [diff] [blame] | 410 | @$(foreach class,$(classes), echo $(class)-objs: $($(class)-objs) | tr ' ' '\n'; echo; ) |
| 411 | @echo alldirs: $(alldirs) | tr ' ' '\n'; echo |
| 412 | @echo allsrcs: $(allsrcs) | tr ' ' '\n'; echo |
| 413 | @echo DEPENDENCIES: $(DEPENDENCIES) | tr ' ' '\n'; echo |
| 414 | @$(foreach class,$(special-classes),echo $(class):'$($(class))' | tr ' ' '\n'; echo; ) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 415 | endif |
| 416 | |
Patrick Georgi | 40ad842 | 2011-05-21 22:18:59 +0000 | [diff] [blame] | 417 | ifndef NOMKDIR |
Stefan Reinauer | de60c88 | 2015-06-29 14:44:37 -0700 | [diff] [blame] | 418 | $(shell mkdir -p $(KCONFIG_SPLITCONFIG) $(objk)/lxdialog $(additional-dirs) $(alldirs)) |
Patrick Georgi | 40ad842 | 2011-05-21 22:18:59 +0000 | [diff] [blame] | 419 | endif |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 420 | |
Martin Roth | 9b0204d | 2017-09-18 09:25:18 -0600 | [diff] [blame] | 421 | $(obj)/project_filelist.txt: |
| 422 | if [ -z "$(wildcard $(obj)/coreboot.rom)" ]; then \ |
| 423 | echo "*** Error: Project must be built before generating file list ***"; \ |
| 424 | exit 1; \ |
| 425 | fi |
Martin Roth | 8a02727 | 2017-09-26 09:53:30 -0600 | [diff] [blame] | 426 | find $(obj) -path "$(obj)/util" -prune -o -name "*.d" -exec cat {} \; | \ |
| 427 | sed "s|$(top)/||" | sed 's/[:\\]/ /g' | sed 's/ /\n/g' | sort | uniq | \ |
Martin Roth | 9c1b33e | 2015-07-29 14:55:18 -0700 | [diff] [blame] | 428 | grep -v '\.o$$' > $(obj)/project_filelist.txt |
| 429 | |
Martin Roth | 9b0204d | 2017-09-18 09:25:18 -0600 | [diff] [blame] | 430 | filelist: $(obj)/project_filelist.txt |
Martin Roth | a18353d | 2017-06-06 06:44:46 -0600 | [diff] [blame] | 431 | printf "\nFiles used in build:\n" |
| 432 | cat $(obj)/project_filelist.txt |
| 433 | |
Martin Roth | 9c1b33e | 2015-07-29 14:55:18 -0700 | [diff] [blame] | 434 | #works with either exuberant ctags or ctags.emacs |
| 435 | ctags-project: clean-ctags $(obj)/project_filelist.txt |
| 436 | cat $(obj)/project_filelist.txt | \ |
| 437 | xargs ctags -o tags |
| 438 | |
| 439 | cscope-project: clean-cscope $(obj)/project_filelist.txt |
| 440 | cat $(obj)/project_filelist.txt | xargs cscope -b |
| 441 | |
Warren Turkal | a9fc330 | 2010-09-03 08:57:32 +0000 | [diff] [blame] | 442 | cscope: |
| 443 | cscope -bR |
| 444 | |
Patrick Rudolph | f664321 | 2020-05-17 20:04:12 +0200 | [diff] [blame] | 445 | sphinx: |
| 446 | $(MAKE) -C Documentation -f Makefile.sphinx html |
| 447 | |
| 448 | sphinx-lint: |
| 449 | $(MAKE) SPHINXOPTS=-W -C Documentation -f Makefile.sphinx html |
| 450 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 451 | doxy: doxygen |
| 452 | doxygen: |
Nicky Sielicki | e08a2a5 | 2015-06-06 08:55:16 -0500 | [diff] [blame] | 453 | $(DOXYGEN) Documentation/Doxyfile.coreboot |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 454 | |
Martin Roth | d7689e4 | 2014-12-29 14:56:19 -0700 | [diff] [blame] | 455 | doxygen_simple: |
Nicky Sielicki | e08a2a5 | 2015-06-06 08:55:16 -0500 | [diff] [blame] | 456 | $(DOXYGEN) Documentation/Doxyfile.coreboot_simple |
Martin Roth | d7689e4 | 2014-12-29 14:56:19 -0700 | [diff] [blame] | 457 | |
Martin Roth | b1574e3 | 2016-07-07 15:50:28 -0600 | [diff] [blame] | 458 | doxyplatform doxygen_platform: $(obj)/project_filelist.txt |
| 459 | echo |
| 460 | echo "Building doxygen documentation for $(CONFIG_MAINBOARD_PART_NUMBER)" |
Martin Roth | 09e032e | 2020-10-25 19:44:38 -0600 | [diff] [blame] | 461 | export DOXYGEN_OUTPUT_DIR="$$( echo $(DOXYGEN_OUTPUT_DIR)/$(call strip_quotes, $(CONFIG_MAINBOARD_VENDOR))_$(call strip_quotes, $(CONFIG_MAINBOARD_PART_NUMBER)) | sed 's|[^A-Za-z0-9/]|_|g' )"; \ |
Martin Roth | b1574e3 | 2016-07-07 15:50:28 -0600 | [diff] [blame] | 462 | mkdir -p "$$DOXYGEN_OUTPUT_DIR"; \ |
| 463 | export DOXYFILES="$$(cat $(obj)/project_filelist.txt | grep -v '\.ld$$' | sed 's/\.aml/\.dsl/' | tr '\n' ' ')"; \ |
Martin Roth | 09e032e | 2020-10-25 19:44:38 -0600 | [diff] [blame] | 464 | export DOXYGEN_PLATFORM="$(call strip_quotes, $(CONFIG_MAINBOARD_DIR)) \($(call strip_quotes, $(CONFIG_MAINBOARD_PART_NUMBER))\) version $(KERNELVERSION)"; \ |
Martin Roth | b1574e3 | 2016-07-07 15:50:28 -0600 | [diff] [blame] | 465 | $(DOXYGEN) Documentation/doxygen/Doxyfile.coreboot_platform |
| 466 | |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 467 | doxyclean: doxygen-clean |
| 468 | doxygen-clean: |
Patrick Georgi | 2b7418e | 2009-08-25 19:38:46 +0000 | [diff] [blame] | 469 | rm -rf $(DOXYGEN_OUTPUT_DIR) |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 470 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 471 | clean-for-update: doxygen-clean clean-for-update-target |
Patrick Georgi | 02ae0bf | 2013-02-09 15:45:02 +0100 | [diff] [blame] | 472 | rm -rf $(obj) .xcompile |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 473 | |
Martin Roth | 20cd54f | 2017-03-26 18:49:02 -0600 | [diff] [blame] | 474 | clean: clean-for-update clean-target clean-utils |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 475 | rm -f .ccwrap |
Warren Turkal | 0e8f204 | 2010-09-27 21:14:19 +0000 | [diff] [blame] | 476 | |
Warren Turkal | a9fc330 | 2010-09-03 08:57:32 +0000 | [diff] [blame] | 477 | clean-cscope: |
| 478 | rm -f cscope.out |
| 479 | |
Martin Roth | 9c1b33e | 2015-07-29 14:55:18 -0700 | [diff] [blame] | 480 | clean-ctags: |
| 481 | rm -f tags |
| 482 | |
Martin Roth | 20cd54f | 2017-03-26 18:49:02 -0600 | [diff] [blame] | 483 | clean-utils: |
Martin Roth | 1d721ed | 2017-07-07 10:49:48 -0600 | [diff] [blame] | 484 | $(foreach tool, $(TOOLLIST), \ |
| 485 | $(MAKE) -C util/$(tool) clean MFLAGS= MAKEFLAGS= ;) |
Martin Roth | 20cd54f | 2017-03-26 18:49:02 -0600 | [diff] [blame] | 486 | |
| 487 | distclean-utils: |
Martin Roth | 1d721ed | 2017-07-07 10:49:48 -0600 | [diff] [blame] | 488 | $(foreach tool, $(TOOLLIST), \ |
| 489 | $(MAKE) -C util/$(tool) distclean MFLAGS= MAKEFLAGS= ; \ |
Martin Roth | 20cd54f | 2017-03-26 18:49:02 -0600 | [diff] [blame] | 490 | rm -f /util/$(tool)/junit.xml;) |
| 491 | |
| 492 | distclean: clean clean-ctags clean-cscope distclean-payloads distclean-utils |
Patrick Georgi | 80656af | 2017-04-26 11:58:44 +0200 | [diff] [blame] | 493 | rm -f .config .config.old ..config.tmp* .kconfig.d .tmpconfig* .ccwrap .xcompile |
Martin Roth | 20cd54f | 2017-03-26 18:49:02 -0600 | [diff] [blame] | 494 | rm -rf coreboot-builds coreboot-builds-chromeos |
| 495 | rm -f abuild*.xml junit.xml* util/lint/junit.xml |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 496 | |
Patrick Rudolph | f664321 | 2020-05-17 20:04:12 +0200 | [diff] [blame] | 497 | .PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean doxygen doxy doxygen_simple sphinx sphinx-lint |
Martin Roth | 9c1b33e | 2015-07-29 14:55:18 -0700 | [diff] [blame] | 498 | .PHONY: ctags-project cscope-project clean-ctags |