From patchwork Sun Oct 6 14:19:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 280861 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 1C5752C00E2 for ; Mon, 7 Oct 2013 01:19:54 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 558B093A73; Sun, 6 Oct 2013 14:19:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tE31ktAEWXik; Sun, 6 Oct 2013 14:19:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 1D3BB93ACC; Sun, 6 Oct 2013 14:19:46 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5B5E11BF9A3 for ; Sun, 6 Oct 2013 14:19:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 417F593A8F for ; Sun, 6 Oct 2013 14:19:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0ebNa0lmIa1k for ; Sun, 6 Oct 2013 14:19:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by hemlock.osuosl.org (Postfix) with ESMTP id 389F693A68 for ; Sun, 6 Oct 2013 14:19:38 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id C86748E6; Sun, 6 Oct 2013 16:19:45 +0200 (CEST) Received: from localhost (AToulouse-651-1-247-171.w90-50.abo.wanadoo.fr [90.50.2.171]) by mail.free-electrons.com (Postfix) with ESMTPSA id 81EAD442 for ; Sun, 6 Oct 2013 16:19:45 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Sun, 6 Oct 2013 16:19:18 +0200 Message-Id: <1381069171-29748-9-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1381069171-29748-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1381069171-29748-1-git-send-email-thomas.petazzoni@free-electrons.com> Subject: [Buildroot] [PATCHv2 08/21] package: package-based implementation of source, external-deps and legal-info X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Until now, the make source, make external-deps and make legal-info where relying on enumerating the packages by looking at $(TARGETS) which contains only the target packages and not the host packages. Thanks to the TARGET_HOST_DEPS and HOST_DEPS variables, it was doing a two-level resolution of host package dependencies, but it was not entirely correct since the dependency chain might be deeper than that: some packages could be missed. From an idea of Arnout, this patch introduces in each package additional targets -all-source, -all-legal-info and -all-external-deps that executes the 'source', 'legal-info' and 'external-deps' targets for this package and all its dependencies, be they target or host dependencies. This provides a much cleaner implementation of this mechanism, which is also more robust. In order to achieve this, this patch also separates the "package" targets from other targets: instead of mixing them both in the global TARGETS variable, the new PACKAGES variable contains the name of all packages that are enabled in the configuration, while TARGETS is only used for additional things to be done (target-finalize, etc.). This separation is needed so that we don't try to use targets (such as -all-external-deps) on things that are not packages. Some further cleanups in this direction are possible, this commit takes a relatively minimal approach for now. Signed-off-by: Thomas Petazzoni --- Makefile | 53 +++++++++++++------------------------------------- package/pkg-generic.mk | 13 ++++++++++++- 2 files changed, 25 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index bd59259..8483d79 100644 --- a/Makefile +++ b/Makefile @@ -238,8 +238,6 @@ GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess) BASE_TARGETS = toolchain -TARGETS:= - # silent mode requested? QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q) @@ -310,9 +308,6 @@ endif include package/Makefile.in include support/dependencies/dependencies.mk -# We also need the various per-package makefiles, which also add -# each selected package to TARGETS if that package was selected -# in the .config file. include toolchain/*/*.mk # Include the package override file if one has been provided in the @@ -348,34 +343,11 @@ include fs/common.mk TARGETS+=target-post-image -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 _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__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))) - -TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\ - $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS)))) - -# all targets depend on the crosscompiler and it's prerequisites -$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) % +PACKAGES_CLEAN:=$(patsubst %,%-clean,$(PACKAGES)) +PACKAGES_SOURCE:=$(patsubst %,%-all-source,$(PACKAGES) $(BASE_TARGETS)) +PACKAGES_EXTERNAL_DEPS:=$(patsubst %,%-all-external-deps,$(PACKAGES) $(BASE_TARGETS)) +PACKAGES_DIRCLEAN:=$(patsubst %,%-dirclean,$(PACKAGES)) +PACKAGES_LEGAL_INFO:=$(patsubst %,%-all-legal-info,$(PACKAGES) $(BASE_TARGETS)) dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) @@ -385,12 +357,13 @@ $(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG) prepare: $(BUILD_DIR)/buildroot-config/auto.conf -world: $(BASE_TARGETS) $(TARGETS_ALL) +world: $(BASE_TARGETS) $(PACKAGES) $(TARGETS) .PHONY: all world toolchain dirs clean distclean source outputmakefile \ legal-info legal-info-prepare legal-info-clean printvars \ - $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \ - $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \ + $(BASE_TARGETS) $(PACKAGES) $(TARGETS) \ + $(PACKAGES_CLEAN) $(PACKAGES_DIRCLEAN) $(PACKAGES_SOURCE) $(PACKAGES_LEGAL_INFO) \ + $(PACKAGES_EXTERNAL_DEPS) \ $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) @@ -561,10 +534,10 @@ target-post-image: toolchain-eclipse-register: ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH) -source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE) +source: dirs $(PACKAGES_SOURCE) external-deps: - @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u + @$(MAKE) -s $(EXTRAMAKEARGS) $(PACKAGES_EXTERNAL_DEPS) | sort -u legal-info-clean: @rm -fr $(LEGAL_INFO_DIR) @@ -579,7 +552,7 @@ legal-info-prepare: $(LEGAL_INFO_DIR) @cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \ - $(TARGETS_LEGAL_INFO) + $(PACKAGES_LEGAL_INFO) @cat support/legal-info/README.header >>$(LEGAL_REPORT) @if [ -r $(LEGAL_WARNINGS) ]; then \ cat support/legal-info/README.warnings-header \ @@ -589,7 +562,7 @@ legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \ @rm -f $(LEGAL_WARNINGS) show-targets: - @echo $(TARGETS) + @echo $(BASE_TARGETS) $(PACKAGES) $(TARGETS) else # ifeq ($(BR2_HAVE_DOT_CONFIG),y) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index bfc4dc1..91e79f5 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -423,6 +423,17 @@ endif $(1)-show-depends: @echo $$($(2)_DEPENDENCIES) +$(1)-all-source: $(foreach p,$($(2)_DEPENDENCIES),$(p)-all-source) $(1)-source + +$(1)-external-deps: +ifneq ($$($(2)_SOURCE),) + @echo $$($(2)_SOURCE) +endif + +$(1)-all-external-deps: $(foreach p,$($(2)_DEPENDENCIES),$(p)-all-external-deps) $(1)-external-deps + +$(1)-all-legal-info: $(foreach p,$($(2)_DEPENDENCIES),$(p)-all-legal-info) $(1)-legal-info + $(1)-uninstall: $(1)-configure $$($(2)_TARGET_UNINSTALL) $(1)-clean: $(1)-uninstall \ @@ -527,7 +538,7 @@ endif # ifneq ($(call qstrip,$$($(2)_SOURCE)),) # configuration ifeq ($$($$($(2)_KCONFIG_VAR)),y) -TARGETS += $(1) +PACKAGES += $(1) PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep) PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep) PACKAGES_USERS += $$($(2)_USERS)$$(sep)