1 ################################################################################
2 # Generic package infrastructure
4 # This file implements an infrastructure that eases development of
5 # package .mk files. It should be used for packages that do not rely
6 # on a well-known build system for which Buildroot has a dedicated
7 # infrastructure (so far, Buildroot has special support for
8 # autotools-based and CMake-based packages).
10 # See the Buildroot documentation for details on the usage of this
13 # In terms of implementation, this generic infrastructure requires the
14 # .mk file to specify:
16 # 1. Metadata information about the package: name, version,
19 # 2. Description of the commands to be executed to configure, build
20 # and install the package
21 ################################################################################
23 ################################################################################
24 # Helper functions to catch start/end of each step
25 ################################################################################
27 # Those two functions are called by each step below.
28 # They are responsible for calling all hooks defined in
29 # $(GLOBAL_INSTRUMENTATION_HOOKS) and pass each of them
31 # $1: either 'start' or 'end'
32 # $2: the name of the step
33 # $3: the name of the package
38 $(foreach hook,$(GLOBAL_INSTRUMENTATION_HOOKS),$(call $(hook),start,$(1),$($(PKG)_NAME))$(sep))
44 $(foreach hook,$(GLOBAL_INSTRUMENTATION_HOOKS),$(call $(hook),end,$(1),$($(PKG)_NAME))$(sep))
47 #######################################
52 printf "%s:%-5.5s:%-20.20s: %s\n" \
53 "$$(date +%s)" "$(1)" "$(2)" "$(3)" \
54 >>"$(BUILD_DIR)/build-time.log"
56 GLOBAL_INSTRUMENTATION_HOOKS += step_time
58 # Hooks to collect statistics about installed files
60 # The suffix is typically empty for the target variant, for legacy backward
63 # $(2): base directory to search in
64 # $(3): suffix of file (optional)
65 define step_pkg_size_inner
66 @touch $(BUILD_DIR)/packages-file-list$(3).txt
67 $(SED) '/^$(1),/d' $(BUILD_DIR)/packages-file-list$(3).txt
69 find . \( -type f -o -type l \) \
70 -newer $($(PKG)_DIR)/.stamp_built \
71 -exec printf '$(1),%s\n' {} + \
72 >> $(BUILD_DIR)/packages-file-list$(3).txt
76 $(if $(filter install-target,$(2)),\
77 $(if $(filter end,$(1)),$(call step_pkg_size_inner,$(3),$(TARGET_DIR))))
78 $(if $(filter install-staging,$(2)),\
79 $(if $(filter end,$(1)),$(call step_pkg_size_inner,$(3),$(STAGING_DIR),-staging)))
80 $(if $(filter install-host,$(2)),\
81 $(if $(filter end,$(1)),$(call step_pkg_size_inner,$(3),$(HOST_DIR),-host)))
83 GLOBAL_INSTRUMENTATION_HOOKS += step_pkg_size
85 # Relies on step_pkg_size, so must be after
87 $(if $(filter end-install-target,$(1)-$(2)),\
88 support/scripts/check-bin-arch -p $(3) \
89 -l $(BUILD_DIR)/packages-file-list.txt \
90 $(foreach i,$($(PKG)_BIN_ARCH_EXCLUDE),-i "$(i)") \
91 -r $(TARGET_READELF) \
92 -a $(BR2_READELF_ARCH_NAME))
95 GLOBAL_INSTRUMENTATION_HOOKS += check_bin_arch
97 # This hook checks that host packages that need libraries that we build
98 # have a proper DT_RPATH or DT_RUNPATH tag
99 define check_host_rpath
100 $(if $(filter install-host,$(2)),\
101 $(if $(filter end,$(1)),support/scripts/check-host-rpath $(3) $(HOST_DIR)))
103 GLOBAL_INSTRUMENTATION_HOOKS += check_host_rpath
105 define step_check_build_dir_one
106 if [ -d $(2) ]; then \
107 printf "%s: installs files in %s\n" $(1) $(2) >&2; \
112 define step_check_build_dir
113 $(if $(filter install-staging,$(2)),\
114 $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(STAGING_DIR)/$(O))))
115 $(if $(filter install-target,$(2)),\
116 $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(TARGET_DIR)/$(O))))
118 GLOBAL_INSTRUMENTATION_HOOKS += step_check_build_dir
120 # User-supplied script
121 ifneq ($(BR2_INSTRUMENTATION_SCRIPTS),)
123 @$(foreach user_hook, $(BR2_INSTRUMENTATION_SCRIPTS), \
124 $(EXTRA_ENV) $(user_hook) "$(1)" "$(2)" "$(3)"$(sep))
126 GLOBAL_INSTRUMENTATION_HOOKS += step_user
129 ################################################################################
130 # Implicit targets -- produce a stamp file for each step of a package build
131 ################################################################################
133 # Retrieve the archive
134 $(BUILD_DIR)/%/.stamp_downloaded:
135 $(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
136 # Only show the download message if it isn't already downloaded
137 $(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
138 if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
139 $(call MESSAGE,"Downloading") ; \
143 $(foreach p,$($(PKG)_ALL_DOWNLOADS),$(call DOWNLOAD,$(p))$(sep))
144 $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
148 # Retrieve actual source archive, e.g. for prebuilt external toolchains
149 $(BUILD_DIR)/%/.stamp_actual_downloaded:
150 $(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL))
155 $(BUILD_DIR)/%/.stamp_extracted:
156 @$(call step_start,extract)
157 @$(call MESSAGE,"Extracting")
158 $(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
160 $($(PKG)_EXTRACT_CMDS)
161 # some packages have messed up permissions inside
162 $(Q)chmod -R +rw $(@D)
163 $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
164 @$(call step_end,extract)
167 # Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
169 $(BUILD_DIR)/%/.stamp_rsynced:
170 @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
171 $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
172 @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
173 rsync -au --chmod=u=rwX,go=rX $(RSYNC_VCS_EXCLUSIONS) $($(PKG)_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
174 $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
179 # The RAWNAME variable is the lowercased package name, which allows to
180 # find the package directory (typically package/<pkgname>) and the
181 # prefix of the patches
183 # For BR2_GLOBAL_PATCH_DIR, only generate if it is defined
184 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $(PKGDIR)
185 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS += $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))
186 $(BUILD_DIR)/%/.stamp_patched:
187 @$(call step_start,patch)
188 @$(call MESSAGE,"Patching")
189 $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
190 $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) $(@D) $($(PKG)_DL_DIR) $(notdir $(p))$(sep))
192 for D in $(PATCH_BASE_DIRS); do \
193 if test -d $${D}; then \
194 if test -d $${D}/$($(PKG)_VERSION); then \
195 $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \
197 $(APPLY_PATCHES) $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \
202 $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep))
203 @$(call step_end,patch)
206 # Check that all directories specified in BR2_GLOBAL_PATCH_DIR exist.
207 $(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\
208 $(if $(wildcard $(dir)),,\
209 $(error BR2_GLOBAL_PATCH_DIR contains nonexistent directory $(dir))))
212 $(BUILD_DIR)/%/.stamp_configured:
213 @$(call step_start,configure)
214 @$(call MESSAGE,"Configuring")
215 $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
216 $($(PKG)_CONFIGURE_CMDS)
217 $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
218 @$(call step_end,configure)
222 $(BUILD_DIR)/%/.stamp_built::
223 @$(call step_start,build)
224 @$(call MESSAGE,"Building")
225 $(foreach hook,$($(PKG)_PRE_BUILD_HOOKS),$(call $(hook))$(sep))
226 +$($(PKG)_BUILD_CMDS)
227 $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep))
228 @$(call step_end,build)
231 # Install to host dir
232 $(BUILD_DIR)/%/.stamp_host_installed:
233 @$(call step_start,install-host)
234 @$(call MESSAGE,"Installing to host directory")
235 $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
236 +$($(PKG)_INSTALL_CMDS)
237 $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
238 @$(call step_end,install-host)
241 # Install to staging dir
243 # Some packages install libtool .la files alongside any installed
244 # libraries. These .la files sometimes refer to paths relative to the
245 # sysroot, which libtool will interpret as absolute paths to host
246 # libraries instead of the target libraries. Since this is not what we
247 # want, these paths are fixed by prefixing them with $(STAGING_DIR).
248 # As we configure with --prefix=/usr, this fix needs to be applied to
249 # any path that starts with /usr.
251 # To protect against the case that the output or staging directories or
252 # the pre-installed external toolchain themselves are under /usr, we first
253 # substitute away any occurrences of these directories with @BASE_DIR@,
254 # @STAGING_DIR@ and @TOOLCHAIN_EXTERNAL_INSTALL_DIR@ respectively.
256 # Note that STAGING_DIR can be outside BASE_DIR when the user sets
257 # BR2_HOST_DIR to a custom value. Note that TOOLCHAIN_EXTERNAL_INSTALL_DIR
258 # can be under @BASE_DIR@ when it's a downloaded toolchain, and can be
259 # empty when we use an internal toolchain.
261 $(BUILD_DIR)/%/.stamp_staging_installed:
262 @$(call step_start,install-staging)
263 @$(call MESSAGE,"Installing to staging directory")
264 $(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
265 +$($(PKG)_INSTALL_STAGING_CMDS)
266 $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
267 $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
268 $(call MESSAGE,"Fixing package configuration files") ;\
269 $(SED) "s,$(BASE_DIR),@BASE_DIR@,g" \
270 -e "s,$(STAGING_DIR),@STAGING_DIR@,g" \
271 -e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" \
272 -e "s,-I/usr/,-I@STAGING_DIR@/usr/,g" \
273 -e "s,-L/usr/,-L@STAGING_DIR@/usr/,g" \
274 -e "s,@STAGING_DIR@,$(STAGING_DIR),g" \
275 -e "s,@BASE_DIR@,$(BASE_DIR),g" \
276 $(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ;\
278 @$(call MESSAGE,"Fixing libtool files")
279 $(Q)find $(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
280 $(SED) "s:$(BASE_DIR):@BASE_DIR@:g" \
281 -e "s:$(STAGING_DIR):@STAGING_DIR@:g" \
282 $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
283 -e "s:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:g") \
284 -e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \
285 $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
286 -e "s:@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):g") \
287 -e "s:@STAGING_DIR@:$(STAGING_DIR):g" \
288 -e "s:@BASE_DIR@:$(BASE_DIR):g"
289 @$(call step_end,install-staging)
292 # Install to images dir
293 $(BUILD_DIR)/%/.stamp_images_installed:
294 @$(call step_start,install-image)
295 $(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
296 @$(call MESSAGE,"Installing to images directory")
297 +$($(PKG)_INSTALL_IMAGES_CMDS)
298 $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
299 @$(call step_end,install-image)
302 # Install to target dir
303 $(BUILD_DIR)/%/.stamp_target_installed:
304 @$(call step_start,install-target)
305 @$(call MESSAGE,"Installing to target")
306 $(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
307 +$($(PKG)_INSTALL_TARGET_CMDS)
308 $(if $(BR2_INIT_SYSTEMD),\
309 $($(PKG)_INSTALL_INIT_SYSTEMD))
310 $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
311 $($(PKG)_INSTALL_INIT_SYSV))
312 $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
313 $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
314 $(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
316 @$(call step_end,install-target)
319 # Remove package sources
320 $(BUILD_DIR)/%/.stamp_dircleaned:
323 ################################################################################
324 # virt-provides-single -- check that provider-pkg is the declared provider for
325 # the virtual package virt-pkg
327 # argument 1 is the lower-case name of the virtual package
328 # argument 2 is the upper-case name of the virtual package
329 # argument 3 is the lower-case name of the provider
332 # $(call virt-provides-single,libegl,LIBEGL,rpi-userland)
333 ################################################################################
334 define virt-provides-single
335 ifneq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),$(3))
336 $$(error Configuration error: both "$(3)" and $$(BR2_PACKAGE_PROVIDES_$(2))\
337 are selected as providers for virtual package "$(1)". Only one provider can\
338 be selected at a time. Please fix your configuration)
342 define pkg-graph-depends
343 @$$(INSTALL) -d $$(GRAPHS_DIR)
344 @cd "$$(CONFIG_DIR)"; \
345 $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \
346 -p $(1) $(2) -o $$(GRAPHS_DIR)/$$(@).dot
347 dot $$(BR2_GRAPH_DOT_OPTS) -T$$(BR_GRAPH_OUT) \
348 -o $$(GRAPHS_DIR)/$$(@).$$(BR_GRAPH_OUT) \
349 $$(GRAPHS_DIR)/$$(@).dot
352 ################################################################################
353 # inner-generic-package -- generates the make targets needed to build a
356 # argument 1 is the lowercase package name
357 # argument 2 is the uppercase package name, including a HOST_ prefix
359 # argument 3 is the uppercase package name, without the HOST_ prefix
361 # argument 4 is the type (target or host)
363 # Note about variable and function references: inside all blocks that are
364 # evaluated with $(eval), which includes all 'inner-xxx-package' blocks,
365 # specific rules apply with respect to variable and function references.
366 # - Numbered variables (parameters to the block) can be referenced with a single
367 # dollar sign: $(1), $(2), $(3), etc.
368 # - pkgdir and pkgname should be referenced with a single dollar sign too. These
369 # functions rely on 'the most recently parsed makefile' which is supposed to
370 # be the package .mk file. If we defer the evaluation of these functions using
371 # double dollar signs, then they may be evaluated too late, when other
372 # makefiles have already been parsed. One specific case is when $$(pkgdir) is
373 # assigned to a variable using deferred evaluation with '=' and this variable
374 # is used in a target rule outside the eval'ed inner block. In this case, the
375 # pkgdir will be that of the last makefile parsed by buildroot, which is not
376 # the expected value. This mechanism is for example used for the TARGET_PATCH
378 # - All other variables should be referenced with a double dollar sign:
379 # $$(TARGET_DIR), $$($(2)_VERSION), etc. Also all make functions should be
380 # referenced with a double dollar sign: $$(subst), $$(call), $$(filter-out),
381 # etc. This rule ensures that these variables and functions are only expanded
382 # during the $(eval) step, and not earlier. Otherwise, unintuitive and
383 # undesired behavior occurs with respect to these variables and functions.
385 ################################################################################
387 define inner-generic-package
389 # When doing a package, we're definitely not doing a rootfs, but we
390 # may inherit it via the dependency chain, so we reset it.
393 # Ensure the package is only declared once, i.e. do not accept that a
394 # package be re-defined by a br2-external tree
395 ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),)
396 $$(error Package '$(1)' defined a second time in '$(pkgdir)'; \
397 previous definition was in '$$($(2)_PKGDIR)')
401 # Define default values for various package-related variables, if not
402 # already defined. For some variables (version, source, site and
403 # subdir), if they are undefined, we try to see if a variable without
404 # the HOST_ prefix is defined. If so, we use such a variable, so that
405 # this information has only to be specified once, for both the
406 # target and host packages of a given .mk file.
410 $(2)_RAWNAME = $$(patsubst host-%,%,$(1))
411 $(2)_PKGDIR = $(pkgdir)
413 # Keep the package version that may contain forward slashes in the _DL_VERSION
414 # variable, then replace all forward slashes ('/') by underscores ('_') to
415 # sanitize the package version that is used in paths, directory and file names.
416 # Forward slashes may appear in the package's version when pointing to a
417 # version control system branch or tag, for example remotes/origin/1_10_stable.
418 # Similar for spaces and colons (:) that may appear in date-based revisions for
421 ifdef $(3)_DL_VERSION
422 $(2)_DL_VERSION := $$($(3)_DL_VERSION)
423 else ifdef $(3)_VERSION
424 $(2)_DL_VERSION := $$($(3)_VERSION)
427 $(2)_DL_VERSION := $$(strip $$($(2)_VERSION))
429 $(2)_VERSION := $$(call sanitize,$$($(2)_DL_VERSION))
431 ifdef $(3)_OVERRIDE_SRCDIR
432 $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
435 $(2)_BASENAME = $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
436 $(2)_BASENAME_RAW = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
437 $(2)_DL_SUBDIR ?= $$($(2)_RAWNAME)
438 $(2)_DL_DIR = $$(DL_DIR)/$$($(2)_DL_SUBDIR)
439 $(2)_DIR = $$(BUILD_DIR)/$$($(2)_BASENAME)
443 $(2)_SUBDIR = $$($(3)_SUBDIR)
449 ifndef $(2)_STRIP_COMPONENTS
450 ifdef $(3)_STRIP_COMPONENTS
451 $(2)_STRIP_COMPONENTS = $$($(3)_STRIP_COMPONENTS)
453 $(2)_STRIP_COMPONENTS ?= 1
457 $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
458 $(2)_BUILDDIR ?= $$($(2)_SRCDIR)
460 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
461 $(2)_VERSION = custom
466 $(2)_SOURCE = $$($(3)_SOURCE)
467 else ifdef $(2)_VERSION
468 $(2)_SOURCE ?= $$($(2)_BASENAME_RAW).tar.gz
472 # If FOO_ACTUAL_SOURCE_TARBALL is explicitly defined, it means FOO_SOURCE is
473 # indeed a binary (e.g. external toolchain) and FOO_ACTUAL_SOURCE_TARBALL/_SITE
474 # point to the actual sources tarball. Use the actual sources for legal-info.
475 # For most packages the FOO_SITE/FOO_SOURCE pair points to real source code,
476 # so these are the defaults for FOO_ACTUAL_*.
477 $(2)_ACTUAL_SOURCE_TARBALL ?= $$($(2)_SOURCE)
478 $(2)_ACTUAL_SOURCE_SITE ?= $$(call qstrip,$$($(2)_SITE))
482 $(2)_PATCH = $$($(3)_PATCH)
486 ifneq ($$(filter bzr cvs hg svn,$$($(2)_SITE_METHOD)),)
487 BR_NO_CHECK_HASH_FOR += $$($(2)_SOURCE)
490 $(2)_ALL_DOWNLOADS = \
491 $$(if $$($(2)_SOURCE),$$($(2)_SITE_METHOD)+$$($(2)_SITE)/$$($(2)_SOURCE)) \
492 $$(foreach p,$$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\
493 $$(if $$(findstring ://,$$(p)),$$(p),\
494 $$($(2)_SITE)/$$(p)))
498 $(2)_SITE = $$($(3)_SITE)
502 ifndef $(2)_SITE_METHOD
503 ifdef $(3)_SITE_METHOD
504 $(2)_SITE_METHOD = $$($(3)_SITE_METHOD)
506 # Try automatic detection using the scheme part of the URI
507 $(2)_SITE_METHOD = $$(call geturischeme,$$($(2)_SITE))
511 # Do not accept to download git submodule if not using the git method
512 ifneq ($$($(2)_GIT_SUBMODULES),)
513 ifneq ($$($(2)_SITE_METHOD),git)
514 $$(error $(2) declares having git sub-modules, but does not use the \
515 'git' method (uses '$$($(2)_SITE_METHOD)' instead))
519 ifeq ($$($(2)_SITE_METHOD),local)
520 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
521 $(2)_OVERRIDE_SRCDIR = $$($(2)_SITE)
527 $(2)_LICENSE = $$($(3)_LICENSE)
531 $(2)_LICENSE ?= unknown
533 ifndef $(2)_LICENSE_FILES
534 ifdef $(3)_LICENSE_FILES
535 $(2)_LICENSE_FILES = $$($(3)_LICENSE_FILES)
539 ifndef $(2)_REDISTRIBUTE
540 ifdef $(3)_REDISTRIBUTE
541 $(2)_REDISTRIBUTE = $$($(3)_REDISTRIBUTE)
545 $(2)_REDISTRIBUTE ?= YES
547 $(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_BASENAME_RAW)
549 # When a target package is a toolchain dependency set this variable to
550 # 'NO' so the 'toolchain' dependency is not added to prevent a circular
552 # Similarly for the skeleton.
553 $(2)_ADD_TOOLCHAIN_DEPENDENCY ?= YES
554 $(2)_ADD_SKELETON_DEPENDENCY ?= YES
558 ifeq ($$($(2)_ADD_SKELETON_DEPENDENCY),YES)
559 $(2)_DEPENDENCIES += skeleton
561 ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
562 $(2)_DEPENDENCIES += toolchain
566 ifneq ($(1),host-skeleton)
567 $(2)_DEPENDENCIES += host-skeleton
570 ifeq ($(filter host-tar host-skeleton host-fakedate,$(1)),)
571 $(2)_EXTRACT_DEPENDENCIES += $(BR2_TAR_HOST_DEPENDENCY)
574 ifeq ($(filter host-tar host-skeleton host-xz host-lzip host-fakedate,$(1)),)
575 $(2)_EXTRACT_DEPENDENCIES += $(BR2_XZCAT_HOST_DEPENDENCY)
578 ifeq ($(filter host-tar host-skeleton host-xz host-lzip host-fakedate,$(1)),)
579 $(2)_EXTRACT_DEPENDENCIES += $(BR2_LZIP_HOST_DEPENDENCY)
582 ifeq ($(BR2_CCACHE),y)
583 ifeq ($(filter host-tar host-skeleton host-xz host-lzip host-fakedate host-ccache,$(1)),)
584 $(2)_DEPENDENCIES += host-ccache
588 ifeq ($(BR2_REPRODUCIBLE),y)
589 ifeq ($(filter host-skeleton host-fakedate,$(1)),)
590 $(2)_DEPENDENCIES += host-fakedate
594 # Eliminate duplicates in dependencies
595 $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
596 $(2)_FINAL_EXTRACT_DEPENDENCIES = $$(sort $$($(2)_EXTRACT_DEPENDENCIES))
597 $(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
598 $(2)_FINAL_ALL_DEPENDENCIES = \
600 $$($(2)_FINAL_DEPENDENCIES) \
601 $$($(2)_FINAL_EXTRACT_DEPENDENCIES) \
602 $$($(2)_FINAL_PATCH_DEPENDENCIES))
604 $(2)_INSTALL_STAGING ?= NO
605 $(2)_INSTALL_IMAGES ?= NO
606 $(2)_INSTALL_TARGET ?= YES
608 # define sub-target stamps
609 $(2)_TARGET_INSTALL_TARGET = $$($(2)_DIR)/.stamp_target_installed
610 $(2)_TARGET_INSTALL_STAGING = $$($(2)_DIR)/.stamp_staging_installed
611 $(2)_TARGET_INSTALL_IMAGES = $$($(2)_DIR)/.stamp_images_installed
612 $(2)_TARGET_INSTALL_HOST = $$($(2)_DIR)/.stamp_host_installed
613 $(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built
614 $(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured
615 $(2)_TARGET_RSYNC = $$($(2)_DIR)/.stamp_rsynced
616 $(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched
617 $(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted
618 $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded
619 $(2)_TARGET_ACTUAL_SOURCE = $$($(2)_DIR)/.stamp_actual_downloaded
620 $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned
622 # default extract command
623 $(2)_EXTRACT_CMDS ?= \
624 $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$($(2)_DL_DIR)/$$($(2)_SOURCE) | \
625 $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \
627 $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \
630 # pre/post-steps hooks
631 $(2)_PRE_DOWNLOAD_HOOKS ?=
632 $(2)_POST_DOWNLOAD_HOOKS ?=
633 $(2)_PRE_EXTRACT_HOOKS ?=
634 $(2)_POST_EXTRACT_HOOKS ?=
635 $(2)_PRE_RSYNC_HOOKS ?=
636 $(2)_POST_RSYNC_HOOKS ?=
637 $(2)_PRE_PATCH_HOOKS ?=
638 $(2)_POST_PATCH_HOOKS ?=
639 $(2)_PRE_CONFIGURE_HOOKS ?=
640 $(2)_POST_CONFIGURE_HOOKS ?=
641 $(2)_PRE_BUILD_HOOKS ?=
642 $(2)_POST_BUILD_HOOKS ?=
643 $(2)_PRE_INSTALL_HOOKS ?=
644 $(2)_POST_INSTALL_HOOKS ?=
645 $(2)_PRE_INSTALL_STAGING_HOOKS ?=
646 $(2)_POST_INSTALL_STAGING_HOOKS ?=
647 $(2)_PRE_INSTALL_TARGET_HOOKS ?=
648 $(2)_POST_INSTALL_TARGET_HOOKS ?=
649 $(2)_PRE_INSTALL_IMAGES_HOOKS ?=
650 $(2)_POST_INSTALL_IMAGES_HOOKS ?=
651 $(2)_PRE_LEGAL_INFO_HOOKS ?=
652 $(2)_POST_LEGAL_INFO_HOOKS ?=
653 $(2)_TARGET_FINALIZE_HOOKS ?=
654 $(2)_ROOTFS_PRE_CMD_HOOKS ?=
656 ifeq ($$($(2)_TYPE),target)
657 ifneq ($$(HOST_$(2)_KCONFIG_VAR),)
658 $$(error "Package $(1) defines host variant before target variant!")
662 # human-friendly targets and target sequencing
665 ifeq ($$($(2)_TYPE),host)
666 $(1)-install: $(1)-install-host
668 $(1)-install: $(1)-install-staging $(1)-install-target $(1)-install-images
671 ifeq ($$($(2)_INSTALL_TARGET),YES)
672 $(1)-install-target: $$($(2)_TARGET_INSTALL_TARGET)
673 $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_BUILD)
678 ifeq ($$($(2)_INSTALL_STAGING),YES)
679 $(1)-install-staging: $$($(2)_TARGET_INSTALL_STAGING)
680 $$($(2)_TARGET_INSTALL_STAGING): $$($(2)_TARGET_BUILD)
681 # Some packages use install-staging stuff for install-target
682 $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_INSTALL_STAGING)
684 $(1)-install-staging:
687 ifeq ($$($(2)_INSTALL_IMAGES),YES)
688 $(1)-install-images: $$($(2)_TARGET_INSTALL_IMAGES)
689 $$($(2)_TARGET_INSTALL_IMAGES): $$($(2)_TARGET_BUILD)
694 $(1)-install-host: $$($(2)_TARGET_INSTALL_HOST)
695 $$($(2)_TARGET_INSTALL_HOST): $$($(2)_TARGET_BUILD)
697 $(1)-build: $$($(2)_TARGET_BUILD)
698 $$($(2)_TARGET_BUILD): $$($(2)_TARGET_CONFIGURE)
700 # Since $(2)_FINAL_DEPENDENCIES are phony targets, they are always "newer"
701 # than $(2)_TARGET_CONFIGURE. This would force the configure step (and
702 # therefore the other steps as well) to be re-executed with every
703 # invocation of make. Therefore, make $(2)_FINAL_DEPENDENCIES an order-only
704 # dependency by using |.
706 $(1)-configure: $$($(2)_TARGET_CONFIGURE)
707 $$($(2)_TARGET_CONFIGURE): | $$($(2)_FINAL_DEPENDENCIES)
709 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dirs prepare
710 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dependencies
712 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
713 # In the normal case (no package override), the sequence of steps is
714 # source, by downloading
719 $$($(2)_TARGET_CONFIGURE): $$($(2)_TARGET_PATCH)
721 $(1)-patch: $$($(2)_TARGET_PATCH)
722 $$($(2)_TARGET_PATCH): $$($(2)_TARGET_EXTRACT)
723 # Order-only dependency
724 $$($(2)_TARGET_PATCH): | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))
726 $(1)-extract: $$($(2)_TARGET_EXTRACT)
727 $$($(2)_TARGET_EXTRACT): $$($(2)_TARGET_SOURCE)
728 $$($(2)_TARGET_EXTRACT): | $$($(2)_FINAL_EXTRACT_DEPENDENCIES)
730 $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
732 $(1)-source: $$($(2)_TARGET_SOURCE)
734 $(1)-all-source: $(1)-legal-source
735 $(1)-legal-info: $(1)-legal-source
736 $(1)-legal-source: $(1)-source
738 # Only download the actual source if it differs from the 'main' archive
739 ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),)
740 ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_SOURCE))
741 $(1)-legal-source: $$($(2)_TARGET_ACTUAL_SOURCE)
742 endif # actual sources != sources
743 endif # actual sources != ""
746 @for p in $$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS) ; do \
747 echo `basename $$$$p` ; \
750 # In the package override case, the sequence of steps
751 # source, by rsyncing
755 # Use an order-only dependency so the "<pkg>-clean-for-rebuild" rule
756 # can remove the stamp file without triggering the configure step.
757 $$($(2)_TARGET_CONFIGURE): | $$($(2)_TARGET_RSYNC)
759 $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
761 $(1)-patch: $(1)-rsync
762 $(1)-extract: $(1)-rsync
764 $(1)-rsync: $$($(2)_TARGET_RSYNC)
770 @echo "file://$$($(2)_OVERRIDE_SRCDIR)"
774 @echo $$($(2)_VERSION)
777 @echo $$($(2)_FINAL_ALL_DEPENDENCIES)
779 $(1)-show-recursive-depends:
780 @cd "$$(CONFIG_DIR)" && \
781 $$(TOPDIR)/support/scripts/graph-depends -p $(1) -f -q
784 @echo $$($(2)_RDEPENDENCIES)
786 $(1)-show-recursive-rdepends:
787 @cd "$$(CONFIG_DIR)" && \
788 $$(TOPDIR)/support/scripts/graph-depends -p $(1) --reverse -f -q
790 $(1)-show-build-order: $$(patsubst %,%-show-build-order,$$($(2)_FINAL_ALL_DEPENDENCIES))
793 $(1)-graph-depends: graph-depends-requirements
794 $(call pkg-graph-depends,$(1),--direct)
796 $(1)-graph-rdepends: graph-depends-requirements
797 $(call pkg-graph-depends,$(1),--reverse)
799 $(1)-all-source: $(1)-source
800 $(1)-all-source: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-source)
802 $(1)-all-external-deps: $(1)-external-deps
803 $(1)-all-external-deps: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-external-deps)
805 $(1)-all-legal-info: $(1)-legal-info
806 $(1)-all-legal-info: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-legal-info)
808 $(1)-dirclean: $$($(2)_TARGET_DIRCLEAN)
810 $(1)-clean-for-reinstall:
811 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
812 rm -f $$($(2)_TARGET_RSYNC)
814 rm -f $$($(2)_TARGET_INSTALL_STAGING)
815 rm -f $$($(2)_TARGET_INSTALL_TARGET)
816 rm -f $$($(2)_TARGET_INSTALL_IMAGES)
817 rm -f $$($(2)_TARGET_INSTALL_HOST)
819 $(1)-reinstall: $(1)-clean-for-reinstall $(1)
821 $(1)-clean-for-rebuild: $(1)-clean-for-reinstall
822 rm -f $$($(2)_TARGET_BUILD)
824 $(1)-rebuild: $(1)-clean-for-rebuild $(1)
826 $(1)-clean-for-reconfigure: $(1)-clean-for-rebuild
827 rm -f $$($(2)_TARGET_CONFIGURE)
829 $(1)-reconfigure: $(1)-clean-for-reconfigure $(1)
831 # define the PKG variable for all targets, containing the
832 # uppercase package variable prefix
833 $$($(2)_TARGET_INSTALL_TARGET): PKG=$(2)
834 $$($(2)_TARGET_INSTALL_STAGING): PKG=$(2)
835 $$($(2)_TARGET_INSTALL_IMAGES): PKG=$(2)
836 $$($(2)_TARGET_INSTALL_HOST): PKG=$(2)
837 $$($(2)_TARGET_BUILD): PKG=$(2)
838 $$($(2)_TARGET_CONFIGURE): PKG=$(2)
839 $$($(2)_TARGET_RSYNC): SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
840 $$($(2)_TARGET_RSYNC): PKG=$(2)
841 $$($(2)_TARGET_PATCH): PKG=$(2)
842 $$($(2)_TARGET_PATCH): RAWNAME=$$(patsubst host-%,%,$(1))
843 $$($(2)_TARGET_PATCH): PKGDIR=$(pkgdir)
844 $$($(2)_TARGET_EXTRACT): PKG=$(2)
845 $$($(2)_TARGET_SOURCE): PKG=$(2)
846 $$($(2)_TARGET_SOURCE): PKGDIR=$(pkgdir)
847 $$($(2)_TARGET_ACTUAL_SOURCE): PKG=$(2)
848 $$($(2)_TARGET_ACTUAL_SOURCE): PKGDIR=$(pkgdir)
849 $$($(2)_TARGET_DIRCLEAN): PKG=$(2)
851 # Compute the name of the Kconfig option that correspond to the
852 # package being enabled. We handle three cases: the special Linux
853 # kernel case, the bootloaders case, and the normal packages case.
855 $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
856 else ifneq ($$(filter boot/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/boot/%),$(pkgdir)),)
857 $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
858 else ifneq ($$(filter toolchain/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/toolchain/%),$(pkgdir)),)
859 $(2)_KCONFIG_VAR = BR2_$(2)
861 $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
864 # legal-info: declare dependencies and set values used later for the manifest
865 ifneq ($$($(2)_LICENSE_FILES),)
866 $(2)_MANIFEST_LICENSE_FILES = $$($(2)_LICENSE_FILES)
869 # We need to extract and patch a package to be able to retrieve its
870 # license files (if any) and the list of patches applied to it (if
872 $(1)-legal-info: $(1)-patch
874 # We only save the sources of packages we want to redistribute, that are
875 # non-overriden (local or true override).
876 ifeq ($$($(2)_REDISTRIBUTE),YES)
877 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
878 # Packages that have a tarball need it downloaded beforehand
879 $(1)-legal-info: $(1)-source $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))
883 # legal-info: produce legally relevant info.
884 $(1)-legal-info: PKG=$(2)
886 @$$(call MESSAGE,"Collecting legal info")
887 # Packages without a source are assumed to be part of Buildroot, skip them.
888 $$(foreach hook,$$($(2)_PRE_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
889 ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
891 # Save license files if defined
892 # We save the license files for any kind of package: normal, local,
893 # overridden, or non-redistributable alike.
894 # The reason to save license files even for no-redistribute packages
895 # is that the license still applies to the files distributed as part
896 # of the rootfs, even if the sources are not themselves redistributed.
897 ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
898 $(Q)$$(call legal-warning-pkg,$$($(2)_BASENAME_RAW),cannot save license ($(2)_LICENSE_FILES not defined))
900 $(Q)$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_BASENAME_RAW),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
901 endif # license files
903 ifeq ($$($(2)_SITE_METHOD),local)
904 # Packages without a tarball: don't save and warn
905 @$$(call legal-warning-nosource,$$($(2)_RAWNAME),local)
907 else ifneq ($$($(2)_OVERRIDE_SRCDIR),)
908 @$$(call legal-warning-nosource,$$($(2)_RAWNAME),override)
913 ifeq ($$($(2)_REDISTRIBUTE),YES)
914 # Save the source tarball and any extra downloads, but not
915 # patches, as they are handled specially afterwards.
916 $$(foreach e,$$($(2)_ACTUAL_SOURCE_TARBALL) $$(notdir $$($(2)_EXTRA_DOWNLOADS)),\
917 $$(Q)support/scripts/hardlink-or-copy \
918 $$($(2)_DL_DIR)/$$(e) \
919 $$($(2)_REDIST_SOURCES_DIR)$$(sep))
920 # Save patches and generate the series file
921 $$(Q)while read f; do \
922 support/scripts/hardlink-or-copy \
924 $$($(2)_REDIST_SOURCES_DIR) || exit 1; \
925 printf "%s\n" "$$$${f##*/}" >>$$($(2)_REDIST_SOURCES_DIR)/series || exit 1; \
926 done <$$($(2)_DIR)/.applied_patches_list
929 endif # other packages
930 @$$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_ACTUAL_SOURCE_SITE),$$(call UPPERCASE,$(4)))
931 endif # ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
932 $$(foreach hook,$$($(2)_POST_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
934 # add package to the general list of targets if requested by the buildroot
936 ifeq ($$($$($(2)_KCONFIG_VAR)),y)
938 # Ensure the calling package is the declared provider for all the virtual
939 # packages it claims to be an implementation of.
940 ifneq ($$($(2)_PROVIDES),)
941 $$(foreach pkg,$$($(2)_PROVIDES),\
942 $$(eval $$(call virt-provides-single,$$(pkg),$$(call UPPERCASE,$$(pkg)),$(1))$$(sep)))
945 # Register package as a reverse-dependencies of all its dependencies
946 $$(eval $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),\
947 $$(call UPPERCASE,$$(p))_RDEPENDENCIES += $(1)$$(sep)))
949 # Ensure unified variable name conventions between all packages Some
950 # of the variables are used by more than one infrastructure; so,
951 # rather than duplicating the checks in each infrastructure, we check
952 # all variables here in pkg-generic, even though pkg-generic should
953 # have no knowledge of infra-specific variables.
954 $(eval $(call check-deprecated-variable,$(2)_MAKE_OPT,$(2)_MAKE_OPTS))
955 $(eval $(call check-deprecated-variable,$(2)_INSTALL_OPT,$(2)_INSTALL_OPTS))
956 $(eval $(call check-deprecated-variable,$(2)_INSTALL_TARGET_OPT,$(2)_INSTALL_TARGET_OPTS))
957 $(eval $(call check-deprecated-variable,$(2)_INSTALL_STAGING_OPT,$(2)_INSTALL_STAGING_OPTS))
958 $(eval $(call check-deprecated-variable,$(2)_INSTALL_HOST_OPT,$(2)_INSTALL_HOST_OPTS))
959 $(eval $(call check-deprecated-variable,$(2)_AUTORECONF_OPT,$(2)_AUTORECONF_OPTS))
960 $(eval $(call check-deprecated-variable,$(2)_CONF_OPT,$(2)_CONF_OPTS))
961 $(eval $(call check-deprecated-variable,$(2)_BUILD_OPT,$(2)_BUILD_OPTS))
962 $(eval $(call check-deprecated-variable,$(2)_GETTEXTIZE_OPT,$(2)_GETTEXTIZE_OPTS))
963 $(eval $(call check-deprecated-variable,$(2)_KCONFIG_OPT,$(2)_KCONFIG_OPTS))
967 ifneq ($$($(2)_PERMISSIONS),)
968 PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep)
970 ifneq ($$($(2)_DEVICES),)
971 PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep)
973 ifneq ($$($(2)_USERS),)
974 PACKAGES_USERS += $$($(2)_USERS)$$(sep)
976 TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
977 ROOTFS_PRE_CMD_HOOKS += $$($(2)_ROOTFS_PRE_CMD_HOOKS)
979 ifeq ($$($(2)_SITE_METHOD),svn)
980 DL_TOOLS_DEPENDENCIES += svn
981 else ifeq ($$($(2)_SITE_METHOD),git)
982 DL_TOOLS_DEPENDENCIES += git
983 else ifeq ($$($(2)_SITE_METHOD),bzr)
984 DL_TOOLS_DEPENDENCIES += bzr
985 else ifeq ($$($(2)_SITE_METHOD),scp)
986 DL_TOOLS_DEPENDENCIES += scp ssh
987 else ifeq ($$($(2)_SITE_METHOD),hg)
988 DL_TOOLS_DEPENDENCIES += hg
989 else ifeq ($$($(2)_SITE_METHOD),cvs)
990 DL_TOOLS_DEPENDENCIES += cvs
993 DL_TOOLS_DEPENDENCIES += $$(call extractor-dependency,$$($(2)_SOURCE))
995 # Ensure all virtual targets are PHONY. Listed alphabetically.
997 $(1)-all-external-deps \
998 $(1)-all-legal-info \
1001 $(1)-clean-for-rebuild \
1002 $(1)-clean-for-reconfigure \
1003 $(1)-clean-for-reinstall \
1007 $(1)-external-deps \
1009 $(1)-graph-depends \
1012 $(1)-install-images \
1013 $(1)-install-staging \
1014 $(1)-install-target \
1026 ifneq ($$($(2)_SOURCE),)
1027 ifeq ($$($(2)_SITE),)
1028 $$(error $(2)_SITE cannot be empty when $(2)_SOURCE is not)
1032 ifeq ($$(patsubst %/,ERROR,$$($(2)_SITE)),ERROR)
1033 $$(error $(2)_SITE ($$($(2)_SITE)) cannot have a trailing slash)
1036 ifneq ($$($(2)_HELP_CMDS),)
1037 HELP_PACKAGES += $(2)
1040 endif # $(2)_KCONFIG_VAR
1041 endef # inner-generic-package
1043 ################################################################################
1044 # generic-package -- the target generator macro for generic packages
1045 ################################################################################
1047 # In the case of target packages, keep the package name "pkg"
1048 generic-package = $(call inner-generic-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
1049 # In the case of host packages, turn the package name "pkg" into "host-pkg"
1050 host-generic-package = $(call inner-generic-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)