Re: [aic7xxx] Spurious recompile with defconfig

Sam Ravnborg (sam@ravnborg.org)
Tue, 31 Dec 2002 10:36:19 +0100


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/