diff mbox

btrfs-progs: Add version.h dependency to fix parallel builds

Message ID 5239084D.4020802@redhat.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Eric Sandeen Sept. 18, 2013, 1:56 a.m. UTC
Change the suffix rule to ensure that version.h is 
built before we try to create any .o file.

Reported-by: Roy Li <rongqing.li@windriver.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

I dunno, does this work?  My gnu make is rusty.

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Sandeen Sept. 18, 2013, 2:26 a.m. UTC | #1
On 9/17/13 8:56 PM, Eric Sandeen wrote:
> Change the suffix rule to ensure that version.h is 
> built before we try to create any .o file.
> 
> Reported-by: Roy Li <rongqing.li@windriver.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> I dunno, does this work?  My gnu make is rusty.

I'm actually confused by what the makefile is doing with the
dependency generation, maybe my patch isn't right.

this:

%.o.d: %.c
        $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<

completely confuses me :)

-Eric

> diff --git a/Makefile b/Makefile
> index 3d715d8..d25054f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -107,13 +107,13 @@ endif
>  %.o.d: %.c
>  	$(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
>  
> -.c.o:
> +%.o: %.c version.h
>  	@$(check_echo) "    [SP]     $<"
>  	$(Q)$(check) $(AM_CFLAGS) $(CFLAGS) $<
>  	@echo "    [CC]     $@"
>  	$(Q)$(CC) $(AM_CFLAGS) $(CFLAGS) -c $<
>  
> -%.static.o: %.c
> +%.static.o: %.c version.h
>  	@echo "    [CC]     $@"
>  	$(Q)$(CC) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
li rongqing Sept. 18, 2013, 6:39 a.m. UTC | #2
On 09/18/2013 10:26 AM, Eric Sandeen wrote:
> On 9/17/13 8:56 PM, Eric Sandeen wrote:
>> Change the suffix rule to ensure that version.h is
>> built before we try to create any .o file.
>>
>> Reported-by: Roy Li <rongqing.li@windriver.com>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> I dunno, does this work?  My gnu make is rusty.
>
> I'm actually confused by what the makefile is doing with the
> dependency generation, maybe my patch isn't right.
>
> this:
>
> %.o.d: %.c
>          $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
>
> completely confuses me :)
>
> -Eric

It lead to the below building error:

n file included from ctree.c:18:0:
| ctree.h:30:24: fatal error: btrfs/list.h: No such file or directory
|  #include <btrfs/list.h>
|                         ^
| compilation terminated.
| In file included from extent-tree.c:22:0:
| radix-tree.h:43:30: fatal error: btrfs/kerncompat.h: No such file or 
directory
|  #include <btrfs/kerncompat.h>
|                               ^
| compilation terminated.
| In file included from disk-io.c:29:0:
| radix-tree.h:43:30: fatal error: btrfs/kerncompat.h: No such file or 
directory
|  #include <btrfs/kerncompat.h>
|                               ^
| compilation terminated.
| In file included from radix-tree.c:40:0:
| radix-tree.h:43:30: fatal error: btrfs/kerncompat.h: No such file or 
directory
|  #include <btrfs/kerncompat.h>
|                               ^
| compilation terminated.
| In file included from root-tree.c:19:0:
| ctree.h:30:24: fatal error: btrfs/list.h: No such file or directory
|  #include <btrfs/list.h>
|                         ^
| compilation terminated.



-Roy


>
>> diff --git a/Makefile b/Makefile
>> index 3d715d8..d25054f 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -107,13 +107,13 @@ endif
>>   %.o.d: %.c
>>   	$(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
>>
>> -.c.o:
>> +%.o: %.c version.h
>>   	@$(check_echo) "    [SP]     $<"
>>   	$(Q)$(check) $(AM_CFLAGS) $(CFLAGS) $<
>>   	@echo "    [CC]     $@"
>>   	$(Q)$(CC) $(AM_CFLAGS) $(CFLAGS) -c $<
>>
>> -%.static.o: %.c
>> +%.static.o: %.c version.h
>>   	@echo "    [CC]     $@"
>>   	$(Q)$(CC) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 3d715d8..d25054f 100644
--- a/Makefile
+++ b/Makefile
@@ -107,13 +107,13 @@  endif
 %.o.d: %.c
 	$(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(AM_CFLAGS) $(CFLAGS) $<
 
-.c.o:
+%.o: %.c version.h
 	@$(check_echo) "    [SP]     $<"
 	$(Q)$(check) $(AM_CFLAGS) $(CFLAGS) $<
 	@echo "    [CC]     $@"
 	$(Q)$(CC) $(AM_CFLAGS) $(CFLAGS) -c $<
 
-%.static.o: %.c
+%.static.o: %.c version.h
 	@echo "    [CC]     $@"
 	$(Q)$(CC) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@