From patchwork Sat Jul 6 08:22:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kusanagi Kouichi X-Patchwork-Id: 2824488 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8854C9F3C3 for ; Sat, 6 Jul 2013 08:42:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9293A20138 for ; Sat, 6 Jul 2013 08:42:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 233ED20135 for ; Sat, 6 Jul 2013 08:42:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752826Ab3GFImh (ORCPT ); Sat, 6 Jul 2013 04:42:37 -0400 Received: from msa104.auone-net.jp ([61.117.18.164]:42704 "EHLO msa104.auone-net.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814Ab3GFImg (ORCPT ); Sat, 6 Jul 2013 04:42:36 -0400 X-Greylist: delayed 1203 seconds by postgrey-1.27 at vger.kernel.org; Sat, 06 Jul 2013 04:42:36 EDT Received: from ppp.dion.ne.jp (ZR168023.ppp.dion.ne.jp [222.14.168.23]) by msa104.auone-net.jp (au one net msa) with ESMTP id 1679715C03A for ; Sat, 6 Jul 2013 17:22:31 +0900 (JST) Date: Sat, 6 Jul 2013 17:22:31 +0900 From: Kusanagi Kouichi To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: Fix automatic prerequisite generation MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Message-Id: <20130706082232.1679715C03A@msa104.auone-net.jp> 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, 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 Some files don't compile because of insufficient prerequisite. $ make btrfs ... [CC] btrfs.o btrfs.c:24:21: fatal error: version.h: No such file or directory #include "version.h" ^ compilation terminated. make: *** [btrfs.o] Error 1 Signed-off-by: Kusanagi Kouichi --- Makefile | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index da7438e..02b8a4c 100644 --- a/Makefile +++ b/Makefile @@ -76,22 +76,25 @@ else check = true endif +%.d: %.c + $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.d=.o) -MT $(@:.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $< + .c.o: $(Q)$(check) $< @echo " [CC] $@" - $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $< + $(Q)$(CC) $(AM_CFLAGS) $(CFLAGS) -c $< %.static.o: %.c @echo " [CC] $@" - $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@ + $(Q)$(CC) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@ -all: version.h $(progs) manpages +all: $(progs) manpages # # NOTE: For static compiles, you need to have all the required libs # static equivalent available # -static: version.h btrfs.static mkfs.btrfs.static btrfs-find-root.static +static: btrfs.static mkfs.btrfs.static btrfs-find-root.static version.h: @echo " [SH] $@" @@ -121,13 +124,13 @@ $(lib_links): # 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: version.h $(static_objects) btrfs-%.static.o $(static_libbtrfs_objects) +btrfs-%.static: $(static_objects) btrfs-%.static.o $(static_libbtrfs_objects) @echo " [LD] $@" $(Q)$(CC) $(STATIC_CFLAGS) -o $@ $@.o $(static_objects) \ $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS) \ $($(subst -,_,$(subst .static,,$@)-libs)) -btrfs-%: version.h $(objects) $(libs) btrfs-%.o +btrfs-%: $(objects) $(libs) btrfs-%.o @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs)) @@ -183,7 +186,7 @@ install-man: clean : @echo "Cleaning" - $(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \ + $(Q)rm -f $(progs) cscope.out *.o *.d btrfs-convert btrfs-image btrfs-select-super \ btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test btrfsck \ btrfs.static mkfs.btrfs.static btrfs-calc-size \ version.h \ @@ -199,4 +202,6 @@ install: $(libs) $(progs) install-man $(INSTALL) -m755 -d $(DESTDIR)$(incdir) $(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir) --include .*.d +ifneq ($(MAKECMDGOALS),clean) +-include $(objects:.o=.d) $(cmd-objects:.o=.d) $(subst .btrfs,, $(filter-out btrfsck.d, $(progs:=.d))) +endif