[lug] OT: Makefile oddity
D. Stimits
stimits at idcomm.com
Sat Apr 27 13:35:17 MDT 2002
Tom Tromey wrote:
>
> >>>>> ">" == D Stimits <stimits at idcomm.com> writes:
>
> >> g++ ${CXXFLAGS} \
> >> ${INC} \
> >> -MM -MG ${SRC_UTILS} >> Makefile.dep
>
> >> What this above does is 100% correct, with one exception.
>
> Hmm.
>
> >> It assumes my dependency is for the current directory, e.g., if I
> >> have Abc.cxx, the output is Abc.o (this particular build directory
> >> has no linking, it is all intermediate object code output), but the
> >> actual build lines are using a relative directory, e.g., "../obj/".
>
> Unfortunately you are forced to use sed (or other post-processing),
> since you're running g++ once for your whole tree.
>
> If you build dependencies as a side effect of compilation you can use
> -MT to solve this particular problem. This overall approach has the
> benefit of being more efficient, parallelizable, and also always
> up-to-date.
>
> Tom
One thing I notice...or rather don't notice...is a man page description
of -MT, whereas I can find it for other cases. Is -MT not only gcc/g++
dependent, but also only available on some versions? I'm running RH 7.1.
I did some searching in info gcc index, but am not very good with the
emacs bindings (well, really I suck with that, basic navigation is it
for me).
D. Stimits, stimits at idcomm.com
More information about the LUG
mailing list