[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About g++ option -MM
From: |
address@hidden |
Subject: |
Re: About g++ option -MM |
Date: |
25 Jan 2006 22:55:36 -0800 |
User-agent: |
G2/0.2 |
Paul Pluzhnikov wrote:
> "PengYu.UT@gmail.com" <PengYu.UT@gmail.com> 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)?