Re: CONFIG_MODVERSIONS problem identified

From: Russell King (rmk@arm.linux.org.uk)
Date: Thu Jul 27 2000 - 10:25:23 EST


Mikael Pettersson writes:
> +# forcibly remake modversions.h
> +update-modverfile: rm-modverfile $(TOPDIR)/include/linux/modversions.h
> +
> +rm-modverfile:
> + @rm -f $(TOPDIR)/include/linux/modversions.h
> +
> +$(TOPDIR)/include/linux/modversions.h:
> @echo updating $(TOPDIR)/include/linux/modversions.h

Doesn't look good!

1. What says that any make will always work left-to-right through a
   dependency list?
2. Since update-modverfile is only referenced in the top-level makefile,
   it seems sensible to move this there.
3. Always updating modversions.h will cause lots of files to (possibly)
   be remade unnecessarily.
4. make -j will also try to run 'rm-modverfile' and
   '$(TOPDIR)/include/linux/modversions.h' in parallel - therefore there's
   a race condition here.

I suggest doing something like:

.PHONY: $(TOPDIR)/include/linux/modversions.h
$(TOPDIR)/include/linux/modversions.h:
        @echo updating $(TOPDIR)/include/linux/modversions.h
        <<<old code to create modversions.h but as modversions.h.tmp>>>
        @cmp -s $@ $(TOPDIR)/include/linux/modversions.h.tmp || \
         mv $(TOPDIR)/include/linux/modversions.h.tmp $@
        @rm -f $(TOPDIR)/include/linux/modversions.h.tmp

in linux/Makefile. This way, we only actually touch modversions.h when
it has really changed.
   _____
  |_____| ------------------------------------------------- ---+---+-
  | | Russell King rmk@arm.linux.org.uk --- ---
  | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
  | +-+-+ --- -+-
  / | THE developer of ARM Linux |+| /|\
 / | | | --- |
    +-+-+ ------------------------------------------------- /\\\ |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:24 EST