From patchwork Tue Mar 22 17:34:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 8644191 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2EB41C0553 for ; Tue, 22 Mar 2016 17:35:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4205C2034B for ; Tue, 22 Mar 2016 17:35:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30177202E5 for ; Tue, 22 Mar 2016 17:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755241AbcCVRfL (ORCPT ); Tue, 22 Mar 2016 13:35:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:36707 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752666AbcCVRfB (ORCPT ); Tue, 22 Mar 2016 13:35:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 56066AC64 for ; Tue, 22 Mar 2016 17:34:59 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 5FF27DAB45; Tue, 22 Mar 2016 18:34:31 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH] btrfs-progs: fix build of standalone utilities after clean Date: Tue, 22 Mar 2016 18:34:26 +0100 Message-Id: <1458668066-27136-1-git-send-email-dsterba@suse.com> X-Mailer: git-send-email 2.7.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP $ make clean $ make btrfs-debug-tree will fail because the dependency from $(btrfs_debug_tree_objects) is missing. The variable standalone_deps magically collects all the deps and will build them in advance. The simple fix to use the existing substitution based on $@ does not work for pattern rules, as Noah found out. Reported-by: Noah Massey Signed-off-by: David Sterba --- Makefile.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 71ef76d4fd4e..0a1aece70dab 100644 --- a/Makefile.in +++ b/Makefile.in @@ -130,6 +130,9 @@ btrfs_debug_tree_objects = cmds-inspect-dump-tree.o btrfs_show_super_objects = cmds-inspect-dump-super.o btrfs_calc_size_objects = cmds-inspect-tree-stats.o +# collect values of the variables above +standalone_deps = $(foreach dep,$(patsubst %,%_objects,$(subst -,_,$(filter btrfs-%, $(progs)))),$($(dep))) + SUBDIRS = BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS)) INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS)) @@ -256,14 +259,14 @@ $(libs_static): $(libbtrfs_objects) # For static variants, use an extra $(subst) to get rid of the ".static" # from the target name before translating to list of libs -btrfs-%.static: $(static_objects) btrfs-%.static.o $(static_libbtrfs_objects) +btrfs-%.static: $(static_objects) btrfs-%.static.o $(static_libbtrfs_objects) $(patsubst %.o,%.static.o,$(standalone_deps)) @echo " [LD] $@" $(Q)$(CC) $(STATIC_CFLAGS) -o $@ $@.o $(static_objects) \ $(patsubst %.o, %.static.o, $($(subst -,_,$(subst .static,,$@)-objects))) \ $(static_libbtrfs_objects) $(STATIC_LDFLAGS) \ $($(subst -,_,$(subst .static,,$@)-libs)) $(STATIC_LIBS) -btrfs-%: $(objects) $(libs_static) btrfs-%.o +btrfs-%: $(objects) $(libs_static) btrfs-%.o $(standalone_deps) @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o \ $($(subst -,_,$@-objects)) \