1 # Copyright (c) 2015 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
15 # Copyright (c) 2007-2008 Eliot Dresselhaus
17 # Permission is hereby granted, free of charge, to any person obtaining
18 # a copy of this software and associated documentation files (the
19 # "Software"), to deal in the Software without restriction, including
20 # without limitation the rights to use, copy, modify, merge, publish,
21 # distribute, sublicense, and/or sell copies of the Software, and to
22 # permit persons to whom the Software is furnished to do so, subject to
23 # the following conditions:
25 # The above copyright notice and this permission notice shall be
26 # included in all copies or substantial portions of the Software.
28 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 ######################################################################
38 # Collect makefile fragments
39 ######################################################################
41 # Scripts require non-POSIX parts of bash
44 # Where this makefile lives
45 MU_BUILD_ROOT_DIR = $(shell pwd)
46 MU_BUILD_NAME = $(shell basename $(MU_BUILD_ROOT_DIR))
48 # Search path (e.g. multiple directories) where sources are found.
51 # Pick up user's definitions for variables e.g. SOURCE_PATH, etc.
52 -include build-config.mk
54 MU_BUILD_ROOT_NAME = $(shell basename $(MU_BUILD_ROOT_DIR))
55 MU_BUILD_DATA_DIR_NAME = build-data
57 ABSOLUTE_SOURCE_PATH = $(foreach d,$(SOURCE_PATH),$(shell cd $(d) && pwd))
59 SOURCE_PATH_BUILD_ROOT_DIRS = $(addsuffix /$(MU_BUILD_NAME),$(ABSOLUTE_SOURCE_PATH))
60 SOURCE_PATH_BUILD_DATA_DIRS = $(addsuffix /$(MU_BUILD_DATA_DIR_NAME),$(ABSOLUTE_SOURCE_PATH))
62 # For tools use build-root as source path, otherwise use given source path
64 $(if $(is_build_tool), \
65 $(SOURCE_PATH_BUILD_ROOT_DIRS) $(MU_BUILD_ROOT_DIR), \
66 $(SOURCE_PATH_BUILD_DATA_DIRS))
68 # First search given source path, then default to build-root
69 FULL_SOURCE_PATH = $(SOURCE_PATH_BUILD_DATA_DIRS) $(MU_BUILD_ROOT_DIR)
72 is_in_fn = $(strip $(filter $(1),$(2)))
73 last_fn = $(lastword $1)
74 chop_fn = $(wordlist 2,$(words $1),x $1)
75 uniq_fn = $(strip $(if $1,$(call uniq_fn,$(call chop_fn,$1)) \
76 $(if $(filter $(call last_fn,$1),$(call chop_fn,$1)),,$(call last_fn,$1))))
77 ifdef3_fn = $(if $(patsubst undefined,,$(origin $(1))),$(3),$(2))
78 ifdef_fn = $(call ifdef3_fn,$(1),$(2),$($(1)))
80 _mu_debug = $(warning "$(1) = $($(1))")
82 $(foreach d,$(FIND_SOURCE_PATH), \
83 $(eval _mu_package_mk_in_$(d) = $(shell find $(d)/packages/*.mk 2> /dev/null)) \
84 $(eval _mu_srcdirs_in_$(d) = \
85 $(shell find $(d)/.. \
88 -and -not -name ".." \
89 -and -not -name $(MU_BUILD_ROOT_NAME) \
90 -and -not -name $(MU_BUILD_DATA_DIR_NAME))) \
91 $(eval _mu_non_package_files_in_$(d) = \
92 $(shell find $(d)/packages \
94 -and -not -name '*.mk' \
95 -and -not -name '*~' 2> /dev/null)) \
96 $(foreach p,$(patsubst %.mk,%,$(notdir $(_mu_package_mk_in_$(d)))), \
97 $(eval _mu_package_dir_$(p) = $(d)) \
98 $(eval _mu_package_mk_$(p) = $(d)/packages/$(p).mk) \
100 $(foreach p,$(notdir $(_mu_srcdirs_in_$(d))), \
101 $(eval _mu_package_srcdir_$(p) = $(shell cd $(d)/../$(p) && pwd)) \
105 # Find root directory for package based on presence of package .mk
106 # makefile fragment on source path.
107 _find_build_data_dir_for_package_fn = $(shell \
108 set -eu$(BUILD_DEBUG) ; \
109 for d in $(FIND_SOURCE_PATH) ; do \
110 f="$${d}/packages/$(1).mk" ; \
111 [[ -f $${f} ]] && echo `cd $${d} && pwd` && exit 0 ; \
114 find_build_data_dir_for_package_fn = $(call ifdef_fn,_mu_package_dir_$(1),)
117 _find_source_fn = $(shell \
118 set -eu$(BUILD_DEBUG) ; \
119 d="$(call find_build_data_dir_for_package_fn,$(1))" ; \
120 [[ -n "$${d}" ]] && d="$${d}/../$(1)" ; \
122 find_source_fn = $(call ifdef3_fn,_mu_package_dir_$(1),,$(_mu_package_dir_$(1))/../$(1))
124 # Find given FILE in source path as build-data/packages/FILE
125 find_package_file_fn = $(shell \
126 set -eu$(BUILD_DEBUG) ; \
127 d="$(call find_build_data_dir_for_package_fn,$(1))" ; \
128 [[ -n "$${d}" ]] && d="$${d}/packages/$(2)" ; \
129 [[ -f "$${d}" ]] && echo "$${d}")
131 # Find first FILE in source path with name PATH/build-data/FILE
132 find_build_data_file_fn = $(shell \
133 set -eu$(BUILD_DEBUG) ; \
134 for d in $(FIND_SOURCE_PATH) ; do \
136 [[ -f $${f} ]] && echo `cd $${d} && pwd`/$(1) && exit 0 ; \
140 ######################################################################
142 ######################################################################
144 NATIVE_ARCH = $(shell gcc -dumpmachine | sed -e 's/\([a-zA-Z_0-9]*\)-.*/\1/')
146 # Find all platforms.mk that we can, including those from build-root
147 $(foreach d,$(FULL_SOURCE_PATH), \
148 $(eval -include $(d)/platforms.mk))
150 # Platform should be defined somewhere by specifying $($(PLATFORM)_arch)
151 ARCH = $(strip $($(PLATFORM)_arch))
153 $(error "Unknown platform `$(PLATFORM)'")
156 # map e.g. ppc7450 -> ppc
158 ${shell case '$(ARCH)' in \
159 (native) echo $(NATIVE_ARCH) ;; \
160 (i*86*) echo i386 ;; \
161 (ppc*|powerpc*) echo ppc ;; \
162 (*) echo '$(ARCH)' ;; \
165 # x86_64 can be either 32/64. set BIACH=32 to get 32 bit libraries.
169 x86_64_libdir = $(BIARCH)
170 native_libdir = $($(NATIVE_ARCH)_libdir)
172 # lib or lib64 depending
173 arch_lib_dir = lib$($(BASIC_ARCH)_libdir)
175 # OS to configure for. configure --host will be set to $(ARCH)-$(OS)
176 # Allow per-platform overrides
178 OS = $(strip $($(PLATFORM)_os))
186 is_native = $(if $(ARCH:native=),,true)
187 not_native = $(if $(ARCH:native=),true,)
189 ARCH_TARGET_tmp = $(call ifdef_fn,$(ARCH)_target,$(ARCH)-$(OS))
190 TARGET = $(call ifdef_fn,$(PLATFORM)_target,$(ARCH_TARGET_tmp))
191 TARGET_PREFIX = $(if $(not_native),$(TARGET)-,)
193 # CPU microarchitecture detection.
194 # Either set <platform>_march in build-data/platforms/<platform>.mk,
195 # or detect and use the build-host instruction set
197 MARCH = $(strip $($(PLATFORM)_march))
199 ifneq ($(wildcard $(TOOL_INSTALL_DIR)/bin/$(TARGET)-gcc),)
200 TARGET_GCC = $(TOOL_INSTALL_DIR)/bin/$(TARGET)-gcc
201 else ifneq ($(wildcard $(MU_BUILD_ROOT_DIR)/tools/bin/$(TARGET)-gcc),)
202 TARGET_GCC = $(MU_BUILD_ROOT_DIR)/tools/bin/$(TARGET)-gcc
204 ifneq ($(TARGET_GCC),)
205 MARCH = $(shell $(TARGET_GCC) -Q --help=target -march=native | grep march | sed -e 's/.*march=[[:space:]]*//')
210 ifeq ($(MARCH),nehalem)
211 override MARCH = corei7
212 else ifeq ($(MARCH),westmere)
213 override MARCH = corei7
214 else ifeq ($(MARCH),sandybridge)
215 override MARCH = corei7-avx
216 else ifeq ($(MARCH),ivybridge)
217 override MARCH = core-avx-i
218 else ifeq ($(MARCH),haswell)
219 override MARCH = core-avx2
224 MTUNE = $(strip $($(PLATFORM)_mtune))
229 ######################################################################
230 # Generic build stuff
231 ######################################################################
233 # The package we are currently working on
236 # Build/install tags. This lets you have different CFLAGS/CPPFLAGS/LDFLAGS
237 # for e.g. debug versus optimized compiles. Each tag has its own set of build/install
240 TAG_PREFIX = $(if $(TAG),$(TAG)-)
242 # yes you need the space
243 tag_var_with_added_space_fn = $(if $($(TAG)_TAG_$(1)),$($(TAG)_TAG_$(1)) )
245 # TAG=debug for debugging
246 debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
247 -fstack-protector-all -fPIC
248 debug_TAG_CXXFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
249 -fstack-protector-all -fPIC
250 debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
251 -fstack-protector-all -fPIC
253 BUILD_PREFIX_package = build-$(TAG_PREFIX)
254 BUILD_PREFIX_tool = build-tool-$(TAG_PREFIX)
255 INSTALL_PREFIX = install-$(TAG_PREFIX)
256 IMAGES_PREFIX = images-$(TAG_PREFIX)
258 # Whether we are building a tool or not
259 tool_or_package_fn = $(if $(is_build_tool),tool,package)
261 # Directory where packages are built & installed
262 BUILD_DIR = $(MU_BUILD_ROOT_DIR)/$(BUILD_PREFIX_$(call tool_or_package_fn))$(ARCH)
263 INSTALL_DIR = $(MU_BUILD_ROOT_DIR)/$(INSTALL_PREFIX)$(ARCH)
265 PLATFORM_IMAGE_DIR = $(MU_BUILD_ROOT_DIR)/$(IMAGES_PREFIX)$(PLATFORM)
267 # $(call VAR,DEFAULT)
268 override_var_with_default_fn = $(if $($(1)),$($(1)),$(2))
270 # $(call if_directory_exists_fn,D1,D2) returns D1 if it exists else D2
271 define if_directory_exists_fn
272 $(shell if test -d $(1); then echo $(1); else echo $(2); fi)
275 # $(call if_file_exists_fn,F1,F2) returns F1 if it exists else F2
276 define if_file_exists_fn
277 $(shell if test -f $(1); then echo $(1); else echo $(2); fi)
280 # Default VAR, package specified override of default PACKAGE_VAR
281 package_var_fn = $(call override_var_with_default_fn,$(1)_$(2),$(1))
283 package_build_dir_fn = $(call package_var_fn,$(1),build_dir)
285 package_install_dir_fn = \
286 $(if $(is_build_tool),$(TOOL_INSTALL_DIR),$(INSTALL_DIR)/$(call package_build_dir_fn,$(1)))
288 PACKAGE_BUILD_DIR = \
289 $(BUILD_DIR)/$(call package_build_dir_fn,$(PACKAGE))
290 PACKAGE_INSTALL_DIR = \
291 $(call package_install_dir_fn,$(PACKAGE))
293 # Tools (gcc, binutils, glibc...) are installed here
294 TOOL_INSTALL_DIR = $(MU_BUILD_ROOT_DIR)/tools
296 # Target specific tools go here e.g. mu-build/tools/ppc-mu-linux
297 TARGET_TOOL_INSTALL_DIR = $(TOOL_INSTALL_DIR)/$(TARGET)
299 # Set BUILD_DEBUG to vx or x enable shell command tracing.
302 # Message from build system itself (as opposed to make or shell commands)
303 build_msg_fn = echo "@@@@ $(1) @@@@"
305 # Allow CCACHE_DIR to be overridden, e.g. in .../build-root/build-config.mk
306 ifeq ($(CCACHE_DIR),)
307 CCACHE_DIR=$(MU_BUILD_ROOT_DIR)/.ccache
310 # Always prefer our own tools to those installed on system.
311 # Note: ccache-bin must be before tool bin.
313 # Removed LD_LIBRARY_PATH from BUILD_ENV (drb, 10/31/17):
314 # export LD_LIBRARY_PATH=$(TOOL_INSTALL_DIR)/lib64:$(TOOL_INSTALL_DIR)/lib
315 # Reported to cause trouble. Only of historical interest, since we no longer
316 # build a full tool chain from source.
319 export CCACHE_DIR=$(CCACHE_DIR) ; \
320 export PATH=$(wildcard /usr/lib*/ccache):$(TOOL_INSTALL_DIR)/bin:$${PATH} ; \
321 $(if $(call configure_var_fn,PATH), export PATH=$${PATH}:$(call configure_var_fn,PATH);,) \
322 export PATH="`echo $${PATH} | sed -e s/[.]://`" ; \
323 $(if $(not_native),export CONFIG_SITE=$(MU_BUILD_ROOT_DIR)/config.site ;,) \
324 set -eu$(BUILD_DEBUG) ; \
327 ######################################################################
328 # Package build generic definitions
329 ######################################################################
332 $(call find_build_data_dir_for_package_fn,$(1))/packages
334 package_mk_fn = $(call package_dir_fn,$(1))/$(1).mk
336 # Pick up built-root/pre-package-include.mk for all source directories
337 $(foreach d,$(SOURCE_PATH_BUILD_ROOT_DIRS), \
338 $(eval -include $(d)/pre-package-include.mk))
340 $(foreach d,$(addsuffix /packages,$(FIND_SOURCE_PATH)), \
341 $(eval -include $(d)/*.mk) \
342 $(eval ALL_PACKAGES += $(patsubst $(d)/%.mk,%,$(wildcard $(d)/*.mk))) \
345 # Pick up built-root/post-package-include.mk for all source directories
346 $(foreach d,$(SOURCE_PATH_BUILD_ROOT_DIRS), \
347 $(eval -include $(d)/post-package-include.mk))
349 # Linux specific native build tools
350 NATIVE_TOOLS_LINUX = \
360 IS_LINUX = $(if $(findstring no,$($(PLATFORM)_uses_linux)),no,yes)
362 NATIVE_TOOLS_$(IS_LINUX) += $(NATIVE_TOOLS_LINUX)
364 # only build glibc for linux installs
365 CROSS_TOOLS_$(IS_LINUX) += glibc gcc
367 # must be first for bootstrapping
368 NATIVE_TOOLS = findutils make
370 # basic tools needed for build system
371 NATIVE_TOOLS += git automake autoconf libtool texinfo tar
373 # needed to compile gcc
374 NATIVE_TOOLS += mpfr gmp mpc
376 # Tool to sign binaries
380 NATIVE_TOOLS += ccache
382 # Tools needed on native host to build for platform
383 NATIVE_TOOLS += $(call ifdef_fn,$(PLATFORM)_native_tools,)
385 # Tools for cross-compiling from native -> ARCH
386 CROSS_TOOLS = binutils gcc-bootstrap gdb
388 # Tools needed on native host to build for platform
389 CROSS_TOOLS += $(call ifdef_fn,$(PLATFORM)_cross_tools,)
391 NATIVE_TOOLS += $(NATIVE_TOOLS_yes)
392 CROSS_TOOLS += $(CROSS_TOOLS_yes)
394 timestamp_name_fn = .mu_build_$(1)_timestamp
395 CONFIGURE_TIMESTAMP = $(call timestamp_name_fn,configure)
396 BUILD_TIMESTAMP = $(call timestamp_name_fn,build)
397 INSTALL_TIMESTAMP = $(call timestamp_name_fn,install)
399 TIMESTAMP_DIR = $(PACKAGE_BUILD_DIR)
401 find_newer_files_fn = \
402 "`for i in $(2) ; do \
403 [[ -f $$i && $$i -nt $(1) ]] && echo "$$i" && exit 0; \
407 find_filter = -not -name '*~'
408 find_filter += -and -not -path '*/.git*'
409 find_filter += -and -not -path '*/.svn*'
410 find_filter += -and -not -path '*/.CVS*'
411 find_filter += -and -not -path '*/manual/*'
412 find_filter += -and -not -path '*/autom4te.cache/*'
413 find_filter += -and -not -path '*/doc/all-cfg.texi'
414 find_filter += -and -not -path '*/.mu_build_*'
416 find_newer_filtered_fn = \
418 || -n $(call find_newer_files_fn,$(1),$(3)) \
419 || -n "`find -H $(2) \
426 $(call find_newer_filtered_fn,$(1),$(2),$(3),$(find_filter))
428 ######################################################################
429 # Package dependencies
430 ######################################################################
432 # This must come before %-configure, %-build, %-install pattern rules
433 # or else dependencies will not work.
435 package_dependencies_fn = \
436 $(patsubst %-install, %, \
437 $(filter %-install,$($(1)_configure_depend)))
439 PACKAGE_DEPENDENCIES = $(call package_dependencies_fn,$(PACKAGE))
441 # package specific configure, build, install dependencies
442 add_package_dependency_fn = \
443 $(if $($(1)_$(2)_depend), \
444 $(eval $(1)-$(2) : $($(1)_$(2)_depend)))
446 $(foreach p,$(ALL_PACKAGES), \
447 $(call add_package_dependency_fn,$(p),configure) \
448 $(call add_package_dependency_fn,$(p),build) \
449 $(call add_package_dependency_fn,$(p),install))
451 TARGETS_RESPECTING_DEPENDENCIES = image_install wipe diff push-all pull-all find-source
453 # carry over packages dependencies to image install, wipe, pull-all, push-all
454 $(foreach p,$(ALL_PACKAGES), \
455 $(if $($(p)_configure_depend), \
456 $(foreach s,$(TARGETS_RESPECTING_DEPENDENCIES), \
458 $(addsuffix -$(s), $(call package_dependencies_fn,$(p)))))))
460 # recursively resolve dependencies
461 resolve_dependencies2_fn = $(strip \
462 $(eval __added = $(filter-out $(4), \
465 $(call ifdef3_fn,$(l)$(1),,$(call $(2),$($(l)$(1)))) \
467 $(eval __known = $(call uniq_fn,$(4) $(3) $(__added))) \
469 $(call resolve_dependencies2_fn,$(1),$(2),$(__added),$(__known)), \
473 resolve_dependencies_null_fn = $(1)
475 resolve_dependencies_fn = $(call resolve_dependencies2_fn,$(1),resolve_dependencies_null_fn,$(2))
477 ######################################################################
479 ######################################################################
481 # x86_64 can be either 32/64. set BIACH=32 to get 32 bit libraries.
484 x86_64_libdir = $(BIARCH)
485 native_libdir = $($(NATIVE_ARCH)_libdir)
487 # lib or lib64 depending
488 arch_lib_dir = lib$($(BASIC_ARCH)_libdir)
490 # find dynamic linker as absolute path
491 TOOL_INSTALL_LIB_DIR=$(TOOL_INSTALL_DIR)/$(TARGET)/$(arch_lib_dir)
492 DYNAMIC_LINKER=${shell cd $(TOOL_INSTALL_LIB_DIR); echo ld*.so.*}
494 # Pad dynamic linker & rpath so elftool will never have to change ELF section sizes.
495 # Yes, this is a kludge.
496 lots_of_slashes_to_pad_names = "/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
498 # When PLATFORM != native we *always* use our own versions of GLIBC and dynamic linker
499 # Allow per-platform overrides
500 CROSS_LDFLAGS = $(strip $($(PLATFORM)_cross_ldflags))
501 ifeq ($(CROSS_LDFLAGS),)
503 -Wl,--dynamic-linker=$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR)/$(DYNAMIC_LINKER) \
504 -Wl,-rpath -Wl,$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR)
507 cross_ldflags = $(if $(is_native)$(is_build_tool),,$(CROSS_LDFLAGS) )
509 # $(call installed_libs_fn,PACKAGE)
510 # Return install library directory for given package.
511 # Some packages (e.g. openssl) don't install under lib64; instead they use lib
512 define installed_lib_fn
513 $(call if_directory_exists_fn,
514 $(call package_install_dir_fn,$(1))/$(arch_lib_dir),
515 $(call package_install_dir_fn,$(1))/lib)
518 # Set -L and rpath to point to dependent libraries previously built by us.
519 installed_libs_fn = \
521 -L$(call installed_lib_fn,$(i)) \
522 -Wl,-rpath -Wl,$(call installed_lib_fn,$(i)))
524 # As above for include files
525 installed_include_fn = $(call package_install_dir_fn,$(1))/include
527 installed_includes_fn = $(foreach i,$(1),-I$(call installed_include_fn,$(i)))
529 # By default package CPPFLAGS (to set include path -I) and LDFLAGS (to set link path -L)
530 # point at dependent install directories.
531 DEFAULT_CPPFLAGS = $(call installed_includes_fn, $(PACKAGE_DEPENDENCIES))
532 DEFAULT_LDFLAGS = $(call installed_libs_fn, $(PACKAGE_DEPENDENCIES))
535 $(call tag_var_with_added_space_fn,$(1))$(call override_var_with_default_fn,$(PACKAGE)_$(1),$(DEFAULT_$(1)))
536 configure_ldflags_fn = \
537 $(cross_ldflags)$(call configure_var_fn,LDFLAGS)
539 # Allow packages to override CPPFLAGS, CFLAGS, and LDFLAGS
541 $(if $(call configure_var_fn,CPPFLAGS), \
542 CPPFLAGS="$(CPPFLAGS) $(call configure_var_fn,CPPFLAGS)") \
543 $(if $(call configure_var_fn,CXXFLAGS), \
544 CXXFLAGS="$(CXXFLAGS) $(call configure_var_fn,CXXFLAGS)") \
545 $(if $(call configure_var_fn,CFLAGS), \
546 CFLAGS="$(CFLAGS) $(call configure_var_fn,CFLAGS)") \
547 $(if $(call configure_var_fn,CCASFLAGS), \
548 CCASFLAGS="$(CCASFLAGS) $(call configure_var_fn,CCASFLAGS)") \
549 $(if $(call configure_ldflags_fn), \
550 LDFLAGS="$(LDFLAGS) $(call configure_ldflags_fn)") \
551 $(if $($(PACKAGE)_configure_env),$($(PACKAGE)_configure_env))
553 # only partially used now (used in a few .mk files)
554 ifeq ($(is_build_tool),yes)
555 prefix = $(PACKAGE_INSTALL_DIR)
556 libdir = $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)
557 libexecdir = $(PACKAGE_INSTALL_DIR)/usr/libexec
560 # Eventually simplify this with no per package DESTDIR or prefix
561 ppdMacro = $(if $(PER_PACKAGE_DESTDIR),$(call package_build_dir_fn,$(1)))
562 pppMacro = $(if $(PER_PACKAGE_PREFIX),$(call package_build_dir_fn,$(1)))
563 prefixMacro = $($(PLATFORM)_PREFIX_BASE)/$(pppMacro)
564 prefix = $(call prefixMacro,$(PACKAGE))
565 libdir = $($(PLATFORM)_LIBDIR)
566 libexecdir = $($(PLATFORM)_LIBEXECDIR)
567 destdirMacro = $($(PLATFORM)_DESTDIR_BASE)$(ppdMacro)
568 DESTDIR = $(call destdirMacro,$(PACKAGE))
571 configure_package_gnu = \
572 s=$(call find_source_fn,$(PACKAGE_SOURCE))$(PACKAGE_SUBDIR) ; \
573 if [ ! -f $$s/configure ] ; then \
574 autoreconf -i -f $$s ; \
576 cd $(PACKAGE_BUILD_DIR) ; \
577 env $(CONFIGURE_ENV) \
579 $(if $($(PACKAGE)_configure_host_and_target), \
580 $($(PACKAGE)_configure_host_and_target), \
581 $(if $(not_native),--host=$(TARGET),)) \
582 $(if $($(PACKAGE)_configure_prefix), \
583 $($(PACKAGE)_configure_prefix), \
584 --libdir=$(PACKAGE_INSTALL_DIR)/$(arch_lib_dir) \
585 --prefix=$(PACKAGE_INSTALL_DIR)) \
586 $($(PACKAGE)_configure_args) \
587 $($(PACKAGE)_configure_args_$(PLATFORM))
589 configure_package = \
590 $(call build_msg_fn,Configuring $(PACKAGE) in $(PACKAGE_BUILD_DIR)) ; \
591 mkdir -p $(PACKAGE_BUILD_DIR) ; \
592 $(if $($(PACKAGE)_configure), \
593 $($(PACKAGE)_configure), \
594 $(configure_package_gnu))
596 # Tools (e.g. gcc, binutils, gdb) required a platform to build for
598 is_tool="$(is_build_tool)" ; \
599 is_cross_package="$(findstring $(PACKAGE),$(CROSS_TOOLS))" ; \
600 is_arch_native="$(if $(subst native,,$(ARCH)),,yes)" ; \
601 if [ "$${is_tool}" == "yes" \
602 -a "$${is_cross_package}" != "" \
603 -a "$${is_arch_native}" != "" ]; then \
604 $(call build_msg_fn,You must specify PLATFORM for building tools) ; \
607 : check that platform gcc can be found ; \
609 if [ "$${is_arch_native}" != "yes" ] ; then \
610 target_gcc=$(TARGET)-gcc ; \
612 if [ "$${is_tool}" != "yes" \
613 -a "$${is_arch_native}" != "yes" \
614 -a ! -x "`which 2> /dev/null $${target_gcc}`" ] ; then \
615 $(call build_msg_fn, \
616 No cross-compiler found for platform $(PLATFORM) target $(TARGET); \
617 try make PLATFORM=$(PLATFORM) install-tools) ; \
621 configure_check_timestamp = \
623 $(check_platform) ; \
624 mkdir -p $(PACKAGE_BUILD_DIR) ; \
625 mkdir -p $(PACKAGE_INSTALL_DIR) ; \
626 conf="$(TIMESTAMP_DIR)/$(CONFIGURE_TIMESTAMP)" ; \
627 dirs="$(call package_mk_fn,$(PACKAGE)) \
628 $(SOURCE_PATH_BUILD_DATA_DIRS)/platforms/$(PLATFORM).mk \
629 $(wildcard $(call find_source_fn,$(PACKAGE_SOURCE))/cmake) \
630 $(shell find $(call find_source_fn,$(PACKAGE_SOURCE)) \
631 -name CMakeLists.txt) \
632 $(wildcard $(call find_source_fn, \
633 $(PACKAGE_SOURCE))$(PACKAGE_SUBDIR)/configure) \
634 $(MU_BUILD_ROOT_DIR)/config.site" ; \
635 if [[ $(call find_newer_fn, $${conf}, $${dirs}, $?) ]]; then \
636 $(configure_package) ; \
639 $(call build_msg_fn,Configuring $(PACKAGE): nothing to do) ; \
643 %-configure: %-find-source
644 $(configure_check_timestamp)
646 ######################################################################
648 ######################################################################
650 # /proc/cpuinfo does not exist on platforms without a /proc and on some
651 # platforms, notably inside containers, it has no content. In those cases
652 # we assume there's 1 processor; we use 2*ncpu for the -j option.
653 # NB: GNU Make 4.2 will let us use '$(file </proc/cpuinfo)' to both test
654 # for file presence and content; for now this will have to do.
655 ifndef MAKE_PARALLEL_JOBS
656 MAKE_PARALLEL_JOBS = -j $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo), \
657 $(shell grep -c ^processor /proc/cpuinfo), 2)
659 MAKE_PARALLEL_JOBS := -j $(MAKE_PARALLEL_JOBS)
661 MAKE_PARALLEL_FLAGS ?= $(if $($(PACKAGE)_make_parallel_fails),,$(MAKE_PARALLEL_JOBS))
663 # Make command shorthand for packages & tools.
666 -C $(PACKAGE_BUILD_DIR) \
667 $($(PACKAGE)_make_args) \
668 $(MAKE_PARALLEL_FLAGS)
671 $(call build_msg_fn,Building $* in $(PACKAGE_BUILD_DIR)) ; \
672 mkdir -p $(PACKAGE_BUILD_DIR) ; \
673 cd $(PACKAGE_BUILD_DIR) ; \
674 $(if $($(PACKAGE)_build), \
675 $($(PACKAGE)_build), \
678 build_check_timestamp = \
680 comp="$(TIMESTAMP_DIR)/$(BUILD_TIMESTAMP)" ; \
681 conf="$(TIMESTAMP_DIR)/$(CONFIGURE_TIMESTAMP)" ; \
682 dirs="$(call find_source_fn,$(PACKAGE_SOURCE)) \
683 $($(PACKAGE)_build_timestamp_depends) \
684 $(if $(is_build_tool),,$(addprefix $(INSTALL_DIR)/,$(PACKAGE_DEPENDENCIES)))" ; \
685 if [[ $${conf} -nt $${comp} \
686 || $(call find_newer_fn, $${comp}, $${dirs}, $?) ]]; then \
690 $(call build_msg_fn,Building $(PACKAGE): nothing to do) ; \
695 $(build_check_timestamp)
698 %-rebuild: %-wipe %-build
701 ######################################################################
703 ######################################################################
706 : by default, for non-tools, remove any previously installed bits ; \
707 $(if $(is_build_tool)$($(PACKAGE)_keep_instdir), \
709 rm -rf $(PACKAGE_INSTALL_DIR)); \
710 mkdir -p $(PACKAGE_INSTALL_DIR) ; \
711 $(if $($(PACKAGE)_pre_install),$($(PACKAGE)_pre_install),true); \
712 $(if $($(PACKAGE)_install), \
713 $($(PACKAGE)_install), \
715 $($(PACKAGE)_install_args) \
717 $(if $($(PACKAGE)_post_install),$($(PACKAGE)_post_install),true)
719 install_check_timestamp = \
721 inst=$(TIMESTAMP_DIR)/$(INSTALL_TIMESTAMP) ; \
722 dirs="$(PACKAGE_BUILD_DIR) \
723 $($(PACKAGE)_install_dependencies)" ; \
724 if [[ $(call find_newer_fn, $${inst}, $${dirs}, $?) ]]; then \
725 $(call build_msg_fn,Installing $(PACKAGE)) ; \
726 $(install_package) ; \
729 $(call build_msg_fn,Installing $(PACKAGE): nothing to do) ; \
734 $(install_check_timestamp)
736 ######################################################################
737 # Source code managment
738 ######################################################################
742 # Maps package name to source directory root.
743 # Multiple packages may use a single source tree.
744 # For example, gcc-bootstrap package shares gcc source.
745 PACKAGE_SOURCE = $(if $($(PACKAGE)_source),$($(PACKAGE)_source),$(PACKAGE))
746 PACKAGE_SUBDIR = $(if $($(PACKAGE)_configure_subdir),/$($(PACKAGE)_configure_subdir),)
748 # Use git to download source if directory is not found
749 find_source_for_package = \
751 $(call build_msg_fn,Arch for platform '$(PLATFORM)' is $(ARCH)) ; \
752 $(call build_msg_fn,Finding source for $(PACKAGE)) ; \
753 s="$(call find_source_fn,$(PACKAGE_SOURCE))" ; \
755 && $(call build_msg_fn,Package $(PACKAGE) not found with path $(SOURCE_PATH)) \
757 mk="$(call find_build_data_dir_for_package_fn,$(PACKAGE_SOURCE))/packages/$(PACKAGE).mk"; \
758 $(call build_msg_fn,Makefile fragment found in $${mk}) ; \
759 if [ ! -d "$${s}" ] ; then \
760 d=`dirname $${mk}` ; \
761 i=`cd $${d}/.. && ($(GIT) config remote.origin.url || \
762 awk '/URL/ { print $$2; }' .git/remotes/origin)`; \
763 g=`dirname $${i}` ; \
764 $(call build_msg_fn,Fetching source: $(GIT) clone $${g}/$(PACKAGE_SOURCE) $$s) ; \
765 if ! $(GIT) clone $${g}/$(PACKAGE_SOURCE) $$s; then \
766 $(call build_msg_fn,No source for $(PACKAGE) in $${g}); \
769 $(call build_msg_fn,Fix file dates in $${g}/$(PACKAGE_SOURCE)) ; \
770 (cd $${s} ; $(MU_BUILD_ROOT_DIR)/autowank --touch) ; \
772 s=`cd $${s} && pwd` ; \
773 $(call build_msg_fn,Source found in $${s})
775 .PHONY: %-find-source
777 $(find_source_for_package)
779 .PHONY: %-push %-pull %-push-all %-pull-all
780 %-push %-pull %-push-all %-pull-all:
782 push_or_pull=$(patsubst %-all,%,$(subst $(PACKAGE)-,,$@)) ; \
783 $(call build_msg_fn,Git $${push_or_pull} source for $(PACKAGE)) ; \
784 s=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \
785 if [ "x$$s" = "x" ]; then \
786 $(call build_msg_fn,No source for $(PACKAGE)) ; \
789 cd $$s && $(GIT) $${push_or_pull}
791 # Pull all packages for platform
795 $(call build_msg_fn,Git pull build system) ; \
796 for d in $(MU_BUILD_ROOT_DIR) \
797 $(SOURCE_PATH_BUILD_ROOT_DIRS) \
798 $(SOURCE_PATH_BUILD_DATA_DIRS); do \
799 $(call build_msg_fn,Git pull $${d}) ; \
800 pushd $${d} >& /dev/null && $(GIT) pull && popd >& /dev/null ; \
802 $(call build_msg_fn,Git pull build tools) ; \
803 $(call tool_make_target_fn,pull-all) ; \
804 $(call build_msg_fn,Git pull packages for platform $(PLATFORM)) ; \
805 make PLATFORM=$(PLATFORM) $(patsubst %,%-pull-all,$(ROOT_PACKAGES))
810 d=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \
811 $(call build_msg_fn,Git diff $(PACKAGE)) ; \
812 if [ -d $${d}/.git ] ; then \
813 cd $${d} && $(GIT) --no-pager diff 2>/dev/null; \
815 $(call build_msg_fn, $(PACKAGE) not a git directory) ; \
820 # generate diffs for everything in source path
824 $(call build_msg_fn,Generate diffs) ; \
825 for r in $(ABSOLUTE_SOURCE_PATH); do \
826 for d in $${r}/* ; do \
827 if [ -d $${d} ] ; then \
828 $(call build_msg_fn,Git diff $${d}) ; \
829 if [ -d $${d}/.git ] ; then \
830 cd $${d} && $(GIT) --no-pager diff 2>/dev/null; \
832 $(call build_msg_fn, $${d} not a git directory) ; \
838 ######################################################################
840 ######################################################################
842 IMAGE_DIR = $(MU_BUILD_ROOT_DIR)/image-$(PLATFORM)
844 # Reports shared libraries in given directory
845 find_shared_libs_fn = \
848 -regex '.*/lib[a-z0-9_]+\+?\+?.so' \
849 -o -regex '.*/lib[a-z0-9_]+-[0-9.]+\+?\+?.so' \
850 -o -regex '.*/lib[a-z0-9_]+\+?\+?.so.[0-9.]+'
852 # By default pick up files from binary directories and /etc.
853 # Also include shared libraries.
854 DEFAULT_IMAGE_INCLUDE = \
855 for d in bin sbin libexec \
856 usr/bin usr/sbin usr/libexec \
858 [[ -d $$d ]] && echo $$d; \
860 [[ -d $(arch_lib_dir) ]] \
861 && $(call find_shared_libs_fn,$(arch_lib_dir))
863 # Define any shell functions needed by install scripts
864 image_install_functions = \
865 $(foreach p,$(ALL_PACKAGES), \
866 $(if $($(p)_image_install_functions), \
867 $($(p)_image_install_functions)))
869 # Should always be over-written by temp dir in %-root-image rule
870 IMAGE_INSTALL_DIR = $(error you need to set IMAGE_INSTALL_DIR)
874 $(call build_msg_fn,Image-install $(1) for platform $(PLATFORM)) ; \
875 inst_dir=$(IMAGE_INSTALL_DIR) ; \
876 mkdir -p $${inst_dir} ; \
878 : select files to include in image ; \
879 image_include_files=" \
880 `$(call ifdef_fn,$(1)_image_include,$(DEFAULT_IMAGE_INCLUDE)) ; \
883 : select files regexps to exclude from image ; \
884 image_exclude_files="" ; \
885 if [ ! -z "$($(1)_image_exclude)" ] ; then \
886 image_exclude_files="${image_exclude_files} \
887 $(patsubst %,--exclude=%,$($(1)_image_exclude))" ; \
889 [[ -z "$${image_include_files}" || $${image_include_files} == " " ]] \
890 || tar cf - $${image_include_files} $${image_exclude_files} \
891 | tar xf - -C $${inst_dir} ; \
892 : copy files from copyimg directories on source path if present ; \
893 for build_data_dir in $(SOURCE_PATH_BUILD_DATA_DIRS) ; do \
894 d="$${build_data_dir}/packages/$(1).copyimg" ; \
895 if [ -d "$${d}" ] ; then \
896 env $($(PLATFORM)_copyimg_env) \
897 $(MU_BUILD_ROOT_DIR)/copyimg $${d} $${inst_dir} ; \
900 : run package dependent install script ; \
901 $(if $($(1)_image_install), \
902 $(image_install_functions) \
904 $($(1)_image_install))
906 .PHONY: %-image_install
907 %-image_install: %-install
908 $(call image_install_fn,$(PACKAGE),$(PACKAGE_INSTALL_DIR))
910 basic_system_image_include = \
911 $(call ifdef_fn,$(PLATFORM)_basic_system_image_include, \
913 echo $(arch_lib_dir)/ld*.so* ; \
914 $(call find_shared_libs_fn, $(arch_lib_dir)))
916 basic_system_image_install = \
917 mkdir -p bin lib mnt proc root sbin sys tmp etc ; \
918 mkdir -p usr usr/{bin,sbin} usr/lib ; \
919 mkdir -p var var/{lib,lock,log,run,tmp} ; \
920 mkdir -p var/lock/subsys var/lib/urandom
922 .PHONY: basic_system-image_install
923 basic_system-image_install: # linuxrc-install
924 $(if $(not_native), \
925 $(call image_install_fn,basic_system,$(TARGET_TOOL_INSTALL_DIR)),)
927 ROOT_PACKAGES = $(if $($(PLATFORM)_root_packages),$($(PLATFORM)_root_packages),$(default_root_packages))
929 .PHONY: install-packages
930 install-packages: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
932 set -eu$(BUILD_DEBUG) ; \
933 d=$(MU_BUILD_ROOT_DIR)/packages-$(PLATFORM) ; \
936 $(MAKE) -C $(MU_BUILD_ROOT_DIR) IMAGE_INSTALL_DIR=$${d} \
937 $(patsubst %,%-image_install, \
939 $(ROOT_PACKAGES)) || exit 1; \
940 $(call build_msg_fn, Relocating ELF executables to run in $${d}) ; \
941 scripts/set-rpath $${d} $${d}/$(arch_lib_dir) ; \
942 : strip symbols from files ; \
943 if [ $${strip_symbols:-no} = 'yes' ] ; then \
944 $(call build_msg_fn, Stripping symbols from files) ; \
947 $(TARGET_PREFIX)strip \
948 --strip-unneeded '{}' ';' \
951 $(call build_msg_fn, NOT stripping symbols) ; \
954 # readonly root squashfs image
955 # Note: $(call build_msg_fn) does not seem to work inside of fakeroot so we use echo
957 $(PLATFORM_IMAGE_DIR)/ro.img ro-image: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
959 d=$(PLATFORM_IMAGE_DIR) ; \
961 ro_image=$$d/ro.img ; \
962 rm -f $${ro_image} ; \
963 tmp_dir="`mktemp -d $$d/ro-image-XXXXXX`" ; \
964 chmod 0755 $${tmp_dir} ; \
966 trap "rm -rf $${tmp_dir}" err ; \
967 fakeroot /bin/bash -c "{ \
968 set -eu$(BUILD_DEBUG) ; \
969 $(MAKE) -C $(MU_BUILD_ROOT_DIR) IMAGE_INSTALL_DIR=$${tmp_dir} \
970 $(patsubst %,%-image_install, \
972 $(ROOT_PACKAGES)) ; \
973 : make dev directory ; \
974 $(linuxrc_makedev) ; \
975 echo @@@@ Relocating ELF executables to run in / @@@@ ; \
976 scripts/set-rpath /$(arch_lib_dir):/lib ; \
977 : strip symbols from files ; \
978 if [ '$${strip_symbols:-yes}' = 'yes' ] ; then \
979 echo @@@@ Stripping symbols from files @@@@ ; \
980 find $${tmp_dir} -type f \
982 $(TARGET_PREFIX)strip \
983 --strip-unneeded '{}' ';' \
986 echo @@@@ NOT stripping symbols @@@@ ; \
988 if [ $${sign_executables:-yes} = 'yes' \
989 -a -n "$($(PLATFORM)_public_key)" ] ; then \
990 echo @@@@ Signing executables @@@@ ; \
991 find $${tmp_dir} -type f \
992 | xargs sign $($(PLATFORM)_public_key) \
993 $($(PLATFORM)_private_key_passphrase) ; \
995 : make read-only file system ; \
997 $${tmp_dir} $${ro_image} \
998 -no-exports -no-progress -no-recovery ; \
1000 : cleanup tmp directory ; \
1003 MKFS_JFFS2_BYTE_ORDER_x86_64 = -l
1004 MKFS_JFFS2_BYTE_ORDER_i686 = -l
1005 MKFS_JFFS2_BYTE_ORDER_ppc = -b
1006 MKFS_JFFS2_BYTE_ORDER_mips = -b
1007 MKFS_JFFS2_BYTE_ORDER_native = $(MKFS_JFFS2_BYTE_ORDER_$(NATIVE_ARCH))
1009 MKFS_JFFS2_SECTOR_SIZE_IN_KBYTES = \
1010 $(call ifdef_fn,$(PLATFORM)_jffs2_sector_size_in_kbytes,256)
1012 mkfs_fn_jffs2 = mkfs.jffs2 \
1013 --eraseblock=$(MKFS_JFFS2_SECTOR_SIZE_IN_KBYTES)KiB \
1014 --root=$(1) --output=$(2) \
1015 $(MKFS_JFFS2_BYTE_ORDER_$(BASIC_ARCH))
1017 # As things stand the actual initrd size parameter
1018 # is set in .../open-repo/build-data/packages/linuxrc.mk.
1019 EXT2_RW_IMAGE_SIZE=notused
1022 e2fsimage -d $(1) -f $(2) -s $(EXT2_RW_IMAGE_SIZE)
1026 make_rw_image_fn = \
1027 $(call mkfs_fn_$(RW_IMAGE_TYPE),$(1),$(2))
1029 rw_image_embed_ro_image_fn = \
1030 mkdir -p proc initrd images ro rw union ; \
1031 cp $(PLATFORM_IMAGE_DIR)/$(1) images/$(1) ; \
1032 md5sum images/$(1) > images/$(1).md5 ; \
1033 echo Built by $(LOGNAME) at `date` > images/$(1).stamp ; \
1034 mkdir -p changes/$(1)
1036 # make sure RW_IMAGE_TYPE is a type we know how to build
1037 .PHONY: rw-image-check-type
1038 rw-image-check-type:
1040 if [ -z "$(make_rw_image_fn)" ] ; then \
1041 $(call build_msg_fn,Unknown read/write fs image type; \
1042 try RW_IMAGE_TYPE=ext2 or RW_IMAGE_TYPE=jffs2) ; \
1048 rw-image: rw-image-check-type ro-image
1050 d=$(PLATFORM_IMAGE_DIR) ; \
1052 rw_image="$$d/rw.$(RW_IMAGE_TYPE)" ; \
1053 ro_image="ro.img" ; \
1054 rm -f $$rw_image ; \
1055 tmp_dir="`mktemp -d $$d/rw-image-XXXXXX`" ; \
1056 chmod 0755 $${tmp_dir} ; \
1058 trap "rm -rf $${tmp_dir}" err ; \
1059 fakeroot /bin/bash -c "{ \
1060 set -eu$(BUILD_DEBUG) ; \
1061 $(linuxrc_makedev) ; \
1062 $(call rw_image_embed_ro_image_fn,$${ro_image}) ; \
1063 $(call make_rw_image_fn,$${tmp_dir},$${rw_image}) ; \
1065 : cleanup tmp directory ; \
1068 images: linuxrc-install linux-install $(image_extra_dependencies) rw-image
1070 d=$(PLATFORM_IMAGE_DIR) ; \
1071 cd $(BUILD_DIR)/linux-$(PLATFORM) ; \
1073 [[ -z $$i && -f bzImage ]] && i=bzImage ; \
1074 [[ -z $$i && -f zImage ]] && i=zImage ; \
1075 [[ -z $$i && -f linux ]] && i=linux ; \
1076 [[ -z $$i && -f vmlinux ]] && i=vmlinux ; \
1078 && $(call build_msg_fn,no linux image to install \
1079 in $(BUILD_DIR)/linux-$(PLATFORM)) \
1083 ######################################################################
1084 # Tool chain build/install
1085 ######################################################################
1087 .PHONY: ccache-install
1089 $(MAKE) -C $(MU_BUILD_ROOT_DIR) ccache-build
1090 mkdir -p $(TOOL_INSTALL_DIR)/ccache-bin
1091 ln -sf $(MU_BUILD_ROOT_DIR)/build-tool-native/ccache/ccache \
1092 $(TOOL_INSTALL_DIR)/ccache-bin/$(TARGET_PREFIX)gcc
1094 TOOL_MAKE = $(MAKE) is_build_tool=yes
1096 tool_make_target_fn = \
1097 $(if $(strip $(NATIVE_TOOLS)), \
1098 $(TOOL_MAKE) $(patsubst %,%-$(1),$(NATIVE_TOOLS)) ARCH=native || exit 1 ;) \
1099 $(TOOL_MAKE) $(patsubst %,%-$(1),$(CROSS_TOOLS))
1101 .PHONY: install-tools
1103 $(call tool_make_target_fn,install)
1105 .PHONY: bootstrap-tools
1107 $(TOOL_MAKE) make-install findutils-install git-install \
1108 automake-install autoconf-install libtool-install fakeroot-install
1111 ######################################################################
1113 ######################################################################
1115 package_clean_script = \
1116 @$(call build_msg_fn, Cleaning $* in $(PACKAGE_INSTALL_DIR)) ; \
1118 $(if $(is_build_tool),,rm -rf $(PACKAGE_INSTALL_DIR) ;) \
1119 rm -rf $(TIMESTAMP_DIR)/$(call timestamp_name_fn,*) ; \
1120 $(if $($(PACKAGE)_clean), \
1121 $($(PACKAGE)_clean), \
1122 $(PACKAGE_MAKE) clean)
1126 $(package_clean_script)
1128 # Wipe e.g. remove build and install directories for packages.
1129 package_wipe_script = \
1130 @message=$(if $(is_build_tool),"Wiping build $(PACKAGE)","Wiping build/install $(PACKAGE)") ; \
1131 $(call build_msg_fn,$$message) ; \
1133 rm -rf $(if $(is_build_tool),$(PACKAGE_BUILD_DIR),$(PACKAGE_INSTALL_DIR) $(PACKAGE_BUILD_DIR))
1137 $(package_wipe_script)
1139 # Wipe entire build/install area for TAG and PLATFORM
1142 @$(call build_msg_fn, Wiping $(BUILD_DIR) $(INSTALL_DIR)) ; \
1144 rm -rf $(BUILD_DIR) $(INSTALL_DIR)
1148 rm -rf $(MU_BUILD_ROOT_DIR)/$(BUILD_PREFIX_package)*/
1149 rm -rf $(MU_BUILD_ROOT_DIR)/$(BUILD_PREFIX_tool)*
1150 rm -rf $(MU_BUILD_ROOT_DIR)/$(INSTALL_PREFIX)*
1151 rm -rf $(MU_BUILD_ROOT_DIR)/$(IMAGES_PREFIX)*
1152 rm -rf $(TOOL_INSTALL_DIR)
1153 rm -rf $(MU_BUILD_ROOT_DIR)/*.deb
1154 rm -rf $(MU_BUILD_ROOT_DIR)/*.rpm
1155 rm -rf $(MU_BUILD_ROOT_DIR)/*.changes
1156 rm -rf $(MU_BUILD_ROOT_DIR)/python
1157 if [ -e /usr/bin/dh ];then (cd $(MU_BUILD_ROOT_DIR)/deb/;debian/rules clean); fi
1158 rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.install
1159 rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/changelog