2002-12-28 08:48:20

by Sam Ravnborg

[permalink] [raw]
Subject: [aic7xxx] Spurious recompile with defconfig

When compiling aic7xxx in 2.5.53 with defconfig the kernel always
recompiles because dependency for reg_print.c is not
per default in the aic7xxx Makefile.
Simple correction is to make PRETTY_PRINT dependend on BUILD_FIRMWARE.

Sam

===== drivers/scsi/aic7xxx/Kconfig.aic79xx 1.5 vs edited =====
--- 1.5/drivers/scsi/aic7xxx/Kconfig.aic79xx Fri Dec 13 21:17:38 2002
+++ edited/drivers/scsi/aic7xxx/Kconfig.aic79xx Sat Dec 28 09:46:40 2002
@@ -87,7 +87,7 @@

config AIC79XX_REG_PRETTY_PRINT
bool "Decode registers during diagnostics"
- depends on SCSI_AIC79XX
+ depends on SCSI_AIC79XX && SCSI_AIC7XXX_BUILD_FIRMWARE
default y
help
Compile in register value tables for the output of expanded register
===== drivers/scsi/aic7xxx/Kconfig.aic7xxx 1.6 vs edited =====
--- 1.6/drivers/scsi/aic7xxx/Kconfig.aic7xxx Tue Dec 24 20:12:14 2002
+++ edited/drivers/scsi/aic7xxx/Kconfig.aic7xxx Sat Dec 28 09:46:22 2002
@@ -92,7 +92,7 @@

config AIC7XXX_REG_PRETTY_PRINT
bool "Decode registers during diagnostics"
- depends on SCSI_AIC7XXX
+ depends on SCSI_AIC7XXX && SCSI_AIC7XXX_BUILD_FIRMWARE
default y
help
Compile in register value tables for the output of expanded register


2002-12-28 18:54:26

by Justin T. Gibbs

[permalink] [raw]
Subject: Re: [aic7xxx] Spurious recompile with defconfig

> When compiling aic7xxx in 2.5.53 with defconfig the kernel always
> recompiles because dependency for reg_print.c is not
> per default in the aic7xxx Makefile.
> Simple correction is to make PRETTY_PRINT dependend on BUILD_FIRMWARE.

There must be some other problem in the Makefile. You can turn on
reg pretty printing without having to build the firmware as there is
a "shipped" version of that file. I'll see if I can figure out why the
re-build is occurring.

--
Justin

2002-12-31 01:05:18

by Justin T. Gibbs

[permalink] [raw]
Subject: Re: [aic7xxx] Spurious recompile with defconfig

>> When compiling aic7xxx in 2.5.53 with defconfig the kernel always
>> recompiles because dependency for reg_print.c is not
>> per default in the aic7xxx Makefile.
>> Simple correction is to make PRETTY_PRINT dependend on BUILD_FIRMWARE.
>
> There must be some other problem in the Makefile. You can turn on
> reg pretty printing without having to build the firmware as there is
> a "shipped" version of that file. I'll see if I can figure out why the
> re-build is occurring.

The real problem here is that make choses the wrong path for getting
to reg_print.o and, since "intermediate files" were used, those files
are removed once the target is made (See "Chained Rules" in the gmake
info file). From the "make -d" output, for some reason make decides
that:

.o <- .s <- .c <- .c_shipped

is better than

.o <- .c <- .c_shipped

I can't see, from a cursory investigation of the 2.5.X Makefiles
why this happens, but it is certainly anoying. The info pages
indicate that the removal can be avoided by listing these files
as prerequisites to .SECONDARY, but I could only get that to work
by leaving the prerequisites empty (all files are marked secondary).
Of course this is just a workaround for incorrect behavior.
Perhaps someone with more knowledge of the 2.5.X build system could
look into this? That way we can restore the original (and correct)
behvior of the driver's Kconfig files.

--
Justin

2002-12-31 09:27:59

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [aic7xxx] Spurious recompile with defconfig

