libasplib: add url to gcc bug report
[buildroot-gz.git] / package / pkg-utils.mk
blobc5d4080c72f4227ce643ae4549f6600057bc715e
1 ################################################################################
3 # This file contains various utility functions used by the package
4 # infrastructure, or by the packages themselves.
6 ################################################################################
9 # Manipulation of .config files based on the Kconfig
10 # infrastructure. Used by the BusyBox package, the Linux kernel
11 # package, and more.
14 define KCONFIG_ENABLE_OPT # (option, file)
15 $(SED) "/\\<$(1)\\>/d" $(2)
16 echo '$(1)=y' >> $(2)
17 endef
19 define KCONFIG_SET_OPT # (option, value, file)
20 $(SED) "/\\<$(1)\\>/d" $(3)
21 echo '$(1)=$(2)' >> $(3)
22 endef
24 define KCONFIG_DISABLE_OPT # (option, file)
25 $(SED) "/\\<$(1)\\>/d" $(2)
26 echo '# $(1) is not set' >> $(2)
27 endef
29 # Helper functions to determine the name of a package and its
30 # directory from its makefile directory, using the $(MAKEFILE_LIST)
31 # variable provided by make. This is used by the *-package macros to
32 # automagically find where the package is located.
33 pkgdir = $(dir $(lastword $(MAKEFILE_LIST)))
34 pkgname = $(lastword $(subst /, ,$(pkgdir)))
36 # Define extractors for different archive suffixes
37 INFLATE.bz2 = $(BZCAT)
38 INFLATE.gz = $(ZCAT)
39 INFLATE.lzma = $(XZCAT)
40 INFLATE.tbz = $(BZCAT)
41 INFLATE.tbz2 = $(BZCAT)
42 INFLATE.tgz = $(ZCAT)
43 INFLATE.xz = $(XZCAT)
44 INFLATE.tar = cat
45 # suitable-extractor(filename): returns extractor based on suffix
46 suitable-extractor = $(INFLATE$(suffix $(1)))
48 # check-deprecated-variable -- throw an error on deprecated variables
49 # example:
50 # $(eval $(call check-deprecated-variable,FOO_MAKE_OPT,FOO_MAKE_OPTS))
51 define check-deprecated-variable # (deprecated var, new var)
52 ifneq ($$(origin $(1)),undefined)
53 $$(error Package error: use $(2) instead of $(1). Please fix your .mk file)
54 endif
55 endef
58 # legal-info helper functions
60 LEGAL_INFO_SEPARATOR = "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
62 define legal-warning # text
63 echo "WARNING: $(1)" >>$(LEGAL_WARNINGS)
64 endef
66 define legal-warning-pkg # pkg, text
67 echo "WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS)
68 endef
70 define legal-warning-nosource # pkg, {local|override}
71 $(call legal-warning-pkg,$(1),sources not saved ($(2) packages not handled))
72 endef
74 define legal-manifest # pkg, version, license, license-files, source, url, {HOST|TARGET}
75 echo '"$(1)","$(2)","$(3)","$(4)","$(5)","$(6)"' >>$(LEGAL_MANIFEST_CSV_$(7))
76 endef
78 define legal-license-file # pkg, filename, file-fullpath, {HOST|TARGET}
79 mkdir -p $(LICENSE_FILES_DIR_$(4))/$(1)/$(dir $(2)) && \
80 cp $(3) $(LICENSE_FILES_DIR_$(4))/$(1)/$(2)
81 endef