tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: make: ignore stale .depend
In article <5491.1290749270%bad.crufty.net@localhost>,
Simon J. Gerraty <sjg%crufty.net@localhost> wrote:
>So, it turns out
>
>1/ that the problem I mentioned occurs even when using vanila NetBSD
> make depend:
>
>$ head obj/.depend
>foo.o foo.ln: /homes/sjg/make-tests/stale/stale0/foo.c \
> /homes/sjg/make-tests/stale/stale0/foo.h
>goo.o goo.ln: /homes/sjg/make-tests/stale/stale0/goo.c \
> /homes/sjg/make-tests/stale/stale0/h/goo.h
>main.o main.ln: /homes/sjg/make-tests/stale/src/main.c /usr/include/stdlib.h \
> /usr/include/sys/cdefs.h /usr/include/machine/cdefs.h \
> /usr/include/sys/cdefs_elf.h /usr/include/sys/featuretest.h \
> /usr/include/sys/types.h /usr/include/machine/types.h \
> /usr/include/machine/int_types.h /usr/include/machine/ansi.h \
> /usr/include/sys/ansi.h /usr/include/machine/endian.h \
>$ make
>make: ignoring stale .depend for /homes/sjg/make-tests/stale/stale0/foo.c
>make: ignoring stale .depend for /homes/sjg/make-tests/stale/stale0/foo.h
># compile src/foo.o
>cc -O2 -g -I/homes/sjg/make-tests/stale/stale2/h -Werror -c
>/homes/sjg/make-tests/stale/stale0/foo.c
>cc: /homes/sjg/make-tests/stale/stale0/foo.c: No such file or directory
>cc: no input files
>*** Error code 1
>
>2/ that the fix I posed earlier, hoses meta mode (where we expect the
> depend file may contain "paths" which do not exist).
>
>So I've reverted to my original fix, which fixes the above without
>breaking meta mode:
>
>$ /var/obj/NetBSD/current/usr.bin/make/make
>make: ignoring stale .depend for
>/homes/sjg/make-tests/stale/stale0/foo.c, found
>/homes/sjg/make-tests/stale/stale2/foo.c
>make: ignoring stale .depend for
>/homes/sjg/make-tests/stale/stale0/foo.h, found
>/homes/sjg/make-tests/stale/stale2/foo.h
>make: ignoring stale .depend for
>/homes/sjg/make-tests/stale/stale0/goo.c, found
>/homes/sjg/make-tests/stale/stale2/goo.c
>make: ignoring stale .depend for /homes/sjg/make-tests/stale/stale0/h/goo.h
># compile src/goo.o
>cc -O2 -g -I/homes/sjg/make-tests/stale/stale2/h -Werror -c
>/homes/sjg/make-tests/stale/stale2/goo.c
># link src/stale
>cc -o stale main.o foo.o goo.o -Wl,-rpath-link,/lib
>-L/lib -Wl,-rpath-link,/usr/lib -L/usr/lib
>$
>
>Current patch and log comment:
>
>When a source file moves, make will ignore the stale dependency,
>but if the file in question is one that needs to be compiled (.c or .cc),
>it still hands the bogus name to the compiler.
>
>If Dir_MTime() cannot find such a file, see if the basename can be
>found via .PATH, and if so, tweak gn->name to be that basename.
>This prevents the stale path being given to the compiler.
>
>In meta_oodate(), if a referenced file no longer exists, consider the
>target out-of-date.
>
>Also, if meta_oodate() decides a target is out-of-date, and it
>it uses .OODATE in its commands, we need .OODATE recomputed.
>Undo our call to Make_DoAllVar() so that the call from Make_OODate()
>will do the right thing.
I have to say I don't like all this magic, since it re-running make
will do the same dance over and over again without fixing the dependency.
I think I prefer if make just exits on stale dependencies. I would go
as far as having an option to touch the *.d files as necessary to make
them stale :-)
christos
Home |
Main Index |
Thread Index |
Old Index