summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2010-11-19 14:20:56 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2010-11-19 14:20:56 +0100
commit22c2c6b5410fdf2fcb617faa7ccff904328d142d (patch)
tree262e93fc5fb31af9ac7953b6da2bf421085dd969
parent0826a822b9519fbd5aebf9f7d12d88832b3ddb22 (diff)
Makefile: handle host packages for make source / make external-deps
Ensure host packages (dependencies of target packages) are also handled by make source / make external-deps. This has to be done a explicitly, as we don't list these in Kconfig, and hence also not in a variable like TARGETS, so instead we have to look at the <PKG>_DEPENDENCIES variables for each enabled package and extract the host packages from there. Host packages can in turn also have dependencies, so we have to follow those as well. Ideally this should be done recursively, but as that's pretty hard to do in make, it is limited to 1 level for now. Finally, host packages share source files with target packages, so pipe output of make external-deps through sort -u to ensure duplicates are removed. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-rw-r--r--Makefile21
1 files changed, 20 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index e569a94c7..8669eefa6 100644
--- a/Makefile
+++ b/Makefile
@@ -323,6 +323,25 @@ TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
+
+# host-* dependencies have to be handled specially, as those aren't
+# visible in Kconfig and hence not added to a variable like TARGETS.
+# instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
+# variable for each enabled target.
+# Notice: this only works for newstyle gentargets/autotargets packages
+TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
+ $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
+ $($(dep)))))
+# Host packages can in turn have their own dependencies. Likewise find
+# all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
+# host package found above. Ideally this should be done recursively until
+# no more packages are found, but that's hard to do in make, so limit to
+# 1 level for now.
+HOST_DEPS = $(sort $(foreach dep,\
+ $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
+ $($(dep))))
+HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
+
# all targets depend on the crosscompiler and it's prerequisites
$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
@@ -443,7 +462,7 @@ _source-check:
$(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
external-deps:
- @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source
+ @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
show-targets:
@echo $(TARGETS)