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.
168 x86_64_libdir = $(BIARCH)
169 native_libdir = $($(NATIVE_ARCH)_libdir)
171 # lib or lib64 depending
172 arch_lib_dir = lib$($(BASIC_ARCH)_libdir)
174 # OS to configure for. configure --host will be set to $(ARCH)-$(OS)
175 # Allow per-platform overrides
177 OS = $(strip $($(PLATFORM)_os))
185 is_native = $(if $(ARCH:native=),,true)
186 not_native = $(if $(ARCH:native=),true,)
188 ARCH_TARGET_tmp = $(call ifdef_fn,$(ARCH)_target,$(ARCH)-$(OS))
189 TARGET = $(call ifdef_fn,$(PLATFORM)_target,$(ARCH_TARGET_tmp))
190 TARGET_PREFIX = $(if $(not_native),$(TARGET)-,)
192 # CPU microarchitecture detection.
193 # Either set <platform>_march in build-data/platforms/<platform>.mk,
194 # or detect and use the build-host instruction set
196 MARCH = $(strip $($(PLATFORM)_march))
198 ifneq ($(wildcard $(TOOL_INSTALL_DIR)/bin/$(TARGET)-gcc),)
199 TARGET_GCC = $(TOOL_INSTALL_DIR)/bin/$(TARGET)-gcc
200 else ifneq ($(wildcard $(MU_BUILD_ROOT_DIR)/tools/bin/$(TARGET)-gcc),)
201 TARGET_GCC = $(MU_BUILD_ROOT_DIR)/tools/bin/$(TARGET)-gcc
203 ifneq ($(TARGET_GCC),)
204 MARCH = $(shell $(TARGET_GCC) -Q --help=target -march=native | grep march | sed -e 's/.*march=[[:space:]]*//')
209 ifeq ($(MARCH),nehalem)
210 override MARCH = corei7
211 else ifeq ($(MARCH),westmere)
212 override MARCH = corei7
213 else ifeq ($(MARCH),sandybridge)
214 override MARCH = corei7-avx
215 else ifeq ($(MARCH),ivybridge)
216 override MARCH = core-avx-i
217 else ifeq ($(MARCH),haswell)
218 override MARCH = core-avx2
223 ######################################################################
224 # Generic build stuff
225 ######################################################################
227 # The package we are currently working on
230 # Build/install tags. This lets you have different CFLAGS/CPPFLAGS/LDFLAGS
231 # for e.g. debug versus optimized compiles. Each tag has its own set of build/install
234 TAG_PREFIX = $(if $(TAG),$(TAG)-)
236 # yes you need the space
237 tag_var_with_added_space_fn = $(if $($(TAG)_TAG_$(1)),$($(TAG)_TAG_$(1)) )
239 # TAG=debug for debugging
240 debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH)
241 debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH)
243 # TAG=prof for profiling
244 prof_TAG_CFLAGS = -g -pg -O2
245 prof_TAG_LDFLAGS = -g -pg -O2
248 o0_TAG_CFLAGS = -g -O0
249 o1_TAG_LDFLAGS = -g -O0
252 o1_TAG_CFLAGS = -g -O1
253 o1_TAG_LDFLAGS = -g -O1
256 o2_TAG_CFLAGS = -g -O2
257 o2_TAG_LDFLAGS = -g -O2
260 o3_TAG_CFLAGS = -g -O3
261 o3_TAG_LDFLAGS = -g -O3
263 BUILD_PREFIX_package = build-$(TAG_PREFIX)
264 BUILD_PREFIX_tool = build-tool-$(TAG_PREFIX)
265 INSTALL_PREFIX = install-$(TAG_PREFIX)
266 IMAGES_PREFIX = images-$(TAG_PREFIX)
268 # Whether we are building a tool or not
269 tool_or_package_fn = $(if $(is_build_tool),tool,package)
271 # Directory where packages are built & installed
272 BUILD_DIR = $(MU_BUILD_ROOT_DIR)/$(BUILD_PREFIX_$(call tool_or_package_fn))$(ARCH)
275 # we will deprecate INSTALL_DIR shortly for DFLT_INSTALL_DIR
276 INSTALL_DIR = $(MU_BUILD_ROOT_DIR)/$(INSTALL_PREFIX)$(ARCH)
277 # DFLT_INSTALL_DIR used in platforms.mk for $(PLATFORM)_DESTDIR_BASE
278 DFLT_INSTALL_DIR := $(MU_BUILD_ROOT_DIR)/$(INSTALL_PREFIX)$(ARCH)
281 PLATFORM_IMAGE_DIR = $(MU_BUILD_ROOT_DIR)/$(IMAGES_PREFIX)$(PLATFORM)
283 # $(call VAR,DEFAULT)
284 override_var_with_default_fn = $(if $($(1)),$($(1)),$(2))
286 # $(call if_directory_exists_fn,D1,D2) returns D1 if it exists else D2
287 define if_directory_exists_fn
288 $(shell if test -d $(1); then echo $(1); else echo $(2); fi)
291 # $(call if_file_exists_fn,F1,F2) returns F1 if it exists else F2
292 define if_file_exists_fn
293 $(shell if test -f $(1); then echo $(1); else echo $(2); fi)
296 # Default VAR, package specified override of default PACKAGE_VAR
297 package_var_fn = $(call override_var_with_default_fn,$(1)_$(2),$(1))
299 package_build_dir_fn = $(call package_var_fn,$(1),build_dir)
301 package_install_dir_fn = \
302 $(if $(is_build_tool),$(TOOL_INSTALL_DIR),$(INSTALL_DIR)/$(call package_build_dir_fn,$(1)))
304 PACKAGE_BUILD_DIR = \
305 $(BUILD_DIR)/$(call package_build_dir_fn,$(PACKAGE))
306 PACKAGE_INSTALL_DIR = \
307 $(call package_install_dir_fn,$(PACKAGE))
309 # Tools (gcc, binutils, glibc...) are installed here
310 TOOL_INSTALL_DIR = $(MU_BUILD_ROOT_DIR)/tools
312 # Target specific tools go here e.g. mu-build/tools/ppc-mu-linux
313 TARGET_TOOL_INSTALL_DIR = $(TOOL_INSTALL_DIR)/$(TARGET)
315 # Set BUILD_DEBUG to vx or x enable shell command tracing.
318 # Message from build system itself (as opposed to make or shell commands)
319 build_msg_fn = echo "@@@@ $(1) @@@@"
321 # Always prefer our own tools to those installed on system.
322 # Note: ccache-bin must be before tool bin.
324 export CCACHE_DIR=$(MU_BUILD_ROOT_DIR)/.ccache ; \
325 export PATH=$(TOOL_INSTALL_DIR)/ccache-bin:$(TOOL_INSTALL_DIR)/bin:$${PATH} ; \
326 export PATH="`echo $${PATH} | sed -e s/[.]://`" ; \
327 $(if $(not_native),export CONFIG_SITE=$(MU_BUILD_ROOT_DIR)/config.site ;,) \
328 export LD_LIBRARY_PATH=$(TOOL_INSTALL_DIR)/lib64:$(TOOL_INSTALL_DIR)/lib ; \
329 set -eu$(BUILD_DEBUG) ; \
332 ######################################################################
333 # Package build generic definitions
334 ######################################################################
337 $(call find_build_data_dir_for_package_fn,$(1))/packages
339 package_mk_fn = $(call package_dir_fn,$(1))/$(1).mk
344 #pkgPhaseDependMacro = $(foreach x,configure build install, \
345 $(eval $(1)_$(x)_depend := $($(1)_depend:%=%-$(x))))
346 #version equivalent to original code
347 pkgPhaseDependMacro = $(eval $(1)_configure_depend := $($(1)_depend:%=%-install))
351 # Pick up built-root/pre-package-include.mk for all source directories
352 $(foreach d,$(SOURCE_PATH_BUILD_ROOT_DIRS), \
353 $(eval -include $(d)/pre-package-include.mk))
355 $(foreach d,$(addsuffix /packages,$(FIND_SOURCE_PATH)), \
356 $(eval -include $(d)/*.mk) \
357 $(eval ALL_PACKAGES += $(patsubst $(d)/%.mk,%,$(wildcard $(d)/*.mk))) \
360 # Pick up built-root/post-package-include.mk for all source directories
361 $(foreach d,$(SOURCE_PATH_BUILD_ROOT_DIRS), \
362 $(eval -include $(d)/post-package-include.mk))
364 # Linux specific native build tools
365 NATIVE_TOOLS_LINUX = \
375 IS_LINUX = $(if $(findstring no,$($(PLATFORM)_uses_linux)),no,yes)
377 NATIVE_TOOLS_$(IS_LINUX) += $(NATIVE_TOOLS_LINUX)
379 # only build glibc for linux installs
380 CROSS_TOOLS_$(IS_LINUX) += glibc gcc
382 # must be first for bootstrapping
383 NATIVE_TOOLS = findutils make
385 # basic tools needed for build system
386 NATIVE_TOOLS += git automake autoconf libtool texinfo bison flex tar
388 # needed to compile gcc
389 NATIVE_TOOLS += mpfr gmp mpc
391 # Tool to sign binaries
395 NATIVE_TOOLS += ccache
397 # Tools needed on native host to build for platform
398 NATIVE_TOOLS += $(call ifdef_fn,$(PLATFORM)_native_tools,)
400 # Tools for cross-compiling from native -> ARCH
401 CROSS_TOOLS = binutils gcc-bootstrap gdb
403 # Tools needed on native host to build for platform
404 CROSS_TOOLS += $(call ifdef_fn,$(PLATFORM)_cross_tools,)
406 NATIVE_TOOLS += $(NATIVE_TOOLS_yes)
407 CROSS_TOOLS += $(CROSS_TOOLS_yes)
409 timestamp_name_fn = .mu_build_$(1)_timestamp
410 CONFIGURE_TIMESTAMP = $(call timestamp_name_fn,configure)
411 BUILD_TIMESTAMP = $(call timestamp_name_fn,build)
412 INSTALL_TIMESTAMP = $(call timestamp_name_fn,install)
414 TIMESTAMP_DIR = $(PACKAGE_BUILD_DIR)
416 find_newer_files_fn = \
417 "`for i in $(2) ; do \
418 [[ -f $$i && $$i -nt $(1) ]] && echo "$$i" && exit 0; \
422 find_filter = -not -name '*~'
423 find_filter += -and -not -path '*/.git*'
424 find_filter += -and -not -path '*/.svn*'
425 find_filter += -and -not -path '*/.CVS*'
426 find_filter += -and -not -path '*/manual/*'
427 find_filter += -and -not -path '*/autom4te.cache/*'
428 find_filter += -and -not -path '*/doc/all-cfg.texi'
429 find_filter += -and -not -path '*/.mu_build_*'
431 find_newer_filtered_fn = \
433 || -n $(call find_newer_files_fn,$(1),$(3)) \
434 || -n "`find -H $(2) \
441 $(call find_newer_filtered_fn,$(1),$(2),$(3),$(find_filter))
443 ######################################################################
444 # Package dependencies
445 ######################################################################
447 # This must come before %-configure, %-build, %-install pattern rules
448 # or else dependencies will not work.
450 package_dependencies_fn = \
451 $(patsubst %-install, %, \
452 $(filter %-install,$($(1)_configure_depend)))
454 PACKAGE_DEPENDENCIES = $(call package_dependencies_fn,$(PACKAGE))
456 # package specific configure, build, install dependencies
457 add_package_dependency_fn = \
458 $(if $($(1)_$(2)_depend), \
459 $(eval $(1)-$(2) : $($(1)_$(2)_depend)))
461 $(foreach p,$(ALL_PACKAGES), \
462 $(call add_package_dependency_fn,$(p),configure) \
463 $(call add_package_dependency_fn,$(p),build) \
464 $(call add_package_dependency_fn,$(p),install))
466 TARGETS_RESPECTING_DEPENDENCIES = image_install wipe diff push-all pull-all find-source
468 # carry over packages dependencies to image install, wipe, pull-all, push-all
469 $(foreach p,$(ALL_PACKAGES), \
470 $(if $($(p)_configure_depend), \
471 $(foreach s,$(TARGETS_RESPECTING_DEPENDENCIES), \
473 $(addsuffix -$(s), $(call package_dependencies_fn,$(p)))))))
475 # recursively resolve dependencies
476 resolve_dependencies2_fn = $(strip \
477 $(eval __added = $(filter-out $(4), \
480 $(call ifdef3_fn,$(l)$(1),,$(call $(2),$($(l)$(1)))) \
482 $(eval __known = $(call uniq_fn,$(4) $(3) $(__added))) \
484 $(call resolve_dependencies2_fn,$(1),$(2),$(__added),$(__known)), \
488 resolve_dependencies_null_fn = $(1)
490 resolve_dependencies_fn = $(call resolve_dependencies2_fn,$(1),resolve_dependencies_null_fn,$(2))
492 ######################################################################
494 ######################################################################
496 # x86_64 can be either 32/64. set BIACH=32 to get 32 bit libraries.
499 x86_64_libdir = $(BIARCH)
500 native_libdir = $($(NATIVE_ARCH)_libdir)
502 # lib or lib64 depending
503 arch_lib_dir = lib$($(BASIC_ARCH)_libdir)
505 # find dynamic linker as absolute path
506 TOOL_INSTALL_LIB_DIR=$(TOOL_INSTALL_DIR)/$(TARGET)/$(arch_lib_dir)
507 DYNAMIC_LINKER=${shell cd $(TOOL_INSTALL_LIB_DIR); echo ld*.so.*}
509 # Pad dynamic linker & rpath so elftool will never have to change ELF section sizes.
510 # Yes, this is a kludge.
511 lots_of_slashes_to_pad_names = "/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"
513 # When PLATFORM != native we *always* use our own versions of GLIBC and dynamic linker
514 # Allow per-platform overrides
515 CROSS_LDFLAGS = $(strip $($(PLATFORM)_cross_ldflags))
516 ifeq ($(CROSS_LDFLAGS),)
518 -Wl,--dynamic-linker=$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR)/$(DYNAMIC_LINKER) \
519 -Wl,-rpath -Wl,$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR)
522 cross_ldflags = $(if $(is_native)$(is_build_tool),,$(CROSS_LDFLAGS) )
524 # $(call installed_libs_fn,PACKAGE)
525 # Return install library directory for given package.
526 # Some packages (e.g. openssl) don't install under lib64; instead they use lib
527 define installed_lib_fn
528 $(call if_directory_exists_fn,
529 $(call package_install_dir_fn,$(1))/$(arch_lib_dir),
530 $(call package_install_dir_fn,$(1))/lib)
533 # Set -L and rpath to point to dependent libraries previously built by us.
534 installed_libs_fn = \
536 -L$(call installed_lib_fn,$(i)) \
537 -Wl,-rpath -Wl,$(call installed_lib_fn,$(i)))
539 # As above for include files
540 installed_include_fn = $(call package_install_dir_fn,$(1))/include
542 installed_includes_fn = $(foreach i,$(1),-I$(call installed_include_fn,$(i)))
544 # By default package CPPFLAGS (to set include path -I) and LDFLAGS (to set link path -L)
545 # point at dependent install directories.
546 DEFAULT_CPPFLAGS = $(call installed_includes_fn, $(PACKAGE_DEPENDENCIES))
547 DEFAULT_LDFLAGS = $(call installed_libs_fn, $(PACKAGE_DEPENDENCIES))
550 $(call tag_var_with_added_space_fn,$(1))$(call override_var_with_default_fn,$(PACKAGE)_$(1),$(DEFAULT_$(1)))
551 configure_ldflags_fn = \
552 $(cross_ldflags)$(call configure_var_fn,LDFLAGS)
554 # Allow packages to override CPPFLAGS, CFLAGS, and LDFLAGS
556 $(if $(call configure_var_fn,CPPFLAGS), \
557 CPPFLAGS="$(CPPFLAGS) $(call configure_var_fn,CPPFLAGS)") \
558 $(if $(call configure_var_fn,CFLAGS), \
559 CFLAGS="$(CFLAGS) $(call configure_var_fn,CFLAGS)") \
560 $(if $(call configure_var_fn,CCASFLAGS), \
561 CCASFLAGS="$(CCASFLAGS) $(call configure_var_fn,CCASFLAGS)") \
562 $(if $(call configure_ldflags_fn), \
563 LDFLAGS="$(LDFLAGS) $(call configure_ldflags_fn)") \
564 $(if $($(PACKAGE)_configure_env),$($(PACKAGE)_configure_env))
567 # only partially used now (used in a few .mk files)
568 ifeq ($(is_build_tool),yes)
569 prefix = $(PACKAGE_INSTALL_DIR)
570 libdir = $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)
571 libexecdir = $(PACKAGE_INSTALL_DIR)/usr/libexec
574 # Eventually simplify this with no per package DESTDIR or prefix
575 ppdMacro = $(if $(PER_PACKAGE_DESTDIR),$(call package_build_dir_fn,$(1)))
576 pppMacro = $(if $(PER_PACKAGE_PREFIX),$(call package_build_dir_fn,$(1)))
577 prefixMacro = $($(PLATFORM)_PREFIX_BASE)/$(pppMacro)
578 prefix = $(call prefixMacro,$(PACKAGE))
579 libdir = $($(PLATFORM)_LIBDIR)
580 libexecdir = $($(PLATFORM)_LIBEXECDIR)
581 destdirMacro = $($(PLATFORM)_DESTDIR_BASE)$(ppdMacro)
582 DESTDIR = $(call destdirMacro,$(PACKAGE))
586 image_extra_dependencies = $($(PLATFORM)_image_extra_dependencies)
589 configure_package_gnu = \
590 s=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \
591 if [ ! -f $$s/configure ] ; then \
592 autoreconf -i -f $$s ; \
594 cd $(PACKAGE_BUILD_DIR) ; \
595 env $(CONFIGURE_ENV) \
597 $(if $($(PACKAGE)_configure_host_and_target), \
598 $($(PACKAGE)_configure_host_and_target), \
599 $(if $(not_native),--host=$(TARGET),)) \
600 $(if $($(PACKAGE)_configure_prefix), \
601 $($(PACKAGE)_configure_prefix), \
602 --libdir=$(PACKAGE_INSTALL_DIR)/$(arch_lib_dir) \
603 --prefix=$(PACKAGE_INSTALL_DIR)) \
604 $($(PACKAGE)_configure_args) \
605 $($(PACKAGE)_configure_args_$(PLATFORM))
607 configure_package = \
608 $(call build_msg_fn,Configuring $(PACKAGE) in $(PACKAGE_BUILD_DIR)) ; \
609 mkdir -p $(PACKAGE_BUILD_DIR) ; \
610 $(if $($(PACKAGE)_configure), \
611 $($(PACKAGE)_configure), \
612 $(configure_package_gnu))
614 # Tools (e.g. gcc, binutils, gdb) required a platform to build for
616 is_tool="$(is_build_tool)" ; \
617 is_cross_package="$(findstring $(PACKAGE),$(CROSS_TOOLS))" ; \
618 is_arch_native="$(if $(subst native,,$(ARCH)),,yes)" ; \
619 if [ "$${is_tool}" == "yes" \
620 -a "$${is_cross_package}" != "" \
621 -a "$${is_arch_native}" != "" ]; then \
622 $(call build_msg_fn,You must specify PLATFORM for building tools) ; \
625 : check that platform gcc can be found ; \
627 if [ "$${is_arch_native}" != "yes" ] ; then \
628 target_gcc=$(TARGET)-gcc ; \
630 if [ "$${is_tool}" != "yes" \
631 -a "$${is_arch_native}" != "yes" \
632 -a ! -x "`which 2> /dev/null $${target_gcc}`" ] ; then \
633 $(call build_msg_fn, \
634 No cross-compiler found for platform $(PLATFORM) target $(TARGET); \
635 try make PLATFORM=$(PLATFORM) install-tools) ; \
639 configure_check_timestamp = \
641 $(check_platform) ; \
642 mkdir -p $(PACKAGE_BUILD_DIR) ; \
643 mkdir -p $(PACKAGE_INSTALL_DIR) ; \
644 conf="$(TIMESTAMP_DIR)/$(CONFIGURE_TIMESTAMP)" ; \
645 dirs="$(call package_mk_fn,$(PACKAGE)) \
646 $(wildcard $(call find_source_fn,$(PACKAGE_SOURCE))/configure) \
647 $(MU_BUILD_ROOT_DIR)/config.site" ; \
648 if [[ $(call find_newer_fn, $${conf}, $${dirs}, $?) ]]; then \
649 $(configure_package) ; \
652 $(call build_msg_fn,Configuring $(PACKAGE): nothing to do) ; \
656 %-configure: %-find-source
657 $(configure_check_timestamp)
659 ######################################################################
661 ######################################################################
663 linux_n_cpus = `grep '^processor' /proc/cpuinfo | wc -l`
665 MAKE_PARALLEL_JOBS = \
667 if [ -f /proc/cpuinfo ] ; then \
668 expr 4 '*' $(linux_n_cpus) ; \
673 MAKE_PARALLEL_FLAGS = $(if $($(PACKAGE)_make_parallel_fails),,$(MAKE_PARALLEL_JOBS))
675 # Make command shorthand for packages & tools.
678 -C $(PACKAGE_BUILD_DIR) \
679 $($(PACKAGE)_make_args) \
680 $(MAKE_PARALLEL_FLAGS)
683 $(call build_msg_fn,Building $* in $(PACKAGE_BUILD_DIR)) ; \
684 mkdir -p $(PACKAGE_BUILD_DIR) ; \
685 cd $(PACKAGE_BUILD_DIR) ; \
686 $(if $($(PACKAGE)_build), \
687 $($(PACKAGE)_build), \
690 build_check_timestamp = \
692 comp="$(TIMESTAMP_DIR)/$(BUILD_TIMESTAMP)" ; \
693 conf="$(TIMESTAMP_DIR)/$(CONFIGURE_TIMESTAMP)" ; \
694 dirs="$(call find_source_fn,$(PACKAGE_SOURCE)) \
695 $($(PACKAGE)_build_timestamp_depends) \
696 $(if $(is_build_tool),,$(addprefix $(INSTALL_DIR)/,$(PACKAGE_DEPENDENCIES)))" ; \
697 if [[ $${conf} -nt $${comp} \
698 || $(call find_newer_fn, $${comp}, $${dirs}, $?) ]]; then \
702 $(call build_msg_fn,Building $(PACKAGE): nothing to do) ; \
707 $(build_check_timestamp)
710 %-rebuild: %-wipe %-build
713 ######################################################################
715 ######################################################################
718 : by default, for non-tools, remove any previously installed bits ; \
719 $(if $(is_build_tool)$($(PACKAGE)_keep_instdir), \
721 rm -rf $(PACKAGE_INSTALL_DIR)); \
722 mkdir -p $(PACKAGE_INSTALL_DIR) ; \
723 $(if $($(PACKAGE)_pre_install),$($(PACKAGE)_pre_install),true); \
724 $(if $($(PACKAGE)_install), \
725 $($(PACKAGE)_install), \
727 $($(PACKAGE)_install_args) \
729 $(if $($(PACKAGE)_post_install),$($(PACKAGE)_post_install),true)
731 install_check_timestamp = \
733 inst=$(TIMESTAMP_DIR)/$(INSTALL_TIMESTAMP) ; \
734 dirs="$(PACKAGE_BUILD_DIR) \
735 $($(PACKAGE)_install_dependencies)" ; \
736 if [[ $(call find_newer_fn, $${inst}, $${dirs}, $?) ]]; then \
737 $(call build_msg_fn,Installing $(PACKAGE)) ; \
738 $(install_package) ; \
741 $(call build_msg_fn,Installing $(PACKAGE): nothing to do) ; \
746 $(install_check_timestamp)
748 ######################################################################
749 # Source code managment
750 ######################################################################
754 # Maps package name to source directory root.
755 # Multiple packages may use a single source tree.
756 # For example, gcc-bootstrap package shares gcc source.
757 PACKAGE_SOURCE = $(if $($(PACKAGE)_source),$($(PACKAGE)_source),$(PACKAGE))
759 # Use git to download source if directory is not found
760 find_source_for_package = \
762 $(call build_msg_fn,Arch for platform '$(PLATFORM)' is $(ARCH)) ; \
763 $(call build_msg_fn,Finding source for $(PACKAGE)) ; \
764 s="$(call find_source_fn,$(PACKAGE_SOURCE))" ; \
766 && $(call build_msg_fn,Package $(PACKAGE) not found with path $(SOURCE_PATH)) \
768 mk="$(call find_build_data_dir_for_package_fn,$(PACKAGE_SOURCE))/packages/$(PACKAGE).mk"; \
769 $(call build_msg_fn,Makefile fragment found in $${mk}) ; \
770 if [ ! -d "$${s}" ] ; then \
771 d=`dirname $${mk}` ; \
772 i=`cd $${d}/.. && ($(GIT) config remote.origin.url || \
773 awk '/URL/ { print $$2; }' .git/remotes/origin)`; \
774 g=`dirname $${i}` ; \
775 $(call build_msg_fn,Fetching source: $(GIT) clone $${g}/$(PACKAGE_SOURCE) $$s) ; \
776 if ! $(GIT) clone $${g}/$(PACKAGE_SOURCE) $$s; then \
777 $(call build_msg_fn,No source for $(PACKAGE) in $${g}); \
780 $(call build_msg_fn,Fix file dates in $${g}/$(PACKAGE_SOURCE)) ; \
781 (cd $${s} ; $(MU_BUILD_ROOT_DIR)/autowank --touch) ; \
783 s=`cd $${s} && pwd` ; \
784 $(call build_msg_fn,Source found in $${s})
786 .PHONY: %-find-source
788 $(find_source_for_package)
790 .PHONY: %-push %-pull %-push-all %-pull-all
791 %-push %-pull %-push-all %-pull-all:
793 push_or_pull=$(patsubst %-all,%,$(subst $(PACKAGE)-,,$@)) ; \
794 $(call build_msg_fn,Git $${push_or_pull} source for $(PACKAGE)) ; \
795 s=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \
796 if [ "x$$s" = "x" ]; then \
797 $(call build_msg_fn,No source for $(PACKAGE)) ; \
800 cd $$s && $(GIT) $${push_or_pull}
802 # Pull all packages for platform
806 $(call build_msg_fn,Git pull build system) ; \
807 for d in $(MU_BUILD_ROOT_DIR) \
808 $(SOURCE_PATH_BUILD_ROOT_DIRS) \
809 $(SOURCE_PATH_BUILD_DATA_DIRS); do \
810 $(call build_msg_fn,Git pull $${d}) ; \
811 pushd $${d} >& /dev/null && $(GIT) pull && popd >& /dev/null ; \
813 $(call build_msg_fn,Git pull build tools) ; \
814 $(call tool_make_target_fn,pull-all) ; \
815 $(call build_msg_fn,Git pull packages for platform $(PLATFORM)) ; \
816 make PLATFORM=$(PLATFORM) $(patsubst %,%-pull-all,$(ROOT_PACKAGES))
821 d=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \
822 $(call build_msg_fn,Git diff $(PACKAGE)) ; \
823 if [ -d $${d}/.git ] ; then \
824 cd $${d} && $(GIT) --no-pager diff 2>/dev/null; \
826 $(call build_msg_fn, $(PACKAGE) not a git directory) ; \
831 # generate diffs for everything in source path
835 $(call build_msg_fn,Generate diffs) ; \
836 for r in $(ABSOLUTE_SOURCE_PATH); do \
837 for d in $${r}/* ; do \
838 if [ -d $${d} ] ; then \
839 $(call build_msg_fn,Git diff $${d}) ; \
840 if [ -d $${d}/.git ] ; then \
841 cd $${d} && $(GIT) --no-pager diff 2>/dev/null; \
843 $(call build_msg_fn, $${d} not a git directory) ; \
849 ######################################################################
851 ######################################################################
853 IMAGE_DIR = $(MU_BUILD_ROOT_DIR)/image-$(PLATFORM)
855 # Reports shared libraries in given directory
856 find_shared_libs_fn = \
859 -regex '.*/lib[a-z0-9_]+\+?\+?.so' \
860 -o -regex '.*/lib[a-z0-9_]+-[0-9.]+\+?\+?.so' \
861 -o -regex '.*/lib[a-z0-9_]+\+?\+?.so.[0-9.]+'
863 # By default pick up files from binary directories and /etc.
864 # Also include shared libraries.
865 DEFAULT_IMAGE_INCLUDE = \
866 for d in bin sbin libexec \
867 usr/bin usr/sbin usr/libexec \
869 [[ -d $$d ]] && echo $$d; \
871 [[ -d $(arch_lib_dir) ]] \
872 && $(call find_shared_libs_fn,$(arch_lib_dir))
874 # Define any shell functions needed by install scripts
875 image_install_functions = \
876 $(foreach p,$(ALL_PACKAGES), \
877 $(if $($(p)_image_install_functions), \
878 $($(p)_image_install_functions)))
880 # Should always be over-written by temp dir in %-root-image rule
881 IMAGE_INSTALL_DIR = $(error you need to set IMAGE_INSTALL_DIR)
885 $(call build_msg_fn,Image-install $(1) for platform $(PLATFORM)) ; \
886 inst_dir=$(IMAGE_INSTALL_DIR) ; \
887 mkdir -p $${inst_dir} ; \
889 : select files to include in image ; \
890 image_include_files=" \
891 `$(call ifdef_fn,$(1)_image_include,$(DEFAULT_IMAGE_INCLUDE)) ; \
894 : select files regexps to exclude from image ; \
895 image_exclude_files="" ; \
896 if [ ! -z "$($(1)_image_exclude)" ] ; then \
897 image_exclude_files="${image_exclude_files} \
898 $(patsubst %,--exclude=%,$($(1)_image_exclude))" ; \
900 [[ -z "$${image_include_files}" || $${image_include_files} == " " ]] \
901 || tar cf - $${image_include_files} $${image_exclude_files} \
902 | tar xf - -C $${inst_dir} ; \
903 : copy files from copyimg directories on source path if present ; \
904 for build_data_dir in $(SOURCE_PATH_BUILD_DATA_DIRS) ; do \
905 d="$${build_data_dir}/packages/$(1).copyimg" ; \
906 if [ -d "$${d}" ] ; then \
907 env $($(PLATFORM)_copyimg_env) \
908 $(MU_BUILD_ROOT_DIR)/copyimg $${d} $${inst_dir} ; \
911 : run package dependent install script ; \
912 $(if $($(1)_image_install), \
913 $(image_install_functions) \
915 $($(1)_image_install))
917 .PHONY: %-image_install
918 %-image_install: %-install
919 $(call image_install_fn,$(PACKAGE),$(PACKAGE_INSTALL_DIR))
921 basic_system_image_include = \
922 $(call ifdef_fn,$(PLATFORM)_basic_system_image_include, \
924 echo $(arch_lib_dir)/ld*.so* ; \
925 $(call find_shared_libs_fn, $(arch_lib_dir)))
927 basic_system_image_install = \
928 mkdir -p bin lib mnt proc root sbin sys tmp etc ; \
929 mkdir -p usr usr/{bin,sbin} usr/lib ; \
930 mkdir -p var var/{lib,lock,log,run,tmp} ; \
931 mkdir -p var/lock/subsys var/lib/urandom
933 .PHONY: basic_system-image_install
934 basic_system-image_install: # linuxrc-install
935 $(if $(not_native), \
936 $(call image_install_fn,basic_system,$(TARGET_TOOL_INSTALL_DIR)),)
938 ROOT_PACKAGES = $(if $($(PLATFORM)_root_packages),$($(PLATFORM)_root_packages),$(default_root_packages))
940 .PHONY: install-packages
941 install-packages: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
943 set -eu$(BUILD_DEBUG) ; \
944 d=$(MU_BUILD_ROOT_DIR)/packages-$(PLATFORM) ; \
947 $(MAKE) -C $(MU_BUILD_ROOT_DIR) IMAGE_INSTALL_DIR=$${d} \
948 $(patsubst %,%-image_install, \
950 $(ROOT_PACKAGES)) || exit 1; \
951 $(call build_msg_fn, Relocating ELF executables to run in $${d}) ; \
953 -exec elftool quiet in '{}' out '{}' \
955 $${d}/$(arch_lib_dir)/$(DYNAMIC_LINKER) \
956 set-rpath $${d}/$(arch_lib_dir):$${d}/lib ';' ; \
957 : strip symbols from files ; \
958 if [ $${strip_symbols:-no} = 'yes' ] ; then \
959 $(call build_msg_fn, Stripping symbols from files) ; \
962 $(TARGET_PREFIX)strip \
963 --strip-unneeded '{}' ';' \
966 $(call build_msg_fn, NOT stripping symbols) ; \
969 # readonly root squashfs image
970 # Note: $(call build_msg_fn) does not seem to work inside of fakeroot so we use echo
972 $(PLATFORM_IMAGE_DIR)/ro.img ro-image: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
974 d=$(PLATFORM_IMAGE_DIR) ; \
976 ro_image=$$d/ro.img ; \
977 rm -f $${ro_image} ; \
978 tmp_dir="`mktemp -d $$d/ro-image-XXXXXX`" ; \
979 chmod 0755 $${tmp_dir} ; \
981 trap "rm -rf $${tmp_dir}" err ; \
982 fakeroot /bin/bash -c "{ \
983 set -eu$(BUILD_DEBUG) ; \
984 $(MAKE) -C $(MU_BUILD_ROOT_DIR) IMAGE_INSTALL_DIR=$${tmp_dir} \
985 $(patsubst %,%-image_install, \
987 $(ROOT_PACKAGES)) ; \
988 : make dev directory ; \
989 $(linuxrc_makedev) ; \
990 echo @@@@ Relocating ELF executables to run in / @@@@ ; \
992 -exec elftool quiet in '{}' out '{}' \
994 /$(arch_lib_dir)/$(DYNAMIC_LINKER) \
995 set-rpath /$(arch_lib_dir):/lib ';' ; \
996 : strip symbols from files ; \
997 if [ '$${strip_symbols:-yes}' = 'yes' ] ; then \
998 echo @@@@ Stripping symbols from files @@@@ ; \
999 find $${tmp_dir} -type f \
1001 $(TARGET_PREFIX)strip \
1002 --strip-unneeded '{}' ';' \
1005 echo @@@@ NOT stripping symbols @@@@ ; \
1007 if [ $${sign_executables:-yes} = 'yes' \
1008 -a -n "$($(PLATFORM)_public_key)" ] ; then \
1009 echo @@@@ Signing executables @@@@ ; \
1010 find $${tmp_dir} -type f \
1011 | xargs sign $($(PLATFORM)_public_key) \
1012 $($(PLATFORM)_private_key_passphrase) ; \
1014 : make read-only file system ; \
1016 $${tmp_dir} $${ro_image} \
1017 -no-exports -no-progress -no-recovery ; \
1019 : cleanup tmp directory ; \
1022 MKFS_JFFS2_BYTE_ORDER_x86_64 = -l
1023 MKFS_JFFS2_BYTE_ORDER_i686 = -l
1024 MKFS_JFFS2_BYTE_ORDER_ppc = -b
1025 MKFS_JFFS2_BYTE_ORDER_mips = -b
1026 MKFS_JFFS2_BYTE_ORDER_native = $(MKFS_JFFS2_BYTE_ORDER_$(NATIVE_ARCH))
1028 MKFS_JFFS2_SECTOR_SIZE_IN_KBYTES = \
1029 $(call ifdef_fn,$(PLATFORM)_jffs2_sector_size_in_kbytes,256)
1031 mkfs_fn_jffs2 = mkfs.jffs2 \
1032 --eraseblock=$(MKFS_JFFS2_SECTOR_SIZE_IN_KBYTES)KiB \
1033 --root=$(1) --output=$(2) \
1034 $(MKFS_JFFS2_BYTE_ORDER_$(BASIC_ARCH))
1036 # As things stand the actual initrd size parameter
1037 # is set in .../open-repo/build-data/packages/linuxrc.mk.
1038 EXT2_RW_IMAGE_SIZE=notused
1041 e2fsimage -d $(1) -f $(2) -s $(EXT2_RW_IMAGE_SIZE)
1045 make_rw_image_fn = \
1046 $(call mkfs_fn_$(RW_IMAGE_TYPE),$(1),$(2))
1048 rw_image_embed_ro_image_fn = \
1049 mkdir -p proc initrd images ro rw union ; \
1050 cp $(PLATFORM_IMAGE_DIR)/$(1) images/$(1) ; \
1051 md5sum images/$(1) > images/$(1).md5 ; \
1052 echo Built by $(LOGNAME) at `date` > images/$(1).stamp ; \
1053 mkdir -p changes/$(1)
1055 # make sure RW_IMAGE_TYPE is a type we know how to build
1056 .PHONY: rw-image-check-type
1057 rw-image-check-type:
1059 if [ -z "$(make_rw_image_fn)" ] ; then \
1060 $(call build_msg_fn,Unknown read/write fs image type; \
1061 try RW_IMAGE_TYPE=ext2 or RW_IMAGE_TYPE=jffs2) ; \
1067 rw-image: rw-image-check-type ro-image
1069 d=$(PLATFORM_IMAGE_DIR) ; \
1071 rw_image="$$d/rw.$(RW_IMAGE_TYPE)" ; \
1072 ro_image="ro.img" ; \
1073 rm -f $$rw_image ; \
1074 tmp_dir="`mktemp -d $$d/rw-image-XXXXXX`" ; \
1075 chmod 0755 $${tmp_dir} ; \
1077 trap "rm -rf $${tmp_dir}" err ; \
1078 fakeroot /bin/bash -c "{ \
1079 set -eu$(BUILD_DEBUG) ; \
1080 $(linuxrc_makedev) ; \
1081 $(call rw_image_embed_ro_image_fn,$${ro_image}) ; \
1082 $(call make_rw_image_fn,$${tmp_dir},$${rw_image}) ; \
1084 : cleanup tmp directory ; \
1087 images: linuxrc-install linux-install $(image_extra_dependencies) rw-image
1089 d=$(PLATFORM_IMAGE_DIR) ; \
1090 cd $(BUILD_DIR)/linux-$(PLATFORM) ; \
1092 [[ -z $$i && -f bzImage ]] && i=bzImage ; \
1093 [[ -z $$i && -f zImage ]] && i=zImage ; \
1094 [[ -z $$i && -f linux ]] && i=linux ; \
1095 [[ -z $$i && -f vmlinux ]] && i=vmlinux ; \
1097 && $(call build_msg_fn,no linux image to install \
1098 in $(BUILD_DIR)/linux-$(PLATFORM)) \
1102 ######################################################################
1103 # Tool chain build/install
1104 ######################################################################
1106 .PHONY: ccache-install
1108 $(MAKE) -C $(MU_BUILD_ROOT_DIR) ccache-build
1109 mkdir -p $(TOOL_INSTALL_DIR)/ccache-bin
1110 ln -sf $(MU_BUILD_ROOT_DIR)/build-tool-native/ccache/ccache \
1111 $(TOOL_INSTALL_DIR)/ccache-bin/$(TARGET_PREFIX)gcc
1113 TOOL_MAKE = $(MAKE) is_build_tool=yes
1115 tool_make_target_fn = \
1116 $(if $(strip $(NATIVE_TOOLS)), \
1117 $(TOOL_MAKE) $(patsubst %,%-$(1),$(NATIVE_TOOLS)) ARCH=native || exit 1 ;) \
1118 $(TOOL_MAKE) $(patsubst %,%-$(1),$(CROSS_TOOLS))
1120 .PHONY: install-tools
1122 $(call tool_make_target_fn,install)
1124 .PHONY: bootstrap-tools
1126 $(TOOL_MAKE) make-install findutils-install git-install \
1127 automake-install autoconf-install libtool-install fakeroot-install
1130 ######################################################################
1132 ######################################################################
1134 package_clean_script = \
1135 @$(call build_msg_fn, Cleaning $* in $(PACKAGE_INSTALL_DIR)) ; \
1137 $(if $(is_build_tool),,rm -rf $(PACKAGE_INSTALL_DIR) ;) \
1138 rm -rf $(TIMESTAMP_DIR)/$(call timestamp_name_fn,*) ; \
1139 $(if $($(PACKAGE)_clean), \
1140 $($(PACKAGE)_clean), \
1141 $(PACKAGE_MAKE) clean)
1145 $(package_clean_script)
1147 # Wipe e.g. remove build and install directories for packages.
1148 package_wipe_script = \
1149 @message=$(if $(is_build_tool),"Wiping build $(PACKAGE)","Wiping build/install $(PACKAGE)") ; \
1150 $(call build_msg_fn,$$message) ; \
1152 rm -rf $(if $(is_build_tool),$(PACKAGE_BUILD_DIR),$(PACKAGE_INSTALL_DIR) $(PACKAGE_BUILD_DIR))
1156 $(package_wipe_script)
1158 # Wipe entire build/install area for TAG and PLATFORM
1161 @$(call build_msg_fn, Wiping $(BUILD_DIR) $(INSTALL_DIR)) ; \
1163 rm -rf $(BUILD_DIR) $(INSTALL_DIR)
1167 rm -rf $(MU_BUILD_ROOT_DIR)/$(BUILD_PREFIX_package)*/
1168 rm -rf $(MU_BUILD_ROOT_DIR)/$(BUILD_PREFIX_tool)*
1169 rm -rf $(MU_BUILD_ROOT_DIR)/$(INSTALL_PREFIX)*
1170 rm -rf $(MU_BUILD_ROOT_DIR)/$(IMAGES_PREFIX)*
1171 rm -rf $(TOOL_INSTALL_DIR)
1172 rm -rf $(MU_BUILD_ROOT_DIR)/*.deb
1173 rm -rf $(MU_BUILD_ROOT_DIR)/*.changes
1174 (cd $(MU_BUILD_ROOT_DIR)/deb/;debian/rules clean)
1175 rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.install
1176 rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.dkms
1177 rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/changelog