From nobody Sat May 18 19:47:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1586436275; cv=none; d=zohomail.com; s=zohoarc; b=fGnpsQzw0eSQmpu0cWYVCcYA5jJyHT0gr6lgIuUbfYTxIMreaCFFOiHqwd60H6I3re6eg9OHRelkGutV1e0FiBM4OvLLxx+1RHdCASiQ6BTm8fwqyEstdolFLAUE91e2vMIFOs2EQS8I8CNWhl6qdFrdIuCOp5LfxMmA3dWzKMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586436275; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=CnBtIJbIwjKEVnoaUTNvQ1RQChps5nCjEvdg8oOxBJY=; b=fyadXAVt8PtbYvf5K6SXvVJQkCdemVgBkhjv02aRBprnlMNLKmqXFxuIndb96Rqo8SNS/TBkL17k5+v1soH2hgYmI47W2nOS5k5JtiBaqjHVgNgSaMrHYUiPQB33Ai4fCL3HGWicxn8cT6qa+Zap0Xc4Tw4FXF5TFGLSxwd7NB4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586436275293347.0309740559471; Thu, 9 Apr 2020 05:44:35 -0700 (PDT) Received: from localhost ([::1]:48642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMWXp-00017l-4j for importer@patchew.org; Thu, 09 Apr 2020 08:44:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51920) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMWX5-0000iL-Jq for qemu-devel@nongnu.org; Thu, 09 Apr 2020 08:43:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jMWX4-000258-6h for qemu-devel@nongnu.org; Thu, 09 Apr 2020 08:43:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:44316) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jMWX3-00024y-UU for qemu-devel@nongnu.org; Thu, 09 Apr 2020 08:43:46 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 54390AF6D; Thu, 9 Apr 2020 12:43:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Claudio Fontana To: Peter Maydell , David Gibson Subject: [PATCH v2] Makefile: libfdt: build only the strict necessary Date: Thu, 9 Apr 2020 14:43:37 +0200 Message-Id: <20200409124337.32134-1-cfontana@suse.de> X-Mailer: git-send-email 2.16.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Alex Bennee , Claudio Fontana , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" when building dtc/libfdt, we were previously using dtc/Makefile, which tries to build some artifacts that are not needed, and can complain on stderr about the absence of tools that are not required to build just libfdt. Instead, build only the strict necessary to get libfdt.a . Remove the subdir-dtc "compatibility gunk" for recursion, since we are not recursing anymore. Signed-off-by: Claudio Fontana --- Makefile | 23 +++++++++++++---------- configure | 6 +----- rules.mak | 2 ++ 3 files changed, 16 insertions(+), 15 deletions(-) v1 -> v2: * fix error generated when running UNCHECKED_GOALS without prior configure, for example during make docker-image-fedora. Without configure, DSOSUF is empty, and the module pattern rule in rules.mak that uses this variable can match too much; provide a default in the Makefile to avoid it. * only attempt to build the archive when there is a non-empty list of objec= ts. This could be done in general for the %.a: pattern in rules.mak, but maybe there are valid reasons to build an empty .a? * removed some intermediate variables that did not add much value (LIBFDT_srcdir, LIBFDT_archive) Tested locally with 3 VPATH configurations (no-, VPATH, VPATH in src subdir= ), and with docker-image-fedora, docker-test-debug@fedora that failed before. diff --git a/Makefile b/Makefile index 84ef881600..92bc853b5f 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ ifneq ($(words $(subst :, ,$(CURDIR))), 1) $(error main directory cannot contain spaces nor colons) endif =20 +# some pattern rules in rules.mak are confused by an empty DSOSUF, +# and UNCHECKED_GOALS for testing (docker-) can run without prior configur= e. +DSOSUF ?=3D ".so" + # Always point to the root of the build tree (needs GNU make). BUILD_DIR=3D$(CURDIR) =20 @@ -526,15 +530,16 @@ $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed) $(TARGET_DIRS_RULES): $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V=3D"$(V)" = TARGET_DIR=3D"$(dir $@)" $(notdir $@),) =20 -DTC_MAKE_ARGS=3D-I$(SRC_PATH)/dtc VPATH=3D$(SRC_PATH)/dtc -C dtc V=3D"$(V)= " LIBFDT_srcdir=3D$(SRC_PATH)/dtc/libfdt -DTC_CFLAGS=3D$(CFLAGS) $(QEMU_CFLAGS) -DTC_CPPFLAGS=3D-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libf= dt - -.PHONY: dtc/all -dtc/all: .git-submodule-status dtc/libfdt dtc/tests - $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS=3D"$(DTC_CPPFLAGS)= " CFLAGS=3D"$(DTC_CFLAGS)" LDFLAGS=3D"$(QEMU_LDFLAGS)" ARFLAGS=3D"$(ARFLAGS= )" CC=3D"$(CC)" AR=3D"$(AR)" LD=3D"$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt= .a,) +LIBFDT_objdir =3D dtc/libfdt +-include $(SRC_PATH)/dtc/libfdt/Makefile.libfdt +LIBFDT_objects =3D $(addprefix $(LIBFDT_objdir)/, $(LIBFDT_OBJS)) +.PHONY: libfdt +libfdt: .git-submodule-status $(LIBFDT_objdir)/libfdt.a +$(LIBFDT_objdir)/libfdt.a: $(LIBFDT_objects) + $(if $(LIBFDT_objects),$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"= AR","$(TARGET_DIR)$@"),) =20 -dtc/%: .git-submodule-status +$(LIBFDT_objects): | $(LIBFDT_objdir) +$(LIBFDT_objdir): .git-submodule-status @mkdir -p $@ =20 # Overriding CFLAGS causes us to lose defines added in the sub-makefile. @@ -563,7 +568,6 @@ slirp/all: .git-submodule-status =20 # Compatibility gunk to keep make working across the rename of targets # for recursion, to be removed some time after 4.1. -subdir-dtc: dtc/all subdir-capstone: capstone/all subdir-slirp: slirp/all =20 @@ -821,7 +825,6 @@ distclean: clean rm -rf $$d || exit 1 ; \ done rm -Rf .sdk - if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi =20 KEYMAPS=3Dda en-gb et fr fr-ch is lt no pt-br sv \ ar de en-us fi fr-be hr it lv nl pl ru th \ diff --git a/configure b/configure index 233c671aaa..36f83ffc5a 100755 --- a/configure +++ b/configure @@ -4278,10 +4278,6 @@ EOF if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.g= it" ; then fdt=3Dgit mkdir -p dtc - if [ "$pwd_is_source_path" !=3D "y" ] ; then - symlink "$source_path/dtc/Makefile" "dtc/Makefile" - symlink "$source_path/dtc/scripts" "dtc/scripts" - fi fdt_cflags=3D"-I\$(SRC_PATH)/dtc/libfdt" fdt_ldflags=3D"-L\$(BUILD_DIR)/dtc/libfdt" fdt_libs=3D"$fdt_libs" @@ -8151,7 +8147,7 @@ echo "PIXMAN_CFLAGS=3D$pixman_cflags" >> $config_host= _mak echo "PIXMAN_LIBS=3D$pixman_libs" >> $config_host_mak =20 if [ "$fdt" =3D "git" ]; then - echo "config-host.h: dtc/all" >> $config_host_mak + echo "config-host.h: libfdt" >> $config_host_mak fi if [ "$capstone" =3D "git" -o "$capstone" =3D "internal" ]; then echo "config-host.h: capstone/all" >> $config_host_mak diff --git a/rules.mak b/rules.mak index 694865b63e..61eb474ba4 100644 --- a/rules.mak +++ b/rules.mak @@ -105,6 +105,8 @@ LINK =3D $(call quiet-command, $(LINKPROG) $(CFLAGS) $(= QEMU_LDFLAGS) -o $@ \ =20 DSO_OBJ_CFLAGS :=3D -fPIC -DBUILD_DSO module-common.o: CFLAGS +=3D $(DSO_OBJ_CFLAGS) + +# Note: DSOSUF must not be empty, or these rules will try to match too much %$(DSOSUF): QEMU_LDFLAGS +=3D $(LDFLAGS_SHARED) %$(DSOSUF): %.mo $(call LINK,$^) --=20 2.16.4