From: Kusanagi Kouichi <slash@ac.auone-net.jp>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: Fix automatic prerequisite generation
Date: Sat, 6 Jul 2013 17:22:31 +0900 [thread overview]
Message-ID: <20130706082232.1679715C03A@msa104.auone-net.jp> (raw)
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 <slash@ac.auone-net.jp>
---
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
--
1.8.3.2
next reply other threads:[~2013-07-06 8:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-06 8:22 Kusanagi Kouichi [this message]
2013-07-08 16:46 ` [PATCH] btrfs-progs: Fix automatic prerequisite generation David Sterba
2013-07-08 17:09 ` David Sterba
2013-07-10 2:06 ` Kusanagi Kouichi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130706082232.1679715C03A@msa104.auone-net.jp \
--to=slash@ac.auone-net.jp \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).