Moved from l-k to kbuild-devel, new subject.

On Thu, 11 Apr 2002 14:42:18 +0200 (CEST), 
Roman Zippel <[EMAIL PROTECTED]> wrote:
>What other problem are you trying to solve? My simple script solves the
>problem of unreliable time stamps, when applying patches. Unless the user
>changes the inputs, the output files won't be regenerated.

>From drivers/scsi/Makefile.in

shipped(53c8xx
        (53c8xx_d.h 53c8xx_u.h)
        (53c7,8xx.scr script_asm.pl)
        (set -ex;
          mkdir -p $(objdir)/.tmp_53c8xx;
          $(CPP_real) $(AFLAGS) -DCHIP=810 -x c $(srcfile 53c7,8xx.scr) |
          grep -v "^#" |
          (cd $(objdir)/.tmp_53c8xx; $(PERL) -s $(srcfile script_asm.pl));
          cp $(objdir)/.tmp_53c8xx/script.h $(objfile 53c8xx_d.h);
          cp $(objdir)/.tmp_53c8xx/scriptu.h $(objfile 53c8xx_u.h);
          rm -rf $(objdir)/.tmp_53c8xx;)
        (CONFIG_SCSI_NCR53C7xx) 
        )   

The generated commands in $KBUILD_OBJTREE/.tmp_global_makefile are
below.  What would the generated commands look like for your method?

Since this is all generated code and is automatic, you have to convince
me that changing the generated code is worthwhile.  The syntax above
should not change unless absolutely necessary, it cleanly separates
the outputs, inputs, command and dependencies.

Make sure that your method only regenerates the output once, after that
it must fall back to timestamp checks.  Also make sure that your method
supports the automatic update of shipped files when the developer is
ready to issue a new version, i.e. 'make 53c8xx_sum_shipped' updates
everything correctly.


53c8xx_files := /build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c7,8xx.scr 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/script_asm.pl 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_d.h_shipped 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_u.h_shipped
drivers/scsi/53c8xx_sum.d: /build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_sum 
$(53c8xx_files)
        $(KBUILD_QUIET)(set -e; \
          mkdir -p drivers/scsi; \
          sed -e 's:$$[ABD-Z][^$$]*\$$::g' $(53c8xx_files) > 
drivers/scsi/.tmp_53c8xx_files; \
          ($(MD5SUM) -c /build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_sum 
>/dev/null 2>&1 && echo S OK || echo F) > $@; \
          rm drivers/scsi/.tmp_53c8xx_files; \
        )

drivers/scsi/53c8xx_d.h: .tmp_setup
drivers/scsi/53c8xx_d.h: drivers/scsi/53c8xx_sum.d
        $(KBUILD_QUIET)scripts/pp_makefile5 $(PP_MAKEFILE5_FLAGS) --type=USER 
--target=drivers/scsi/53c8xx_d.h --command='[ "`cat drivers/scsi/53c8xx_sum.d`" = "S 
OK" ] &&       (         set -e;         cp 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_d.h_shipped drivers/scsi/53c8xx_d.h; 
      cp /build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_u.h_shipped 
drivers/scsi/53c8xx_u.h;     ) ||    (set -ex;       mkdir -p 
drivers/scsi/.tmp_53c8xx;      $(CPP_real) $(AFLAGS) -DCHIP=810 -x c 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c7,8xx.scr |         grep -v "^#" |       
   (cd drivers/scsi/.tmp_53c8xx; $(PERL) -s 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/script_asm.pl);     cp 
drivers/scsi/.tmp_53c8xx/script.h drivers/scsi/53c8xx_d.h;   cp 
drivers/scsi/.tmp_53c8xx/scriptu.h drivers/scsi/53c8xx_u.h;          rm -rf 
drivers/scsi/.tmp_53c8xx;)' --flags=''

CLEAN += drivers/scsi/53c8xx_d.h


# Exception: this writes to the source tree.  The target must be
# explicitly requested.
.PHONY: 53c8xx_sum_shipped
53c8xx_sum_shipped: drivers/scsi/53c8xx_d.h drivers/scsi/53c8xx_u.h
        @cmp -s drivers/scsi/53c8xx_d.h 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_d.h_shipped || \
             mv drivers/scsi/53c8xx_d.h 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_d.h_shipped
        @cmp -s drivers/scsi/53c8xx_u.h 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_u.h_shipped || \
             mv drivers/scsi/53c8xx_u.h 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_u.h_shipped
        @sed -e 's:$$[ABD-Z][^$$]*\$$::g' $(53c8xx_files) > 
drivers/scsi/.tmp_53c8xx_files; \
          $(MD5SUM) drivers/scsi/.tmp_53c8xx_files > $(patsubst 
%,drivers/scsi/%,.tmp_$(@F)) && \
          (cmp -s $(patsubst %,drivers/scsi/%,.tmp_$(@F)) 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_sum || \
            (echo Updating checksum for 53c8xx; \
            mv $(patsubst %,drivers/scsi/%,.tmp_$(@F)) 
/build/kaos/2.4.18-kbuild-2.5/drivers/scsi/53c8xx_sum))
        @rm -f drivers/scsi/53c8xx_sum.d $(patsubst %,drivers/scsi/%,.tmp_$(@F) 
drivers/scsi/.tmp_53c8xx_files)

ifneq ($(subst n,,$(CONFIG_SCSI_NCR53C7xx)),)
  all_sum_shipped: 53c8xx_sum_shipped
endif

drivers/scsi/53c8xx_u.h: drivers/scsi/53c8xx_d.h
        @/bin/true

# nodepend(/drivers/scsi/53c8xx_u.h)
CLEAN   += drivers/scsi/53c8xx_u.h


_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to