* [PATCH] btrfs-progs: Fix automatic prerequisite generation
@ 2013-07-06 8:22 Kusanagi Kouichi
2013-07-08 16:46 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: Kusanagi Kouichi @ 2013-07-06 8:22 UTC (permalink / raw)
To: linux-btrfs
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] btrfs-progs: Fix automatic prerequisite generation
2013-07-06 8:22 [PATCH] btrfs-progs: Fix automatic prerequisite generation Kusanagi Kouichi
@ 2013-07-08 16:46 ` David Sterba
2013-07-08 17:09 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2013-07-08 16:46 UTC (permalink / raw)
To: Kusanagi Kouichi; +Cc: linux-btrfs
On Sat, Jul 06, 2013 at 05:22:31PM +0900, Kusanagi Kouichi wrote:
> 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
Works great, thanks. I've noticed that DEPFLAGS is now unused and
removed it.
david
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs-progs: Fix automatic prerequisite generation
2013-07-08 16:46 ` David Sterba
@ 2013-07-08 17:09 ` David Sterba
2013-07-10 2:06 ` Kusanagi Kouichi
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2013-07-08 17:09 UTC (permalink / raw)
To: dsterba, Kusanagi Kouichi, linux-btrfs
On Mon, Jul 08, 2013 at 06:46:07PM +0200, David Sterba wrote:
> On Sat, Jul 06, 2013 at 05:22:31PM +0900, Kusanagi Kouichi wrote:
> > 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
>
> Works great, thanks. I've noticed that DEPFLAGS is now unused and
> removed it.
Two more small things: the files were previously named .something.o.d and
now they're something.d .
* .gitignore needs to be updated
* I'd prefer to keep the suffix .o.d, the leading . has go away due to
the macro tricks
I'll fold the following patch if you don't mind
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
*.o
*.static.o
-.*.o.d
+*.o.d
version.h
version
man/*.gz
diff --git a/Makefile b/Makefile
index 70880bc..849e3fe 100644
--- a/Makefile
+++ b/Makefile
@@ -76,8 +76,8 @@ else
check = true
endif
-%.d: %.c
- $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.d=.o) -MT $(@:.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
+%.o.d: %.c
+ $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
.c.o:
$(Q)$(check) $<
@@ -186,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 *.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 \
@@ -205,5 +205,5 @@ install: $(libs) $(progs) install-man
$(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir)
ifneq ($(MAKECMDGOALS),clean)
--include $(objects:.o=.d) $(cmd-objects:.o=.d) $(subst .btrfs,, $(filter-out btrfsck.d, $(progs:=.d)))
+-include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
endif
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] btrfs-progs: Fix automatic prerequisite generation
2013-07-08 17:09 ` David Sterba
@ 2013-07-10 2:06 ` Kusanagi Kouichi
0 siblings, 0 replies; 4+ messages in thread
From: Kusanagi Kouichi @ 2013-07-10 2:06 UTC (permalink / raw)
To: David Sterba, linux-btrfs
On 2013-07-08 19:09:25 +0200, David Sterba wrote:
> On Mon, Jul 08, 2013 at 06:46:07PM +0200, David Sterba wrote:
> > On Sat, Jul 06, 2013 at 05:22:31PM +0900, Kusanagi Kouichi wrote:
> > > 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
> >
> > Works great, thanks. I've noticed that DEPFLAGS is now unused and
> > removed it.
>
> Two more small things: the files were previously named .something.o.d and
> now they're something.d .
>
> * .gitignore needs to be updated
> * I'd prefer to keep the suffix .o.d, the leading . has go away due to
> the macro tricks
>
> I'll fold the following patch if you don't mind
Looks good to me. Thanks.
> --- a/.gitignore
> +++ b/.gitignore
> @@ -1,6 +1,6 @@
> *.o
> *.static.o
> -.*.o.d
> +*.o.d
> version.h
> version
> man/*.gz
> diff --git a/Makefile b/Makefile
> index 70880bc..849e3fe 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -76,8 +76,8 @@ else
> check = true
> endif
>
> -%.d: %.c
> - $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.d=.o) -MT $(@:.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
> +%.o.d: %.c
> + $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
>
> .c.o:
> $(Q)$(check) $<
> @@ -186,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 *.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 \
> @@ -205,5 +205,5 @@ install: $(libs) $(progs) install-man
> $(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir)
>
> ifneq ($(MAKECMDGOALS),clean)
> --include $(objects:.o=.d) $(cmd-objects:.o=.d) $(subst .btrfs,, $(filter-out btrfsck.d, $(progs:=.d)))
> +-include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
> endif
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-10 2:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-06 8:22 [PATCH] btrfs-progs: Fix automatic prerequisite generation Kusanagi Kouichi
2013-07-08 16:46 ` David Sterba
2013-07-08 17:09 ` David Sterba
2013-07-10 2:06 ` Kusanagi Kouichi
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).