Paul Pluzhnikov wrote:
> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
>
> > Is there anyway that "main-o.o: main.cc" can be generated with g++?
>
> Sure:
>
> $ g++ -MM main.cc
> main.o: main.cc
> $ g++ -MM main.cc -MT main-o.o
> main-o.o: main.cc

The problem that I have actually is that, I want to compile two set of
object files. One set should be compiled with -O3, The other set should
be compiled with -g.

Suppose I have a lot of files,
file1.cc file2.cc ...

If I want the file1.cc->file1.o, etc, it is very easy, one command is
enough. And the rules are not needed. The we can include the following
.dep file in the Makefile to compile.

.dep: $(wildcard *.cc) $(wildcard *.h)
        @$(CXX) -MM $(CPPFLAGS) $(CFLAGS) $(wildcard *.cc) > .dep

However, if I use *.cc->*-o.o and *.cc->*-g.o, it is not very easy to
use only one lines. I'm wonder if you any better idea how to write all
the dependencies and the explicit rules(because different options are
used -O3 and -g)?

_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to