systemd: bump version to 233
[buildroot-gz.git] / package / pkg-generic.mk
blobdd8a1e2ece4ce0672057ca0d6437a293ec03ad44
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
11 # infrastructure
13 # In terms of implementation, this generic infrastructure requires the
14 # .mk file to specify:
16 # 1. Metadata information about the package: name, version,
17 # download URL, etc.
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
30 # three arguments:
31 # $1: either 'start' or 'end'
32 # $2: the name of the step
33 # $3: the name of the package
35 # Start step
36 # $1: step name
37 define step_start
38 $(foreach hook,$(GLOBAL_INSTRUMENTATION_HOOKS),$(call $(hook),start,$(1),$($(PKG)_NAME))$(sep))
39 endef
41 # End step
42 # $1: step name
43 define step_end
44 $(foreach hook,$(GLOBAL_INSTRUMENTATION_HOOKS),$(call $(hook),end,$(1),$($(PKG)_NAME))$(sep))
45 endef
47 #######################################
48 # Actual steps hooks
50 # Time steps
51 define step_time
52 printf "%s:%-5.5s:%-20.20s: %s\n" \
53 "$$(date +%s)" "$(1)" "$(2)" "$(3)" \
54 >>"$(BUILD_DIR)/build-time.log"
55 endef
56 GLOBAL_INSTRUMENTATION_HOOKS += step_time
58 # Hooks to collect statistics about installed files
60 # This hook will be called before the target installation of a
61 # package. We store in a file named .br_filelist_before the list of
62 # files currently installed in the target. Note that the MD5 is also
63 # stored, in order to identify if the files are overwritten.
64 define step_pkg_size_start
65 (cd $(TARGET_DIR) ; find . -type f -print0 | xargs -0 md5sum) | sort > \
66 $($(PKG)_DIR)/.br_filelist_before
67 endef
69 # This hook will be called after the target installation of a
70 # package. We store in a file named .br_filelist_after the list of
71 # files (and their MD5) currently installed in the target. We then do
72 # a diff with the .br_filelist_before to compute the list of files
73 # installed by this package.
74 define step_pkg_size_end
75 (cd $(TARGET_DIR); find . -type f -print0 | xargs -0 md5sum) | sort > \
76 $($(PKG)_DIR)/.br_filelist_after
77 comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \
78 while read hash file ; do \
79 echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
80 done
81 endef
83 define step_pkg_size
84 $(if $(filter install-target,$(2)),\
85 $(if $(filter start,$(1)),$(call step_pkg_size_start,$(3))) \
86 $(if $(filter end,$(1)),$(call step_pkg_size_end,$(3))))
87 endef
88 GLOBAL_INSTRUMENTATION_HOOKS += step_pkg_size
90 # Relies on step_pkg_size, so must be after
91 define check_bin_arch
92 $(if $(filter end-install-target,$(1)-$(2)),\
93 support/scripts/check-bin-arch -p $(3) \
94 -l $(BUILD_DIR)/packages-file-list.txt \
95 -r $(TARGET_READELF) \
96 -a $(BR2_READELF_ARCH_NAME))
97 endef
99 GLOBAL_INSTRUMENTATION_HOOKS += check_bin_arch
101 # This hook checks that host packages that need libraries that we build
102 # have a proper DT_RPATH or DT_RUNPATH tag
103 define check_host_rpath
104 $(if $(filter install-host,$(2)),\
105 $(if $(filter end,$(1)),support/scripts/check-host-rpath $(3) $(HOST_DIR)))
106 endef
107 GLOBAL_INSTRUMENTATION_HOOKS += check_host_rpath
109 define step_check_build_dir_one
110 if [ -d $(2) ]; then \
111 printf "%s: installs files in %s\n" $(1) $(2) >&2; \
112 exit 1; \
114 endef
116 define step_check_build_dir
117 $(if $(filter install-staging,$(2)),\
118 $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(STAGING_DIR)/$(O))))
119 $(if $(filter install-target,$(2)),\
120 $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(TARGET_DIR)/$(O))))
121 endef
122 GLOBAL_INSTRUMENTATION_HOOKS += step_check_build_dir
124 # User-supplied script
125 ifneq ($(BR2_INSTRUMENTATION_SCRIPTS),)
126 define step_user
127 @$(foreach user_hook, $(BR2_INSTRUMENTATION_SCRIPTS), \
128 $(EXTRA_ENV) $(user_hook) "$(1)" "$(2)" "$(3)"$(sep))
129 endef
130 GLOBAL_INSTRUMENTATION_HOOKS += step_user
131 endif
133 ################################################################################
134 # Implicit targets -- produce a stamp file for each step of a package build
135 ################################################################################
137 # Retrieve the archive
138 $(BUILD_DIR)/%/.stamp_downloaded:
139 $(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
140 # Only show the download message if it isn't already downloaded
141 $(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
142 if test ! -e $(DL_DIR)/`basename $$p` ; then \
143 $(call MESSAGE,"Downloading") ; \
144 break ; \
145 fi ; \
146 done
147 $(foreach p,$($(PKG)_ALL_DOWNLOADS),$(call DOWNLOAD,$(p))$(sep))
148 $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
149 $(Q)mkdir -p $(@D)
150 $(Q)touch $@
152 # Retrieve actual source archive, e.g. for prebuilt external toolchains
153 $(BUILD_DIR)/%/.stamp_actual_downloaded:
154 $(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL)); \
155 $(Q)mkdir -p $(@D)
156 $(Q)touch $@
158 # Unpack the archive
159 $(BUILD_DIR)/%/.stamp_extracted:
160 @$(call step_start,extract)
161 @$(call MESSAGE,"Extracting")
162 $(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
163 $(Q)mkdir -p $(@D)
164 $($(PKG)_EXTRACT_CMDS)
165 # some packages have messed up permissions inside
166 $(Q)chmod -R +rw $(@D)
167 $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
168 @$(call step_end,extract)
169 $(Q)touch $@
171 # Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
172 # used.
173 $(BUILD_DIR)/%/.stamp_rsynced:
174 @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
175 $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
176 @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
177 rsync -au --chmod=u=rwX,go=rX $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
178 $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
179 $(Q)touch $@
181 # Patch
183 # The RAWNAME variable is the lowercased package name, which allows to
184 # find the package directory (typically package/<pkgname>) and the
185 # prefix of the patches
187 # For BR2_GLOBAL_PATCH_DIR, only generate if it is defined
188 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $(PKGDIR)
189 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS += $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))
190 $(BUILD_DIR)/%/.stamp_patched:
191 @$(call step_start,patch)
192 @$(call MESSAGE,"Patching")
193 $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
194 $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) $(@D) $(DL_DIR) $(notdir $(p))$(sep))
195 $(Q)( \
196 for D in $(PATCH_BASE_DIRS); do \
197 if test -d $${D}; then \
198 if test -d $${D}/$($(PKG)_VERSION); then \
199 $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \
200 else \
201 $(APPLY_PATCHES) $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \
202 fi; \
203 fi; \
204 done; \
206 $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep))
207 @$(call step_end,patch)
208 $(Q)touch $@
210 # Check that all directories specified in BR2_GLOBAL_PATCH_DIR exist.
211 $(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\
212 $(if $(wildcard $(dir)),,\
213 $(error BR2_GLOBAL_PATCH_DIR contains nonexistent directory $(dir))))
215 # Configure
216 $(BUILD_DIR)/%/.stamp_configured:
217 @$(call step_start,configure)
218 @$(call MESSAGE,"Configuring")
219 $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
220 $($(PKG)_CONFIGURE_CMDS)
221 $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
222 @$(call step_end,configure)
223 $(Q)touch $@
225 # Build
226 $(BUILD_DIR)/%/.stamp_built::
227 @$(call step_start,build)
228 @$(call MESSAGE,"Building")
229 $(foreach hook,$($(PKG)_PRE_BUILD_HOOKS),$(call $(hook))$(sep))
230 +$($(PKG)_BUILD_CMDS)
231 $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep))
232 @$(call step_end,build)
233 $(Q)touch $@
235 # Install to host dir
236 $(BUILD_DIR)/%/.stamp_host_installed:
237 @$(call step_start,install-host)
238 @$(call MESSAGE,"Installing to host directory")
239 $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
240 +$($(PKG)_INSTALL_CMDS)
241 $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
242 @$(call step_end,install-host)
243 $(Q)touch $@
245 # Install to staging dir
247 # Some packages install libtool .la files alongside any installed
248 # libraries. These .la files sometimes refer to paths relative to the
249 # sysroot, which libtool will interpret as absolute paths to host
250 # libraries instead of the target libraries. Since this is not what we
251 # want, these paths are fixed by prefixing them with $(STAGING_DIR).
252 # As we configure with --prefix=/usr, this fix needs to be applied to
253 # any path that starts with /usr.
255 # To protect against the case that the output or staging directories or
256 # the pre-installed external toolchain themselves are under /usr, we first
257 # substitute away any occurrences of these directories with @BASE_DIR@,
258 # @STAGING_DIR@ and @TOOLCHAIN_EXTERNAL_INSTALL_DIR@ respectively.
260 # Note that STAGING_DIR can be outside BASE_DIR when the user sets
261 # BR2_HOST_DIR to a custom value. Note that TOOLCHAIN_EXTERNAL_INSTALL_DIR
262 # can be under @BASE_DIR@ when it's a downloaded toolchain, and can be
263 # empty when we use an internal toolchain.
265 $(BUILD_DIR)/%/.stamp_staging_installed:
266 @$(call step_start,install-staging)
267 @$(call MESSAGE,"Installing to staging directory")
268 $(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
269 +$($(PKG)_INSTALL_STAGING_CMDS)
270 $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
271 $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
272 $(call MESSAGE,"Fixing package configuration files") ;\
273 $(SED) "s,$(BASE_DIR),@BASE_DIR@,g" \
274 -e "s,$(STAGING_DIR),@STAGING_DIR@,g" \
275 -e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" \
276 -e "s,-I/usr/,-I@STAGING_DIR@/usr/,g" \
277 -e "s,-L/usr/,-L@STAGING_DIR@/usr/,g" \
278 -e "s,@STAGING_DIR@,$(STAGING_DIR),g" \
279 -e "s,@BASE_DIR@,$(BASE_DIR),g" \
280 $(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ;\
282 @$(call MESSAGE,"Fixing libtool files")
283 $(Q)find $(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
284 $(SED) "s:$(BASE_DIR):@BASE_DIR@:g" \
285 -e "s:$(STAGING_DIR):@STAGING_DIR@:g" \
286 $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
287 -e "s:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:g") \
288 -e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \
289 $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
290 -e "s:@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):g") \
291 -e "s:@STAGING_DIR@:$(STAGING_DIR):g" \
292 -e "s:@BASE_DIR@:$(BASE_DIR):g"
293 @$(call step_end,install-staging)
294 $(Q)touch $@
296 # Install to images dir
297 $(BUILD_DIR)/%/.stamp_images_installed:
298 @$(call step_start,install-image)
299 $(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
300 @$(call MESSAGE,"Installing to images directory")
301 +$($(PKG)_INSTALL_IMAGES_CMDS)
302 $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
303 @$(call step_end,install-image)
304 $(Q)touch $@
306 # Install to target dir
307 $(BUILD_DIR)/%/.stamp_target_installed:
308 @$(call step_start,install-target)
309 @$(call MESSAGE,"Installing to target")
310 $(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
311 +$($(PKG)_INSTALL_TARGET_CMDS)
312 $(if $(BR2_INIT_SYSTEMD),\
313 $($(PKG)_INSTALL_INIT_SYSTEMD))
314 $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
315 $($(PKG)_INSTALL_INIT_SYSV))
316 $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
317 $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
318 $(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
320 @$(call step_end,install-target)
321 $(Q)touch $@
323 # Remove package sources
324 $(BUILD_DIR)/%/.stamp_dircleaned:
325 rm -Rf $(@D)
327 ################################################################################
328 # virt-provides-single -- check that provider-pkg is the declared provider for
329 # the virtual package virt-pkg
331 # argument 1 is the lower-case name of the virtual package
332 # argument 2 is the upper-case name of the virtual package
333 # argument 3 is the lower-case name of the provider
335 # example:
336 # $(call virt-provides-single,libegl,LIBEGL,rpi-userland)
337 ################################################################################
338 define virt-provides-single
339 ifneq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),$(3))
340 $$(error Configuration error: both "$(3)" and $$(BR2_PACKAGE_PROVIDES_$(2))\
341 are selected as providers for virtual package "$(1)". Only one provider can\
342 be selected at a time. Please fix your configuration)
343 endif
344 endef
346 define pkg-graph-depends
347 @$$(INSTALL) -d $$(GRAPHS_DIR)
348 @cd "$$(CONFIG_DIR)"; \
349 $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \
350 -p $(1) $(2) -o $$(GRAPHS_DIR)/$$(@).dot
351 dot $$(BR2_GRAPH_DOT_OPTS) -T$$(BR_GRAPH_OUT) \
352 -o $$(GRAPHS_DIR)/$$(@).$$(BR_GRAPH_OUT) \
353 $$(GRAPHS_DIR)/$$(@).dot
354 endef
356 ################################################################################
357 # inner-generic-package -- generates the make targets needed to build a
358 # generic package
360 # argument 1 is the lowercase package name
361 # argument 2 is the uppercase package name, including a HOST_ prefix
362 # for host packages
363 # argument 3 is the uppercase package name, without the HOST_ prefix
364 # for host packages
365 # argument 4 is the type (target or host)
367 # Note about variable and function references: inside all blocks that are
368 # evaluated with $(eval), which includes all 'inner-xxx-package' blocks,
369 # specific rules apply with respect to variable and function references.
370 # - Numbered variables (parameters to the block) can be referenced with a single
371 # dollar sign: $(1), $(2), $(3), etc.
372 # - pkgdir and pkgname should be referenced with a single dollar sign too. These
373 # functions rely on 'the most recently parsed makefile' which is supposed to
374 # be the package .mk file. If we defer the evaluation of these functions using
375 # double dollar signs, then they may be evaluated too late, when other
376 # makefiles have already been parsed. One specific case is when $$(pkgdir) is
377 # assigned to a variable using deferred evaluation with '=' and this variable
378 # is used in a target rule outside the eval'ed inner block. In this case, the
379 # pkgdir will be that of the last makefile parsed by buildroot, which is not
380 # the expected value. This mechanism is for example used for the TARGET_PATCH
381 # rule.
382 # - All other variables should be referenced with a double dollar sign:
383 # $$(TARGET_DIR), $$($(2)_VERSION), etc. Also all make functions should be
384 # referenced with a double dollar sign: $$(subst), $$(call), $$(filter-out),
385 # etc. This rule ensures that these variables and functions are only expanded
386 # during the $(eval) step, and not earlier. Otherwise, unintuitive and
387 # undesired behavior occurs with respect to these variables and functions.
389 ################################################################################
391 define inner-generic-package
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)')
398 endif
399 PACKAGES_ALL += $(1)
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.
408 $(2)_TYPE = $(4)
409 $(2)_NAME = $(1)
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
419 # CVS.
420 ifndef $(2)_VERSION
421 ifdef $(3)_DL_VERSION
422 $(2)_DL_VERSION := $$($(3)_DL_VERSION)
423 else ifdef $(3)_VERSION
424 $(2)_DL_VERSION := $$($(3)_VERSION)
425 endif
426 else
427 $(2)_DL_VERSION := $$(strip $$($(2)_VERSION))
428 endif
429 $(2)_VERSION := $$(call sanitize,$$($(2)_DL_VERSION))
431 ifdef $(3)_OVERRIDE_SRCDIR
432 $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
433 endif
435 $(2)_BASE_NAME = $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
436 $(2)_RAW_BASE_NAME = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
437 $(2)_DL_DIR = $$(DL_DIR)/$$($(2)_BASE_NAME)
438 $(2)_DIR = $$(BUILD_DIR)/$$($(2)_BASE_NAME)
440 ifndef $(2)_SUBDIR
441 ifdef $(3)_SUBDIR
442 $(2)_SUBDIR = $$($(3)_SUBDIR)
443 else
444 $(2)_SUBDIR ?=
445 endif
446 endif
448 ifndef $(2)_STRIP_COMPONENTS
449 ifdef $(3)_STRIP_COMPONENTS
450 $(2)_STRIP_COMPONENTS = $$($(3)_STRIP_COMPONENTS)
451 else
452 $(2)_STRIP_COMPONENTS ?= 1
453 endif
454 endif
456 $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
457 $(2)_BUILDDIR ?= $$($(2)_SRCDIR)
459 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
460 $(2)_VERSION = custom
461 endif
463 ifndef $(2)_SOURCE
464 ifdef $(3)_SOURCE
465 $(2)_SOURCE = $$($(3)_SOURCE)
466 else ifdef $(2)_VERSION
467 $(2)_SOURCE ?= $$($(2)_RAW_BASE_NAME).tar.gz
468 endif
469 endif
471 # If FOO_ACTUAL_SOURCE_TARBALL is explicitly defined, it means FOO_SOURCE is
472 # indeed a binary (e.g. external toolchain) and FOO_ACTUAL_SOURCE_TARBALL/_SITE
473 # point to the actual sources tarball. Use the actual sources for legal-info.
474 # For most packages the FOO_SITE/FOO_SOURCE pair points to real source code,
475 # so these are the defaults for FOO_ACTUAL_*.
476 $(2)_ACTUAL_SOURCE_TARBALL ?= $$($(2)_SOURCE)
477 $(2)_ACTUAL_SOURCE_SITE ?= $$(call qstrip,$$($(2)_SITE))
479 ifndef $(2)_PATCH
480 ifdef $(3)_PATCH
481 $(2)_PATCH = $$($(3)_PATCH)
482 endif
483 endif
485 $(2)_ALL_DOWNLOADS = \
486 $$(foreach p,$$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\
487 $$(if $$(findstring ://,$$(p)),$$(p),\
488 $$($(2)_SITE)/$$(p)))
490 ifndef $(2)_SITE
491 ifdef $(3)_SITE
492 $(2)_SITE = $$($(3)_SITE)
493 endif
494 endif
496 ifndef $(2)_SITE_METHOD
497 ifdef $(3)_SITE_METHOD
498 $(2)_SITE_METHOD = $$($(3)_SITE_METHOD)
499 else
500 # Try automatic detection using the scheme part of the URI
501 $(2)_SITE_METHOD = $$(call geturischeme,$$($(2)_SITE))
502 endif
503 endif
505 # Do not accept to download git submodule if not using the git method
506 ifneq ($$($(2)_GIT_SUBMODULES),)
507 ifneq ($$($(2)_SITE_METHOD),git)
508 $$(error $(2) declares having git sub-modules, but does not use the \
509 'git' method (uses '$$($(2)_SITE_METHOD)' instead))
510 endif
511 endif
513 ifeq ($$($(2)_SITE_METHOD),local)
514 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
515 $(2)_OVERRIDE_SRCDIR = $$($(2)_SITE)
516 endif
517 endif
519 ifndef $(2)_LICENSE
520 ifdef $(3)_LICENSE
521 $(2)_LICENSE = $$($(3)_LICENSE)
522 endif
523 endif
525 $(2)_LICENSE ?= unknown
527 ifndef $(2)_LICENSE_FILES
528 ifdef $(3)_LICENSE_FILES
529 $(2)_LICENSE_FILES = $$($(3)_LICENSE_FILES)
530 endif
531 endif
533 ifndef $(2)_REDISTRIBUTE
534 ifdef $(3)_REDISTRIBUTE
535 $(2)_REDISTRIBUTE = $$($(3)_REDISTRIBUTE)
536 endif
537 endif
539 $(2)_REDISTRIBUTE ?= YES
541 $(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_RAW_BASE_NAME)
543 # When a target package is a toolchain dependency set this variable to
544 # 'NO' so the 'toolchain' dependency is not added to prevent a circular
545 # dependency
546 $(2)_ADD_TOOLCHAIN_DEPENDENCY ?= YES
548 ifeq ($(4),target)
549 ifneq ($(1),skeleton)
550 $(2)_DEPENDENCIES += skeleton
551 endif
552 ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
553 $(2)_DEPENDENCIES += toolchain
554 endif
555 endif
557 # Eliminate duplicates in dependencies
558 $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
559 $(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
560 $(2)_FINAL_ALL_DEPENDENCIES = $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))
562 $(2)_INSTALL_STAGING ?= NO
563 $(2)_INSTALL_IMAGES ?= NO
564 $(2)_INSTALL_TARGET ?= YES
566 # define sub-target stamps
567 $(2)_TARGET_INSTALL_TARGET = $$($(2)_DIR)/.stamp_target_installed
568 $(2)_TARGET_INSTALL_STAGING = $$($(2)_DIR)/.stamp_staging_installed
569 $(2)_TARGET_INSTALL_IMAGES = $$($(2)_DIR)/.stamp_images_installed
570 $(2)_TARGET_INSTALL_HOST = $$($(2)_DIR)/.stamp_host_installed
571 $(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built
572 $(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured
573 $(2)_TARGET_RSYNC = $$($(2)_DIR)/.stamp_rsynced
574 $(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched
575 $(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted
576 $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded
577 $(2)_TARGET_ACTUAL_SOURCE = $$($(2)_DIR)/.stamp_actual_downloaded
578 $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned
580 # default extract command
581 $(2)_EXTRACT_CMDS ?= \
582 $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \
583 $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \
584 -C $$($(2)_DIR) \
585 $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \
586 $$(TAR_OPTIONS) -)
588 # pre/post-steps hooks
589 $(2)_PRE_DOWNLOAD_HOOKS ?=
590 $(2)_POST_DOWNLOAD_HOOKS ?=
591 $(2)_PRE_EXTRACT_HOOKS ?=
592 $(2)_POST_EXTRACT_HOOKS ?=
593 $(2)_PRE_RSYNC_HOOKS ?=
594 $(2)_POST_RSYNC_HOOKS ?=
595 $(2)_PRE_PATCH_HOOKS ?=
596 $(2)_POST_PATCH_HOOKS ?=
597 $(2)_PRE_CONFIGURE_HOOKS ?=
598 $(2)_POST_CONFIGURE_HOOKS ?=
599 $(2)_PRE_BUILD_HOOKS ?=
600 $(2)_POST_BUILD_HOOKS ?=
601 $(2)_PRE_INSTALL_HOOKS ?=
602 $(2)_POST_INSTALL_HOOKS ?=
603 $(2)_PRE_INSTALL_STAGING_HOOKS ?=
604 $(2)_POST_INSTALL_STAGING_HOOKS ?=
605 $(2)_PRE_INSTALL_TARGET_HOOKS ?=
606 $(2)_POST_INSTALL_TARGET_HOOKS ?=
607 $(2)_PRE_INSTALL_IMAGES_HOOKS ?=
608 $(2)_POST_INSTALL_IMAGES_HOOKS ?=
609 $(2)_PRE_LEGAL_INFO_HOOKS ?=
610 $(2)_POST_LEGAL_INFO_HOOKS ?=
611 $(2)_TARGET_FINALIZE_HOOKS ?=
613 # human-friendly targets and target sequencing
614 $(1): $(1)-install
616 ifeq ($$($(2)_TYPE),host)
617 $(1)-install: $(1)-install-host
618 else
619 $(1)-install: $(1)-install-staging $(1)-install-target $(1)-install-images
620 endif
622 ifeq ($$($(2)_INSTALL_TARGET),YES)
623 $(1)-install-target: $$($(2)_TARGET_INSTALL_TARGET)
624 $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_BUILD)
625 else
626 $(1)-install-target:
627 endif
629 ifeq ($$($(2)_INSTALL_STAGING),YES)
630 $(1)-install-staging: $$($(2)_TARGET_INSTALL_STAGING)
631 $$($(2)_TARGET_INSTALL_STAGING): $$($(2)_TARGET_BUILD)
632 # Some packages use install-staging stuff for install-target
633 $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_INSTALL_STAGING)
634 else
635 $(1)-install-staging:
636 endif
638 ifeq ($$($(2)_INSTALL_IMAGES),YES)
639 $(1)-install-images: $$($(2)_TARGET_INSTALL_IMAGES)
640 $$($(2)_TARGET_INSTALL_IMAGES): $$($(2)_TARGET_BUILD)
641 else
642 $(1)-install-images:
643 endif
645 $(1)-install-host: $$($(2)_TARGET_INSTALL_HOST)
646 $$($(2)_TARGET_INSTALL_HOST): $$($(2)_TARGET_BUILD)
648 $(1)-build: $$($(2)_TARGET_BUILD)
649 $$($(2)_TARGET_BUILD): $$($(2)_TARGET_CONFIGURE)
651 # Since $(2)_FINAL_DEPENDENCIES are phony targets, they are always "newer"
652 # than $(2)_TARGET_CONFIGURE. This would force the configure step (and
653 # therefore the other steps as well) to be re-executed with every
654 # invocation of make. Therefore, make $(2)_FINAL_DEPENDENCIES an order-only
655 # dependency by using |.
657 $(1)-configure: $$($(2)_TARGET_CONFIGURE)
658 $$($(2)_TARGET_CONFIGURE): | $$($(2)_FINAL_DEPENDENCIES)
660 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dirs prepare
661 ifeq ($$(filter $(1),$$(DEPENDENCIES_HOST_PREREQ)),)
662 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dependencies
663 endif
665 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
666 # In the normal case (no package override), the sequence of steps is
667 # source, by downloading
668 # depends
669 # extract
670 # patch
671 # configure
672 $$($(2)_TARGET_CONFIGURE): $$($(2)_TARGET_PATCH)
674 $(1)-patch: $$($(2)_TARGET_PATCH)
675 $$($(2)_TARGET_PATCH): $$($(2)_TARGET_EXTRACT)
676 # Order-only dependency
677 $$($(2)_TARGET_PATCH): | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))
679 $(1)-extract: $$($(2)_TARGET_EXTRACT)
680 $$($(2)_TARGET_EXTRACT): $$($(2)_TARGET_SOURCE)
682 $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
684 $(1)-source: $$($(2)_TARGET_SOURCE)
686 $(1)-all-source: $(1)-legal-source
687 $(1)-legal-info: $(1)-legal-source
688 $(1)-legal-source: $(1)-source
690 # Only download the actual source if it differs from the 'main' archive
691 ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),)
692 ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_SOURCE))
693 $(1)-legal-source: $$($(2)_TARGET_ACTUAL_SOURCE)
694 endif # actual sources != sources
695 endif # actual sources != ""
697 $(1)-source-check:
698 $$(foreach p,$$($(2)_ALL_DOWNLOADS),$$(call SOURCE_CHECK,$$(p))$$(sep))
700 $(1)-external-deps:
701 @for p in $$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS) ; do \
702 echo `basename $$$$p` ; \
703 done
704 else
705 # In the package override case, the sequence of steps
706 # source, by rsyncing
707 # depends
708 # configure
710 # Use an order-only dependency so the "<pkg>-clean-for-rebuild" rule
711 # can remove the stamp file without triggering the configure step.
712 $$($(2)_TARGET_CONFIGURE): | $$($(2)_TARGET_RSYNC)
714 $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
716 $(1)-patch: $(1)-rsync
717 $(1)-extract: $(1)-rsync
719 $(1)-rsync: $$($(2)_TARGET_RSYNC)
721 $(1)-source:
722 $(1)-legal-source:
724 $(1)-source-check:
725 test -d $$($(2)_OVERRIDE_SRCDIR)
727 $(1)-external-deps:
728 @echo "file://$$($(2)_OVERRIDE_SRCDIR)"
729 endif
731 $(1)-show-version:
732 @echo $$($(2)_VERSION)
734 $(1)-show-depends:
735 @echo $$($(2)_FINAL_ALL_DEPENDENCIES)
737 $(1)-show-rdepends:
738 @echo $$($(2)_RDEPENDENCIES)
740 $(1)-graph-depends: graph-depends-requirements
741 $(call pkg-graph-depends,$(1),--direct)
743 $(1)-graph-rdepends: graph-depends-requirements
744 $(call pkg-graph-depends,$(1),--reverse)
746 $(1)-all-source: $(1)-source
747 $(1)-all-source: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-source)
749 $(1)-all-source-check: $(1)-source-check
750 $(1)-all-source-check: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-source-check)
752 $(1)-all-external-deps: $(1)-external-deps
753 $(1)-all-external-deps: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-external-deps)
755 $(1)-all-legal-info: $(1)-legal-info
756 $(1)-all-legal-info: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-legal-info)
758 $(1)-dirclean: $$($(2)_TARGET_DIRCLEAN)
760 $(1)-clean-for-reinstall:
761 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
762 rm -f $$($(2)_TARGET_RSYNC)
763 endif
764 rm -f $$($(2)_TARGET_INSTALL_STAGING)
765 rm -f $$($(2)_TARGET_INSTALL_TARGET)
766 rm -f $$($(2)_TARGET_INSTALL_IMAGES)
767 rm -f $$($(2)_TARGET_INSTALL_HOST)
769 $(1)-reinstall: $(1)-clean-for-reinstall $(1)
771 $(1)-clean-for-rebuild: $(1)-clean-for-reinstall
772 rm -f $$($(2)_TARGET_BUILD)
774 $(1)-rebuild: $(1)-clean-for-rebuild $(1)
776 $(1)-clean-for-reconfigure: $(1)-clean-for-rebuild
777 rm -f $$($(2)_TARGET_CONFIGURE)
779 $(1)-reconfigure: $(1)-clean-for-reconfigure $(1)
781 # define the PKG variable for all targets, containing the
782 # uppercase package variable prefix
783 $$($(2)_TARGET_INSTALL_TARGET): PKG=$(2)
784 $$($(2)_TARGET_INSTALL_STAGING): PKG=$(2)
785 $$($(2)_TARGET_INSTALL_IMAGES): PKG=$(2)
786 $$($(2)_TARGET_INSTALL_HOST): PKG=$(2)
787 $$($(2)_TARGET_BUILD): PKG=$(2)
788 $$($(2)_TARGET_CONFIGURE): PKG=$(2)
789 $$($(2)_TARGET_RSYNC): SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
790 $$($(2)_TARGET_RSYNC): PKG=$(2)
791 $$($(2)_TARGET_PATCH): PKG=$(2)
792 $$($(2)_TARGET_PATCH): RAWNAME=$$(patsubst host-%,%,$(1))
793 $$($(2)_TARGET_PATCH): PKGDIR=$(pkgdir)
794 $$($(2)_TARGET_EXTRACT): PKG=$(2)
795 $$($(2)_TARGET_SOURCE): PKG=$(2)
796 $$($(2)_TARGET_SOURCE): PKGDIR=$(pkgdir)
797 $$($(2)_TARGET_ACTUAL_SOURCE): PKG=$(2)
798 $$($(2)_TARGET_ACTUAL_SOURCE): PKGDIR=$(pkgdir)
799 $$($(2)_TARGET_DIRCLEAN): PKG=$(2)
801 # Compute the name of the Kconfig option that correspond to the
802 # package being enabled. We handle three cases: the special Linux
803 # kernel case, the bootloaders case, and the normal packages case.
804 ifeq ($(1),linux)
805 $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
806 else ifneq ($$(filter boot/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/boot/%),$(pkgdir)),)
807 $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
808 else ifneq ($$(filter toolchain/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/toolchain/%),$(pkgdir)),)
809 $(2)_KCONFIG_VAR = BR2_$(2)
810 else
811 $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
812 endif
814 # legal-info: declare dependencies and set values used later for the manifest
815 ifneq ($$($(2)_LICENSE_FILES),)
816 $(2)_MANIFEST_LICENSE_FILES = $$($(2)_LICENSE_FILES)
817 endif
819 # We need to extract and patch a package to be able to retrieve its
820 # license files (if any) and the list of patches applied to it (if
821 # any).
822 $(1)-legal-info: $(1)-patch
824 # We only save the sources of packages we want to redistribute, that are
825 # non-overriden (local or true override).
826 ifeq ($$($(2)_REDISTRIBUTE),YES)
827 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
828 # Packages that have a tarball need it downloaded beforehand
829 $(1)-legal-info: $(1)-source $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))
830 endif
831 endif
833 # legal-info: produce legally relevant info.
834 $(1)-legal-info:
835 # Packages without a source are assumed to be part of Buildroot, skip them.
836 $$(foreach hook,$$($(2)_PRE_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
837 ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
839 # Save license files if defined
840 # We save the license files for any kind of package: normal, local,
841 # overridden, or non-redistributable alike.
842 # The reason to save license files even for no-redistribute packages
843 # is that the license still applies to the files distributed as part
844 # of the rootfs, even if the sources are not themselves redistributed.
845 ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
846 @$$(call legal-warning-pkg,$$($(2)_RAW_BASE_NAME),cannot save license ($(2)_LICENSE_FILES not defined))
847 else
848 @$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAW_BASE_NAME),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
849 endif # license files
851 ifeq ($$($(2)_SITE_METHOD),local)
852 # Packages without a tarball: don't save and warn
853 @$$(call legal-warning-nosource,$$($(2)_RAWNAME),local)
855 else ifneq ($$($(2)_OVERRIDE_SRCDIR),)
856 @$$(call legal-warning-nosource,$$($(2)_RAWNAME),override)
858 else
859 # Other packages
861 ifeq ($$($(2)_REDISTRIBUTE),YES)
862 # Save the source tarball and any extra downloads, but not
863 # patches, as they are handled specially afterwards.
864 $$(foreach e,$$($(2)_ACTUAL_SOURCE_TARBALL) $$(notdir $$($(2)_EXTRA_DOWNLOADS)),\
865 $$(Q)support/scripts/hardlink-or-copy \
866 $$(DL_DIR)/$$(e) \
867 $$($(2)_REDIST_SOURCES_DIR)$$(sep))
868 # Save patches and generate the series file
869 $$(Q)while read f; do \
870 support/scripts/hardlink-or-copy \
871 $$$${f} \
872 $$($(2)_REDIST_SOURCES_DIR) || exit 1; \
873 printf "%s\n" "$$$${f##*/}" >>$$($(2)_REDIST_SOURCES_DIR)/series || exit 1; \
874 done <$$($(2)_DIR)/.applied_patches_list
875 endif # redistribute
877 endif # other packages
878 @$$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_ACTUAL_SOURCE_SITE),$$(call UPPERCASE,$(4)))
879 endif # ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
880 $$(foreach hook,$$($(2)_POST_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
882 # add package to the general list of targets if requested by the buildroot
883 # configuration
884 ifeq ($$($$($(2)_KCONFIG_VAR)),y)
886 # Ensure the calling package is the declared provider for all the virtual
887 # packages it claims to be an implementation of.
888 ifneq ($$($(2)_PROVIDES),)
889 $$(foreach pkg,$$($(2)_PROVIDES),\
890 $$(eval $$(call virt-provides-single,$$(pkg),$$(call UPPERCASE,$$(pkg)),$(1))$$(sep)))
891 endif
893 # Register package as a reverse-dependencies of all its dependencies
894 $$(eval $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),\
895 $$(call UPPERCASE,$$(p))_RDEPENDENCIES += $(1)$$(sep)))
897 # Ensure unified variable name conventions between all packages Some
898 # of the variables are used by more than one infrastructure; so,
899 # rather than duplicating the checks in each infrastructure, we check
900 # all variables here in pkg-generic, even though pkg-generic should
901 # have no knowledge of infra-specific variables.
902 $(eval $(call check-deprecated-variable,$(2)_MAKE_OPT,$(2)_MAKE_OPTS))
903 $(eval $(call check-deprecated-variable,$(2)_INSTALL_OPT,$(2)_INSTALL_OPTS))
904 $(eval $(call check-deprecated-variable,$(2)_INSTALL_TARGET_OPT,$(2)_INSTALL_TARGET_OPTS))
905 $(eval $(call check-deprecated-variable,$(2)_INSTALL_STAGING_OPT,$(2)_INSTALL_STAGING_OPTS))
906 $(eval $(call check-deprecated-variable,$(2)_INSTALL_HOST_OPT,$(2)_INSTALL_HOST_OPTS))
907 $(eval $(call check-deprecated-variable,$(2)_AUTORECONF_OPT,$(2)_AUTORECONF_OPTS))
908 $(eval $(call check-deprecated-variable,$(2)_CONF_OPT,$(2)_CONF_OPTS))
909 $(eval $(call check-deprecated-variable,$(2)_BUILD_OPT,$(2)_BUILD_OPTS))
910 $(eval $(call check-deprecated-variable,$(2)_GETTEXTIZE_OPT,$(2)_GETTEXTIZE_OPTS))
911 $(eval $(call check-deprecated-variable,$(2)_KCONFIG_OPT,$(2)_KCONFIG_OPTS))
913 PACKAGES += $(1)
915 ifneq ($$($(2)_PERMISSIONS),)
916 PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep)
917 endif
918 ifneq ($$($(2)_DEVICES),)
919 PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep)
920 endif
921 ifneq ($$($(2)_USERS),)
922 PACKAGES_USERS += $$($(2)_USERS)$$(sep)
923 endif
924 TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
926 ifeq ($$($(2)_SITE_METHOD),svn)
927 DL_TOOLS_DEPENDENCIES += svn
928 else ifeq ($$($(2)_SITE_METHOD),git)
929 DL_TOOLS_DEPENDENCIES += git
930 else ifeq ($$($(2)_SITE_METHOD),bzr)
931 DL_TOOLS_DEPENDENCIES += bzr
932 else ifeq ($$($(2)_SITE_METHOD),scp)
933 DL_TOOLS_DEPENDENCIES += scp ssh
934 else ifeq ($$($(2)_SITE_METHOD),hg)
935 DL_TOOLS_DEPENDENCIES += hg
936 else ifeq ($$($(2)_SITE_METHOD),cvs)
937 DL_TOOLS_DEPENDENCIES += cvs
938 endif # SITE_METHOD
940 DL_TOOLS_DEPENDENCIES += $$(call extractor-dependency,$$($(2)_SOURCE))
942 # Ensure all virtual targets are PHONY. Listed alphabetically.
943 .PHONY: $(1) \
944 $(1)-all-external-deps \
945 $(1)-all-legal-info \
946 $(1)-all-source \
947 $(1)-all-source-check \
948 $(1)-build \
949 $(1)-clean-for-rebuild \
950 $(1)-clean-for-reconfigure \
951 $(1)-clean-for-reinstall \
952 $(1)-configure \
953 $(1)-depends \
954 $(1)-dirclean \
955 $(1)-external-deps \
956 $(1)-extract \
957 $(1)-graph-depends \
958 $(1)-install \
959 $(1)-install-host \
960 $(1)-install-images \
961 $(1)-install-staging \
962 $(1)-install-target \
963 $(1)-legal-info \
964 $(1)-legal-source \
965 $(1)-patch \
966 $(1)-rebuild \
967 $(1)-reconfigure \
968 $(1)-reinstall \
969 $(1)-rsync \
970 $(1)-show-depends \
971 $(1)-show-version \
972 $(1)-source \
973 $(1)-source-check
975 ifneq ($$($(2)_SOURCE),)
976 ifeq ($$($(2)_SITE),)
977 $$(error $(2)_SITE cannot be empty when $(2)_SOURCE is not)
978 endif
979 endif
981 ifeq ($$(patsubst %/,ERROR,$$($(2)_SITE)),ERROR)
982 $$(error $(2)_SITE ($$($(2)_SITE)) cannot have a trailing slash)
983 endif
985 ifneq ($$($(2)_HELP_CMDS),)
986 HELP_PACKAGES += $(2)
987 endif
989 endif # $(2)_KCONFIG_VAR
990 endef # inner-generic-package
992 ################################################################################
993 # generic-package -- the target generator macro for generic packages
994 ################################################################################
996 # In the case of target packages, keep the package name "pkg"
997 generic-package = $(call inner-generic-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
998 # In the case of host packages, turn the package name "pkg" into "host-pkg"
999 host-generic-package = $(call inner-generic-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
1001 # :mode=makefile: