This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch Makefile.in/Make-lang.in: create bison files atomically


On Oct 12, 2000, Alexandre Oliva <aoliva@redhat.com> wrote:

> On Oct 12, 2000, "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> wrote:
>> So I went through and changed the output filename for files generated
>> in the srcdir to utilize shell $$ ($$$$ in make) so that the name is
>> unique.  Then I move the unique file to the target name atomically.

> I don't think you want move-if-change.  In case there's no change, the
> file will end up being rebuilt over and over, since its timestamp
> won't change.  How about something like:

>         rm -f output-name || : ; \
>         mv on$$ output-name || rm on$$

> ?

I think I've just figured out why you chose to use move-if-change.

How about extending move-if-change so that you can run:

        $(SHELL) ./move-if-change -t "$?" on$$ output-name

if the files compare equal, it will remove on$$ and then compare the
timestamp of output-name with the files in the argument after `-t'.
If it's not the newest of them, it's just touched:

  if out=`ls -1dt $list "$file" | sed 1q`; test "x$out" != "x$file"; then
    touch "$file"
  fi

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]