On Mon, Dec 30, 2002 at 06:12:49PM -0700, Justin T. Gibbs wrote:
> The real problem here is that make choses the wrong path for getting
> to reg_print.o and, since "intermediate files" were used, those files
> are removed once the target is made (See "Chained Rules" in the gmake
> info file). From the "make -d" output, for some reason make decides
> that:
>
> .o <- .s <- .c <- .c_shipped
>
> is better than
>
> .o <- .c <- .c_shipped
>
> I can't see, from a cursory investigation of the 2.5.X Makefiles
> why this happens, but it is certainly anoying.
Seems the pattern rule involving _shipped was fooling make somehow.
I listed the dependencies explicit (reg_print.c_shipped -> reg_print.c)
explicit and it worked.
Did a little more makefile tricks while I was there.
aicasm is too overloaded, it would have been better to have separate
tools for some of this.

Please forward to Linus if you find it OK.

Sam

===== drivers/scsi/aic7xxx/Makefile 1.18 vs edited =====
--- 1.18/drivers/scsi/aic7xxx/Makefile Sat Dec 21 01:59:49 2002
+++ edited/drivers/scsi/aic7xxx/Makefile Tue Dec 31 10:31:32 2002
@@ -43,41 +43,39 @@
# Dependencies for generated files need to be listed explicitly

$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_seq.h
+$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped
+
$(obj)/aic79xx_core.o: $(obj)/aic79xx_seq.h
+$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped

$(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_reg.h
$(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_reg.h

-ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
-aic7xxx_gen = $(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h
-ifeq ($(CONFIG_AIC7XXX_REG_PRETTY_PRINT),y)
-aic7xxx_gen += $(obj)/aic7xxx_reg_print.c
-aic7xxx_asm_cmd = $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \
- -p $(obj)/aic7xxx_reg_print.c -i aic7xxx_osm.h \
- -o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq
-else
-aic7xxx_asm_cmd = $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \
- -o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq
-endif
+aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_seq.h \
+ $(obj)/aic7xxx_reg.h
+aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c
+
+aicasm-7xxx-flags-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) := \
+ -p $(obj)/aic7xxx_reg_print.c -i aic7xxx_osm.h

-$(aic7xxx_gen): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
- $(aic7xxx_asm_cmd)
+ifneq ($(CONFIG_AIC7XXX_REG_PRETTY_PRINT)$(CONFIG_AIC7XXX_BUILD_FIRMWARE),)
+$(aic7xxx-gen-y): $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
+ $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \
+ $(aicasm-7xxx-flags-y) -o $(obj)/aic7xxx_seq.h $<
endif

-ifeq ($(CONFIG_AIC79XX_BUILD_FIRMWARE),y)
-aic79xx_gen = $(obj)/aic79xx_seq.h $(obj)/aic79xx_reg.h
-ifeq ($(CONFIG_AIC79XX_REG_PRETTY_PRINT),y)
-aic79xx_gen += $(obj)/aic79xx_reg_print.c
-aic79xx_asm_cmd = $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \
- -p $(obj)/aic79xx_reg_print.c -i aic79xx_osm.h \
- -o $(obj)/aic79xx_seq.h $(src)/aic79xx.seq
-else
-aic79xx_asm_cmd = $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \
- -o $(obj)/aic79xx_seq.h $(src)/aic79xx.seq
+aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE) := $(obj)/aic79xx_seq.h \
+ $(obj)/aic79xx_reg.h
+aic79xx-gen-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) += $(obj)/aic79xx_reg_print.c
+
+aicasm-79xx-flags-$(CONFIG_AIC79XX_REG_PRETTY_PRINT) := \
+ -p $(obj)/aic79xx_reg_print.c -i aic79xx_osm.h
+
+ifneq ($(CONFIG_AIC79XX_REG_PRETTY_PRINT)$(CONFIG_AIC79XX_BUILD_FIRMWARE),)
+$(aic79xx-gen-y): $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
+ $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h
+ $(aicasm-79xx-flags-y) -o $(obj)/aic79xx_seq.h $<
endif
-$(aic79xx_gen): $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
- $(aic79xx_asm_cmd)
-endif

$(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl]
$(MAKE) -C $(src)/aicasm