Re: About g++ option -MM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/28/06, Peng Yu  wrote:
> The above method will replace old version ones with new version ones.
> What if I want to keep both versions like main-g.o and main-o.o?
>
This can be a litle tricky: implicit rules may be used, something like this:
%-g.o : %.cc
 $(COMPILE.c) -o $@ -c $<
%-o.o : %.cc
  ....

The sufficient enough scheme can be much more trickier. I simlify it a lot.
( Nevertheless, you may want to read:
http://make.paulandlesley.org/autodep.html    and
http://aegis.sourceforge.net/auug97.pdf    )

So, depending on whether you are in debug mode, you generate uniform
suffix to your objects, usually it will be .g.o - debug, .o - optimized:
SUFF :=

for dependency generation you define the following implicit rule:
%.d : %.cc
   g++ -MM -MT $<$SUFF $(CPPFLAGS) $(CXXFLAGS) $<  > $@

and you include all *.d files that are created:
include $(MY_SRC_LIST: .cc=.d)

Dima.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux