summaryrefslogtreecommitdiffstats
path: root/rules/post/ptxd_make_collection.make
blob: c49bae88eeebc77ff5eb638edf8160605ca5acb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*-makefile-*-
#
# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

# calculate a unique temporary file name
define _ptx_collection_mangle
$(PTXDIST_TEMPDIR)/.$(subst /,-,$(subst $(PTXDIST_WORKSPACE)/,,$(strip $(1))))
endef
# generate the actual package list
define _ptx_collection_do
$(PACKAGES-y) $(filter $(foreach PKG,$(call ptx/force-shell, sed -n 's/^PTXCONF_\([^_][^=]*\)=y$$/\1/p' "$(strip $(1))"),$(PTX_MAP_TO_package_$(PKG))), $(PACKAGES-m))
endef
# mark the collection for verification and save the package list
define _ptx_collection_write
$(eval ACTIVE_COLLECTIONS += $(1))
$(file >$(2),_pkg := $(3))
$(3)
endef
# load the package list if available, otherwise generate it
define _ptx_collection_once
$(if $(wildcard $(2)),$(eval include $(2))$(_pkg),$(call _ptx_collection_write,$(1),$(2),$(call _ptx_collection_do,$(1))))
endef
define _ptx_collection
$(call _ptx_collection_once,$(1),$(call _ptx_collection_mangle,$(1)))
endef

ptx/collection = $(strip $(call _ptx_collection,$(strip $(1))))

PHONY += ptx-validate-collections
$(STATEDIR)/virtual-host-tools.install: | ptx-validate-collections

ptx-validate-collections:
	@$(ptx/env) \
	ptx_collections="$(ACTIVE_COLLECTIONS)" \
	ptxd_make_validate_collection

# vim: syntax=make