configs/bananapro: bump Linux to 4.10.4
[buildroot-gz.git] / package / pkg-generic.mk
blobe8a8021e3c37b23ebce36add5aa12b85604b1faf
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 # This hook checks that host packages that need libraries that we build
91 # have a proper DT_RPATH or DT_RUNPATH tag
92 define check_host_rpath
93 $(if $(filter install-host,$(2)),\
94 $(if $(filter end,$(1)),support/scripts/check-host-rpath $(3) $(HOST_DIR)))
95 endef
96 GLOBAL_INSTRUMENTATION_HOOKS += check_host_rpath
98 define step_check_build_dir_one
99 if [ -d $(2) ]; then \
100 printf "%s: installs files in %s\n" $(1) $(2) >&2; \
101 exit 1; \
103 endef
105 define step_check_build_dir
106 $(if $(filter install-staging,$(2)),\
107 $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(STAGING_DIR)/$(O))))
108 $(if $(filter install-target,$(2)),\
109 $(if $(filter end,$(1)),$(call step_check_build_dir_one,$(3),$(TARGET_DIR)/$(O))))
110 endef
111 GLOBAL_INSTRUMENTATION_HOOKS += step_check_build_dir
113 # User-supplied script
114 ifneq ($(BR2_INSTRUMENTATION_SCRIPTS),)
115 define step_user
116 @$(foreach user_hook, $(BR2_INSTRUMENTATION_SCRIPTS), \
117 $(EXTRA_ENV) $(user_hook) "$(1)" "$(2)" "$(3)"$(sep))
118 endef
119 GLOBAL_INSTRUMENTATION_HOOKS += step_user
120 endif
122 ################################################################################
123 # Implicit targets -- produce a stamp file for each step of a package build
124 ################################################################################
126 # Retrieve the archive
127 $(BUILD_DIR)/%/.stamp_downloaded:
128 $(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
129 # Only show the download message if it isn't already downloaded
130 $(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
131 if test ! -e $(DL_DIR)/`basename $$p` ; then \
132 $(call MESSAGE,"Downloading") ; \
133 break ; \
134 fi ; \
135 done
136 $(foreach p,$($(PKG)_ALL_DOWNLOADS),$(call DOWNLOAD,$(p))$(sep))
137 $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
138 $(Q)mkdir -p $(@D)
139 $(Q)touch $@
141 # Retrieve actual source archive, e.g. for prebuilt external toolchains
142 $(BUILD_DIR)/%/.stamp_actual_downloaded:
143 $(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL)); \
144 $(Q)mkdir -p $(@D)
145 $(Q)touch $@
147 # Unpack the archive
148 $(BUILD_DIR)/%/.stamp_extracted:
149 @$(call step_start,extract)
150 @$(call MESSAGE,"Extracting")
151 $(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
152 $(Q)mkdir -p $(@D)
153 $($(PKG)_EXTRACT_CMDS)
154 # some packages have messed up permissions inside
155 $(Q)chmod -R +rw $(@D)
156 $(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
157 @$(call step_end,extract)
158 $(Q)touch $@
160 # Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
161 # used.
162 $(BUILD_DIR)/%/.stamp_rsynced:
163 @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
164 $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
165 @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
166 rsync -au --chmod=u=rwX,go=rX $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
167 $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
168 $(Q)touch $@
170 # Patch
172 # The RAWNAME variable is the lowercased package name, which allows to
173 # find the package directory (typically package/<pkgname>) and the
174 # prefix of the patches
176 # For BR2_GLOBAL_PATCH_DIR, only generate if it is defined
177 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $(PKGDIR)
178 $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS += $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))
179 $(BUILD_DIR)/%/.stamp_patched:
180 @$(call step_start,patch)
181 @$(call MESSAGE,"Patching")
182 $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
183 $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) $(@D) $(DL_DIR) $(notdir $(p))$(sep))
184 $(Q)( \
185 for D in $(PATCH_BASE_DIRS); do \
186 if test -d $${D}; then \
187 if test -d $${D}/$($(PKG)_VERSION); then \
188 $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \
189 else \
190 $(APPLY_PATCHES) $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \
191 fi; \
192 fi; \
193 done; \
195 $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep))
196 @$(call step_end,patch)
197 $(Q)touch $@
199 # Check that all directories specified in BR2_GLOBAL_PATCH_DIR exist.
200 $(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\
201 $(if $(wildcard $(dir)),,\
202 $(error BR2_GLOBAL_PATCH_DIR contains nonexistent directory $(dir))))
204 # Configure
205 $(BUILD_DIR)/%/.stamp_configured:
206 @$(call step_start,configure)
207 @$(call MESSAGE,"Configuring")
208 $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
209 $($(PKG)_CONFIGURE_CMDS)
210 $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
211 @$(call step_end,configure)
212 $(Q)touch $@
214 # Build
215 $(BUILD_DIR)/%/.stamp_built::
216 @$(call step_start,build)
217 @$(call MESSAGE,"Building")
218 $(foreach hook,$($(PKG)_PRE_BUILD_HOOKS),$(call $(hook))$(sep))
219 +$($(PKG)_BUILD_CMDS)
220 $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep))
221 @$(call step_end,build)
222 $(Q)touch $@
224 # Install to host dir
225 $(BUILD_DIR)/%/.stamp_host_installed:
226 @$(call step_start,install-host)
227 @$(call MESSAGE,"Installing to host directory")
228 $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
229 +$($(PKG)_INSTALL_CMDS)
230 $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
231 @$(call step_end,install-host)
232 $(Q)touch $@
234 # Install to staging dir
236 # Some packages install libtool .la files alongside any installed
237 # libraries. These .la files sometimes refer to paths relative to the
238 # sysroot, which libtool will interpret as absolute paths to host
239 # libraries instead of the target libraries. Since this is not what we
240 # want, these paths are fixed by prefixing them with $(STAGING_DIR).
241 # As we configure with --prefix=/usr, this fix needs to be applied to
242 # any path that starts with /usr.
244 # To protect against the case that the output or staging directories or
245 # the pre-installed external toolchain themselves are under /usr, we first
246 # substitute away any occurrences of these directories with @BASE_DIR@,
247 # @STAGING_DIR@ and @TOOLCHAIN_EXTERNAL_INSTALL_DIR@ respectively.
249 # Note that STAGING_DIR can be outside BASE_DIR when the user sets
250 # BR2_HOST_DIR to a custom value. Note that TOOLCHAIN_EXTERNAL_INSTALL_DIR
251 # can be under @BASE_DIR@ when it's a downloaded toolchain, and can be
252 # empty when we use an internal toolchain.
254 $(BUILD_DIR)/%/.stamp_staging_installed:
255 @$(call step_start,install-staging)
256 @$(call MESSAGE,"Installing to staging directory")
257 $(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
258 +$($(PKG)_INSTALL_STAGING_CMDS)
259 $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
260 $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
261 $(call MESSAGE,"Fixing package configuration files") ;\
262 $(SED) "s,$(BASE_DIR),@BASE_DIR@,g" \
263 -e "s,$(STAGING_DIR),@STAGING_DIR@,g" \
264 -e "s,^\(exec_\)\?prefix=.*,\1prefix=@STAGING_DIR@/usr,g" \
265 -e "s,-I/usr/,-I@STAGING_DIR@/usr/,g" \
266 -e "s,-L/usr/,-L@STAGING_DIR@/usr/,g" \
267 -e "s,@STAGING_DIR@,$(STAGING_DIR),g" \
268 -e "s,@BASE_DIR@,$(BASE_DIR),g" \
269 $(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ;\
271 @$(call MESSAGE,"Fixing libtool files")
272 $(Q)find $(STAGING_DIR)/usr/lib* -name "*.la" | xargs --no-run-if-empty \
273 $(SED) "s:$(BASE_DIR):@BASE_DIR@:g" \
274 -e "s:$(STAGING_DIR):@STAGING_DIR@:g" \
275 $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
276 -e "s:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:g") \
277 -e "s:\(['= ]\)/usr:\\1@STAGING_DIR@/usr:g" \
278 $(if $(TOOLCHAIN_EXTERNAL_INSTALL_DIR),\
279 -e "s:@TOOLCHAIN_EXTERNAL_INSTALL_DIR@:$(TOOLCHAIN_EXTERNAL_INSTALL_DIR):g") \
280 -e "s:@STAGING_DIR@:$(STAGING_DIR):g" \
281 -e "s:@BASE_DIR@:$(BASE_DIR):g"
282 @$(call step_end,install-staging)
283 $(Q)touch $@
285 # Install to images dir
286 $(BUILD_DIR)/%/.stamp_images_installed:
287 @$(call step_start,install-image)
288 $(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
289 @$(call MESSAGE,"Installing to images directory")
290 +$($(PKG)_INSTALL_IMAGES_CMDS)
291 $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
292 @$(call step_end,install-image)
293 $(Q)touch $@
295 # Install to target dir
296 $(BUILD_DIR)/%/.stamp_target_installed:
297 @$(call step_start,install-target)
298 @$(call MESSAGE,"Installing to target")
299 $(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
300 +$($(PKG)_INSTALL_TARGET_CMDS)
301 $(if $(BR2_INIT_SYSTEMD),\
302 $($(PKG)_INSTALL_INIT_SYSTEMD))
303 $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
304 $($(PKG)_INSTALL_INIT_SYSV))
305 $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
306 $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
307 $(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
309 @$(call step_end,install-target)
310 $(Q)touch $@
312 # Remove package sources
313 $(BUILD_DIR)/%/.stamp_dircleaned:
314 rm -Rf $(@D)
316 ################################################################################
317 # virt-provides-single -- check that provider-pkg is the declared provider for
318 # the virtual package virt-pkg
320 # argument 1 is the lower-case name of the virtual package
321 # argument 2 is the upper-case name of the virtual package
322 # argument 3 is the lower-case name of the provider
324 # example:
325 # $(call virt-provides-single,libegl,LIBEGL,rpi-userland)
326 ################################################################################
327 define virt-provides-single
328 ifneq ($$(call qstrip,$$(BR2_PACKAGE_PROVIDES_$(2))),$(3))
329 $$(error Configuration error: both "$(3)" and $$(BR2_PACKAGE_PROVIDES_$(2))\
330 are selected as providers for virtual package "$(1)". Only one provider can\
331 be selected at a time. Please fix your configuration)
332 endif
333 endef
335 define pkg-graph-depends
336 @$$(INSTALL) -d $$(GRAPHS_DIR)
337 @cd "$$(CONFIG_DIR)"; \
338 $$(TOPDIR)/support/scripts/graph-depends $$(BR2_GRAPH_DEPS_OPTS) \
339 -p $(1) $(2) -o $$(GRAPHS_DIR)/$$(@).dot
340 dot $$(BR2_GRAPH_DOT_OPTS) -T$$(BR_GRAPH_OUT) \
341 -o $$(GRAPHS_DIR)/$$(@).$$(BR_GRAPH_OUT) \
342 $$(GRAPHS_DIR)/$$(@).dot
343 endef
345 ################################################################################
346 # inner-generic-package -- generates the make targets needed to build a
347 # generic package
349 # argument 1 is the lowercase package name
350 # argument 2 is the uppercase package name, including a HOST_ prefix
351 # for host packages
352 # argument 3 is the uppercase package name, without the HOST_ prefix
353 # for host packages
354 # argument 4 is the type (target or host)
356 # Note about variable and function references: inside all blocks that are
357 # evaluated with $(eval), which includes all 'inner-xxx-package' blocks,
358 # specific rules apply with respect to variable and function references.
359 # - Numbered variables (parameters to the block) can be referenced with a single
360 # dollar sign: $(1), $(2), $(3), etc.
361 # - pkgdir and pkgname should be referenced with a single dollar sign too. These
362 # functions rely on 'the most recently parsed makefile' which is supposed to
363 # be the package .mk file. If we defer the evaluation of these functions using
364 # double dollar signs, then they may be evaluated too late, when other
365 # makefiles have already been parsed. One specific case is when $$(pkgdir) is
366 # assigned to a variable using deferred evaluation with '=' and this variable
367 # is used in a target rule outside the eval'ed inner block. In this case, the
368 # pkgdir will be that of the last makefile parsed by buildroot, which is not
369 # the expected value. This mechanism is for example used for the TARGET_PATCH
370 # rule.
371 # - All other variables should be referenced with a double dollar sign:
372 # $$(TARGET_DIR), $$($(2)_VERSION), etc. Also all make functions should be
373 # referenced with a double dollar sign: $$(subst), $$(call), $$(filter-out),
374 # etc. This rule ensures that these variables and functions are only expanded
375 # during the $(eval) step, and not earlier. Otherwise, unintuitive and
376 # undesired behavior occurs with respect to these variables and functions.
378 ################################################################################
380 define inner-generic-package
382 # Ensure the package is only declared once, i.e. do not accept that a
383 # package be re-defined by a br2-external tree
384 ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),)
385 $$(error Package '$(1)' defined a second time in '$(pkgdir)'; \
386 previous definition was in '$$($(2)_PKGDIR)')
387 endif
388 PACKAGES_ALL += $(1)
390 # Define default values for various package-related variables, if not
391 # already defined. For some variables (version, source, site and
392 # subdir), if they are undefined, we try to see if a variable without
393 # the HOST_ prefix is defined. If so, we use such a variable, so that
394 # this information has only to be specified once, for both the
395 # target and host packages of a given .mk file.
397 $(2)_TYPE = $(4)
398 $(2)_NAME = $(1)
399 $(2)_RAWNAME = $$(patsubst host-%,%,$(1))
400 $(2)_PKGDIR = $(pkgdir)
402 # Keep the package version that may contain forward slashes in the _DL_VERSION
403 # variable, then replace all forward slashes ('/') by underscores ('_') to
404 # sanitize the package version that is used in paths, directory and file names.
405 # Forward slashes may appear in the package's version when pointing to a
406 # version control system branch or tag, for example remotes/origin/1_10_stable.
407 # Similar for spaces and colons (:) that may appear in date-based revisions for
408 # CVS.
409 ifndef $(2)_VERSION
410 ifdef $(3)_DL_VERSION
411 $(2)_DL_VERSION := $$($(3)_DL_VERSION)
412 else ifdef $(3)_VERSION
413 $(2)_DL_VERSION := $$($(3)_VERSION)
414 endif
415 else
416 $(2)_DL_VERSION := $$(strip $$($(2)_VERSION))
417 endif
418 $(2)_VERSION := $$(call sanitize,$$($(2)_DL_VERSION))
420 ifdef $(3)_OVERRIDE_SRCDIR
421 $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
422 endif
424 $(2)_BASE_NAME = $$(if $$($(2)_VERSION),$(1)-$$($(2)_VERSION),$(1))
425 $(2)_RAW_BASE_NAME = $$(if $$($(2)_VERSION),$$($(2)_RAWNAME)-$$($(2)_VERSION),$$($(2)_RAWNAME))
426 $(2)_DL_DIR = $$(DL_DIR)/$$($(2)_BASE_NAME)
427 $(2)_DIR = $$(BUILD_DIR)/$$($(2)_BASE_NAME)
429 ifndef $(2)_SUBDIR
430 ifdef $(3)_SUBDIR
431 $(2)_SUBDIR = $$($(3)_SUBDIR)
432 else
433 $(2)_SUBDIR ?=
434 endif
435 endif
437 ifndef $(2)_STRIP_COMPONENTS
438 ifdef $(3)_STRIP_COMPONENTS
439 $(2)_STRIP_COMPONENTS = $$($(3)_STRIP_COMPONENTS)
440 else
441 $(2)_STRIP_COMPONENTS ?= 1
442 endif
443 endif
445 $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR)
446 $(2)_BUILDDIR ?= $$($(2)_SRCDIR)
448 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
449 $(2)_VERSION = custom
450 endif
452 ifndef $(2)_SOURCE
453 ifdef $(3)_SOURCE
454 $(2)_SOURCE = $$($(3)_SOURCE)
455 else ifdef $(2)_VERSION
456 $(2)_SOURCE ?= $$($(2)_RAW_BASE_NAME).tar.gz
457 endif
458 endif
460 # If FOO_ACTUAL_SOURCE_TARBALL is explicitly defined, it means FOO_SOURCE is
461 # indeed a binary (e.g. external toolchain) and FOO_ACTUAL_SOURCE_TARBALL/_SITE
462 # point to the actual sources tarball. Use the actual sources for legal-info.
463 # For most packages the FOO_SITE/FOO_SOURCE pair points to real source code,
464 # so these are the defaults for FOO_ACTUAL_*.
465 $(2)_ACTUAL_SOURCE_TARBALL ?= $$($(2)_SOURCE)
466 $(2)_ACTUAL_SOURCE_SITE ?= $$(call qstrip,$$($(2)_SITE))
468 ifndef $(2)_PATCH
469 ifdef $(3)_PATCH
470 $(2)_PATCH = $$($(3)_PATCH)
471 endif
472 endif
474 $(2)_ALL_DOWNLOADS = \
475 $$(foreach p,$$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\
476 $$(if $$(findstring ://,$$(p)),$$(p),\
477 $$($(2)_SITE)/$$(p)))
479 ifndef $(2)_SITE
480 ifdef $(3)_SITE
481 $(2)_SITE = $$($(3)_SITE)
482 endif
483 endif
485 ifndef $(2)_SITE_METHOD
486 ifdef $(3)_SITE_METHOD
487 $(2)_SITE_METHOD = $$($(3)_SITE_METHOD)
488 else
489 # Try automatic detection using the scheme part of the URI
490 $(2)_SITE_METHOD = $$(call geturischeme,$$($(2)_SITE))
491 endif
492 endif
494 # Do not accept to download git submodule if not using the git method
495 ifneq ($$($(2)_GIT_SUBMODULES),)
496 ifneq ($$($(2)_SITE_METHOD),git)
497 $$(error $(2) declares having git sub-modules, but does not use the \
498 'git' method (uses '$$($(2)_SITE_METHOD)' instead))
499 endif
500 endif
502 ifeq ($$($(2)_SITE_METHOD),local)
503 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
504 $(2)_OVERRIDE_SRCDIR = $$($(2)_SITE)
505 endif
506 endif
508 ifndef $(2)_LICENSE
509 ifdef $(3)_LICENSE
510 $(2)_LICENSE = $$($(3)_LICENSE)
511 endif
512 endif
514 $(2)_LICENSE ?= unknown
516 ifndef $(2)_LICENSE_FILES
517 ifdef $(3)_LICENSE_FILES
518 $(2)_LICENSE_FILES = $$($(3)_LICENSE_FILES)
519 endif
520 endif
522 ifndef $(2)_REDISTRIBUTE
523 ifdef $(3)_REDISTRIBUTE
524 $(2)_REDISTRIBUTE = $$($(3)_REDISTRIBUTE)
525 endif
526 endif
528 $(2)_REDISTRIBUTE ?= YES
530 $(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2)_RAW_BASE_NAME)
532 # When a target package is a toolchain dependency set this variable to
533 # 'NO' so the 'toolchain' dependency is not added to prevent a circular
534 # dependency
535 $(2)_ADD_TOOLCHAIN_DEPENDENCY ?= YES
537 ifeq ($(4),target)
538 ifneq ($(1),skeleton)
539 $(2)_DEPENDENCIES += skeleton
540 endif
541 ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
542 $(2)_DEPENDENCIES += toolchain
543 endif
544 endif
546 # Eliminate duplicates in dependencies
547 $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
548 $(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
549 $(2)_FINAL_ALL_DEPENDENCIES = $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))
551 $(2)_INSTALL_STAGING ?= NO
552 $(2)_INSTALL_IMAGES ?= NO
553 $(2)_INSTALL_TARGET ?= YES
555 # define sub-target stamps
556 $(2)_TARGET_INSTALL_TARGET = $$($(2)_DIR)/.stamp_target_installed
557 $(2)_TARGET_INSTALL_STAGING = $$($(2)_DIR)/.stamp_staging_installed
558 $(2)_TARGET_INSTALL_IMAGES = $$($(2)_DIR)/.stamp_images_installed
559 $(2)_TARGET_INSTALL_HOST = $$($(2)_DIR)/.stamp_host_installed
560 $(2)_TARGET_BUILD = $$($(2)_DIR)/.stamp_built
561 $(2)_TARGET_CONFIGURE = $$($(2)_DIR)/.stamp_configured
562 $(2)_TARGET_RSYNC = $$($(2)_DIR)/.stamp_rsynced
563 $(2)_TARGET_PATCH = $$($(2)_DIR)/.stamp_patched
564 $(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted
565 $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded
566 $(2)_TARGET_ACTUAL_SOURCE = $$($(2)_DIR)/.stamp_actual_downloaded
567 $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned
569 # default extract command
570 $(2)_EXTRACT_CMDS ?= \
571 $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \
572 $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \
573 -C $$($(2)_DIR) \
574 $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \
575 $$(TAR_OPTIONS) -)
577 # pre/post-steps hooks
578 $(2)_PRE_DOWNLOAD_HOOKS ?=
579 $(2)_POST_DOWNLOAD_HOOKS ?=
580 $(2)_PRE_EXTRACT_HOOKS ?=
581 $(2)_POST_EXTRACT_HOOKS ?=
582 $(2)_PRE_RSYNC_HOOKS ?=
583 $(2)_POST_RSYNC_HOOKS ?=
584 $(2)_PRE_PATCH_HOOKS ?=
585 $(2)_POST_PATCH_HOOKS ?=
586 $(2)_PRE_CONFIGURE_HOOKS ?=
587 $(2)_POST_CONFIGURE_HOOKS ?=
588 $(2)_PRE_BUILD_HOOKS ?=
589 $(2)_POST_BUILD_HOOKS ?=
590 $(2)_PRE_INSTALL_HOOKS ?=
591 $(2)_POST_INSTALL_HOOKS ?=
592 $(2)_PRE_INSTALL_STAGING_HOOKS ?=
593 $(2)_POST_INSTALL_STAGING_HOOKS ?=
594 $(2)_PRE_INSTALL_TARGET_HOOKS ?=
595 $(2)_POST_INSTALL_TARGET_HOOKS ?=
596 $(2)_PRE_INSTALL_IMAGES_HOOKS ?=
597 $(2)_POST_INSTALL_IMAGES_HOOKS ?=
598 $(2)_PRE_LEGAL_INFO_HOOKS ?=
599 $(2)_POST_LEGAL_INFO_HOOKS ?=
600 $(2)_TARGET_FINALIZE_HOOKS ?=
602 # human-friendly targets and target sequencing
603 $(1): $(1)-install
605 ifeq ($$($(2)_TYPE),host)
606 $(1)-install: $(1)-install-host
607 else
608 $(1)-install: $(1)-install-staging $(1)-install-target $(1)-install-images
609 endif
611 ifeq ($$($(2)_INSTALL_TARGET),YES)
612 $(1)-install-target: $$($(2)_TARGET_INSTALL_TARGET)
613 $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_BUILD)
614 else
615 $(1)-install-target:
616 endif
618 ifeq ($$($(2)_INSTALL_STAGING),YES)
619 $(1)-install-staging: $$($(2)_TARGET_INSTALL_STAGING)
620 $$($(2)_TARGET_INSTALL_STAGING): $$($(2)_TARGET_BUILD)
621 # Some packages use install-staging stuff for install-target
622 $$($(2)_TARGET_INSTALL_TARGET): $$($(2)_TARGET_INSTALL_STAGING)
623 else
624 $(1)-install-staging:
625 endif
627 ifeq ($$($(2)_INSTALL_IMAGES),YES)
628 $(1)-install-images: $$($(2)_TARGET_INSTALL_IMAGES)
629 $$($(2)_TARGET_INSTALL_IMAGES): $$($(2)_TARGET_BUILD)
630 else
631 $(1)-install-images:
632 endif
634 $(1)-install-host: $$($(2)_TARGET_INSTALL_HOST)
635 $$($(2)_TARGET_INSTALL_HOST): $$($(2)_TARGET_BUILD)
637 $(1)-build: $$($(2)_TARGET_BUILD)
638 $$($(2)_TARGET_BUILD): $$($(2)_TARGET_CONFIGURE)
640 # Since $(2)_FINAL_DEPENDENCIES are phony targets, they are always "newer"
641 # than $(2)_TARGET_CONFIGURE. This would force the configure step (and
642 # therefore the other steps as well) to be re-executed with every
643 # invocation of make. Therefore, make $(2)_FINAL_DEPENDENCIES an order-only
644 # dependency by using |.
646 $(1)-configure: $$($(2)_TARGET_CONFIGURE)
647 $$($(2)_TARGET_CONFIGURE): | $$($(2)_FINAL_DEPENDENCIES)
649 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dirs prepare
650 ifeq ($$(filter $(1),$$(DEPENDENCIES_HOST_PREREQ)),)
651 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dependencies
652 endif
654 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
655 # In the normal case (no package override), the sequence of steps is
656 # source, by downloading
657 # depends
658 # extract
659 # patch
660 # configure
661 $$($(2)_TARGET_CONFIGURE): $$($(2)_TARGET_PATCH)
663 $(1)-patch: $$($(2)_TARGET_PATCH)
664 $$($(2)_TARGET_PATCH): $$($(2)_TARGET_EXTRACT)
665 # Order-only dependency
666 $$($(2)_TARGET_PATCH): | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))
668 $(1)-extract: $$($(2)_TARGET_EXTRACT)
669 $$($(2)_TARGET_EXTRACT): $$($(2)_TARGET_SOURCE)
671 $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
673 $(1)-source: $$($(2)_TARGET_SOURCE)
675 $(1)-all-source: $(1)-legal-source
676 $(1)-legal-info: $(1)-legal-source
677 $(1)-legal-source: $(1)-source
679 # Only download the actual source if it differs from the 'main' archive
680 ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),)
681 ifneq ($$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_SOURCE))
682 $(1)-legal-source: $$($(2)_TARGET_ACTUAL_SOURCE)
683 endif # actual sources != sources
684 endif # actual sources != ""
686 $(1)-source-check:
687 $$(foreach p,$$($(2)_ALL_DOWNLOADS),$$(call SOURCE_CHECK,$$(p))$$(sep))
689 $(1)-external-deps:
690 @for p in $$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS) ; do \
691 echo `basename $$$$p` ; \
692 done
693 else
694 # In the package override case, the sequence of steps
695 # source, by rsyncing
696 # depends
697 # configure
699 # Use an order-only dependency so the "<pkg>-clean-for-rebuild" rule
700 # can remove the stamp file without triggering the configure step.
701 $$($(2)_TARGET_CONFIGURE): | $$($(2)_TARGET_RSYNC)
703 $(1)-depends: $$($(2)_FINAL_DEPENDENCIES)
705 $(1)-patch: $(1)-rsync
706 $(1)-extract: $(1)-rsync
708 $(1)-rsync: $$($(2)_TARGET_RSYNC)
710 $(1)-source:
711 $(1)-legal-source:
713 $(1)-source-check:
714 test -d $$($(2)_OVERRIDE_SRCDIR)
716 $(1)-external-deps:
717 @echo "file://$$($(2)_OVERRIDE_SRCDIR)"
718 endif
720 $(1)-show-version:
721 @echo $$($(2)_VERSION)
723 $(1)-show-depends:
724 @echo $$($(2)_FINAL_ALL_DEPENDENCIES)
726 $(1)-show-rdepends:
727 @echo $$($(2)_RDEPENDENCIES)
729 $(1)-graph-depends: graph-depends-requirements
730 $(call pkg-graph-depends,$(1),--direct)
732 $(1)-graph-rdepends: graph-depends-requirements
733 $(call pkg-graph-depends,$(1),--reverse)
735 $(1)-all-source: $(1)-source
736 $(1)-all-source: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-source)
738 $(1)-all-source-check: $(1)-source-check
739 $(1)-all-source-check: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-source-check)
741 $(1)-all-external-deps: $(1)-external-deps
742 $(1)-all-external-deps: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-external-deps)
744 $(1)-all-legal-info: $(1)-legal-info
745 $(1)-all-legal-info: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-legal-info)
747 $(1)-dirclean: $$($(2)_TARGET_DIRCLEAN)
749 $(1)-clean-for-reinstall:
750 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
751 rm -f $$($(2)_TARGET_RSYNC)
752 endif
753 rm -f $$($(2)_TARGET_INSTALL_STAGING)
754 rm -f $$($(2)_TARGET_INSTALL_TARGET)
755 rm -f $$($(2)_TARGET_INSTALL_IMAGES)
756 rm -f $$($(2)_TARGET_INSTALL_HOST)
758 $(1)-reinstall: $(1)-clean-for-reinstall $(1)
760 $(1)-clean-for-rebuild: $(1)-clean-for-reinstall
761 rm -f $$($(2)_TARGET_BUILD)
763 $(1)-rebuild: $(1)-clean-for-rebuild $(1)
765 $(1)-clean-for-reconfigure: $(1)-clean-for-rebuild
766 rm -f $$($(2)_TARGET_CONFIGURE)
768 $(1)-reconfigure: $(1)-clean-for-reconfigure $(1)
770 # define the PKG variable for all targets, containing the
771 # uppercase package variable prefix
772 $$($(2)_TARGET_INSTALL_TARGET): PKG=$(2)
773 $$($(2)_TARGET_INSTALL_STAGING): PKG=$(2)
774 $$($(2)_TARGET_INSTALL_IMAGES): PKG=$(2)
775 $$($(2)_TARGET_INSTALL_HOST): PKG=$(2)
776 $$($(2)_TARGET_BUILD): PKG=$(2)
777 $$($(2)_TARGET_CONFIGURE): PKG=$(2)
778 $$($(2)_TARGET_RSYNC): SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
779 $$($(2)_TARGET_RSYNC): PKG=$(2)
780 $$($(2)_TARGET_PATCH): PKG=$(2)
781 $$($(2)_TARGET_PATCH): RAWNAME=$$(patsubst host-%,%,$(1))
782 $$($(2)_TARGET_PATCH): PKGDIR=$(pkgdir)
783 $$($(2)_TARGET_EXTRACT): PKG=$(2)
784 $$($(2)_TARGET_SOURCE): PKG=$(2)
785 $$($(2)_TARGET_SOURCE): PKGDIR=$(pkgdir)
786 $$($(2)_TARGET_ACTUAL_SOURCE): PKG=$(2)
787 $$($(2)_TARGET_ACTUAL_SOURCE): PKGDIR=$(pkgdir)
788 $$($(2)_TARGET_DIRCLEAN): PKG=$(2)
790 # Compute the name of the Kconfig option that correspond to the
791 # package being enabled. We handle three cases: the special Linux
792 # kernel case, the bootloaders case, and the normal packages case.
793 ifeq ($(1),linux)
794 $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
795 else ifneq ($$(filter boot/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/boot/%),$(pkgdir)),)
796 $(2)_KCONFIG_VAR = BR2_TARGET_$(2)
797 else ifneq ($$(filter toolchain/% $$(foreach dir,$$(BR2_EXTERNAL_DIRS),$$(dir)/toolchain/%),$(pkgdir)),)
798 $(2)_KCONFIG_VAR = BR2_$(2)
799 else
800 $(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
801 endif
803 # legal-info: declare dependencies and set values used later for the manifest
804 ifneq ($$($(2)_LICENSE_FILES),)
805 $(2)_MANIFEST_LICENSE_FILES = $$($(2)_LICENSE_FILES)
806 endif
808 # We need to extract and patch a package to be able to retrieve its
809 # license files (if any) and the list of patches applied to it (if
810 # any).
811 $(1)-legal-info: $(1)-patch
813 # We only save the sources of packages we want to redistribute, that are
814 # non-overriden (local or true override).
815 ifeq ($$($(2)_REDISTRIBUTE),YES)
816 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
817 # Packages that have a tarball need it downloaded beforehand
818 $(1)-legal-info: $(1)-source $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))
819 endif
820 endif
822 # legal-info: produce legally relevant info.
823 $(1)-legal-info:
824 # Packages without a source are assumed to be part of Buildroot, skip them.
825 $$(foreach hook,$$($(2)_PRE_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
826 ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
828 # Save license files if defined
829 # We save the license files for any kind of package: normal, local,
830 # overridden, or non-redistributable alike.
831 # The reason to save license files even for no-redistribute packages
832 # is that the license still applies to the files distributed as part
833 # of the rootfs, even if the sources are not themselves redistributed.
834 ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
835 @$$(call legal-warning-pkg,$$($(2)_RAW_BASE_NAME),cannot save license ($(2)_LICENSE_FILES not defined))
836 else
837 @$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAW_BASE_NAME),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
838 endif # license files
840 ifeq ($$($(2)_SITE_METHOD),local)
841 # Packages without a tarball: don't save and warn
842 @$$(call legal-warning-nosource,$$($(2)_RAWNAME),local)
844 else ifneq ($$($(2)_OVERRIDE_SRCDIR),)
845 @$$(call legal-warning-nosource,$$($(2)_RAWNAME),override)
847 else
848 # Other packages
850 ifeq ($$($(2)_REDISTRIBUTE),YES)
851 # Save the source tarball and any extra downloads, but not
852 # patches, as they are handled specially afterwards.
853 $$(foreach e,$$($(2)_ACTUAL_SOURCE_TARBALL) $$(notdir $$($(2)_EXTRA_DOWNLOADS)),\
854 $$(Q)support/scripts/hardlink-or-copy \
855 $$(DL_DIR)/$$(e) \
856 $$($(2)_REDIST_SOURCES_DIR)$$(sep))
857 # Save patches and generate the series file
858 $$(Q)while read f; do \
859 support/scripts/hardlink-or-copy \
860 $$$${f} \
861 $$($(2)_REDIST_SOURCES_DIR) || exit 1; \
862 printf "%s\n" "$$$${f##*/}" >>$$($(2)_REDIST_SOURCES_DIR)/series || exit 1; \
863 done <$$($(2)_DIR)/.applied_patches_list
864 endif # redistribute
866 endif # other packages
867 @$$(call legal-manifest,$$($(2)_RAWNAME),$$($(2)_VERSION),$$($(2)_LICENSE),$$($(2)_MANIFEST_LICENSE_FILES),$$($(2)_ACTUAL_SOURCE_TARBALL),$$($(2)_ACTUAL_SOURCE_SITE),$$(call UPPERCASE,$(4)))
868 endif # ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
869 $$(foreach hook,$$($(2)_POST_LEGAL_INFO_HOOKS),$$(call $$(hook))$$(sep))
871 # add package to the general list of targets if requested by the buildroot
872 # configuration
873 ifeq ($$($$($(2)_KCONFIG_VAR)),y)
875 # Ensure the calling package is the declared provider for all the virtual
876 # packages it claims to be an implementation of.
877 ifneq ($$($(2)_PROVIDES),)
878 $$(foreach pkg,$$($(2)_PROVIDES),\
879 $$(eval $$(call virt-provides-single,$$(pkg),$$(call UPPERCASE,$$(pkg)),$(1))$$(sep)))
880 endif
882 # Register package as a reverse-dependencies of all its dependencies
883 $$(eval $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),\
884 $$(call UPPERCASE,$$(p))_RDEPENDENCIES += $(1)$$(sep)))
886 # Ensure unified variable name conventions between all packages Some
887 # of the variables are used by more than one infrastructure; so,
888 # rather than duplicating the checks in each infrastructure, we check
889 # all variables here in pkg-generic, even though pkg-generic should
890 # have no knowledge of infra-specific variables.
891 $(eval $(call check-deprecated-variable,$(2)_MAKE_OPT,$(2)_MAKE_OPTS))
892 $(eval $(call check-deprecated-variable,$(2)_INSTALL_OPT,$(2)_INSTALL_OPTS))
893 $(eval $(call check-deprecated-variable,$(2)_INSTALL_TARGET_OPT,$(2)_INSTALL_TARGET_OPTS))
894 $(eval $(call check-deprecated-variable,$(2)_INSTALL_STAGING_OPT,$(2)_INSTALL_STAGING_OPTS))
895 $(eval $(call check-deprecated-variable,$(2)_INSTALL_HOST_OPT,$(2)_INSTALL_HOST_OPTS))
896 $(eval $(call check-deprecated-variable,$(2)_AUTORECONF_OPT,$(2)_AUTORECONF_OPTS))
897 $(eval $(call check-deprecated-variable,$(2)_CONF_OPT,$(2)_CONF_OPTS))
898 $(eval $(call check-deprecated-variable,$(2)_BUILD_OPT,$(2)_BUILD_OPTS))
899 $(eval $(call check-deprecated-variable,$(2)_GETTEXTIZE_OPT,$(2)_GETTEXTIZE_OPTS))
900 $(eval $(call check-deprecated-variable,$(2)_KCONFIG_OPT,$(2)_KCONFIG_OPTS))
902 PACKAGES += $(1)
904 ifneq ($$($(2)_PERMISSIONS),)
905 PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep)
906 endif
907 ifneq ($$($(2)_DEVICES),)
908 PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep)
909 endif
910 ifneq ($$($(2)_USERS),)
911 PACKAGES_USERS += $$($(2)_USERS)$$(sep)
912 endif
913 TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
915 ifeq ($$($(2)_SITE_METHOD),svn)
916 DL_TOOLS_DEPENDENCIES += svn
917 else ifeq ($$($(2)_SITE_METHOD),git)
918 DL_TOOLS_DEPENDENCIES += git
919 else ifeq ($$($(2)_SITE_METHOD),bzr)
920 DL_TOOLS_DEPENDENCIES += bzr
921 else ifeq ($$($(2)_SITE_METHOD),scp)
922 DL_TOOLS_DEPENDENCIES += scp ssh
923 else ifeq ($$($(2)_SITE_METHOD),hg)
924 DL_TOOLS_DEPENDENCIES += hg
925 else ifeq ($$($(2)_SITE_METHOD),cvs)
926 DL_TOOLS_DEPENDENCIES += cvs
927 endif # SITE_METHOD
929 DL_TOOLS_DEPENDENCIES += $$(call extractor-dependency,$$($(2)_SOURCE))
931 # Ensure all virtual targets are PHONY. Listed alphabetically.
932 .PHONY: $(1) \
933 $(1)-all-external-deps \
934 $(1)-all-legal-info \
935 $(1)-all-source \
936 $(1)-all-source-check \
937 $(1)-build \
938 $(1)-clean-for-rebuild \
939 $(1)-clean-for-reconfigure \
940 $(1)-clean-for-reinstall \
941 $(1)-configure \
942 $(1)-depends \
943 $(1)-dirclean \
944 $(1)-external-deps \
945 $(1)-extract \
946 $(1)-graph-depends \
947 $(1)-install \
948 $(1)-install-host \
949 $(1)-install-images \
950 $(1)-install-staging \
951 $(1)-install-target \
952 $(1)-legal-info \
953 $(1)-legal-source \
954 $(1)-patch \
955 $(1)-rebuild \
956 $(1)-reconfigure \
957 $(1)-reinstall \
958 $(1)-rsync \
959 $(1)-show-depends \
960 $(1)-show-version \
961 $(1)-source \
962 $(1)-source-check
964 ifneq ($$($(2)_SOURCE),)
965 ifeq ($$($(2)_SITE),)
966 $$(error $(2)_SITE cannot be empty when $(2)_SOURCE is not)
967 endif
968 endif
970 ifeq ($$(patsubst %/,ERROR,$$($(2)_SITE)),ERROR)
971 $$(error $(2)_SITE ($$($(2)_SITE)) cannot have a trailing slash)
972 endif
974 ifneq ($$($(2)_HELP_CMDS),)
975 HELP_PACKAGES += $(2)
976 endif
978 endif # $(2)_KCONFIG_VAR
979 endef # inner-generic-package
981 ################################################################################
982 # generic-package -- the target generator macro for generic packages
983 ################################################################################
985 # In the case of target packages, keep the package name "pkg"
986 generic-package = $(call inner-generic-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
987 # In the case of host packages, turn the package name "pkg" into "host-pkg"
988 host-generic-package = $(call inner-generic-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
990 # :mode=makefile: