[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: What is wrong with this simple rule in makefile?
From: |
Lin George |
Subject: |
RE: What is wrong with this simple rule in makefile? |
Date: |
Thu, 27 Apr 2006 06:54:03 -0700 (PDT) |
Thanks PATTON,
The problem is that, another guy has defined the
dependency of %.o to related %.cpp and header files by
using gcc -M to generate prerequisites automatically.
I am not sure whether in your approach, there will be
any conflicts since the target %.o is defined twice.
regards,
George
--- "PATTON, BILLY (SBCSI)" <address@hidden> wrote:
> I believe it would be
> %.o : %.cpp
> g++ $(CFLAGS) $<
>
> > -----Original Message-----
> > From: address@hidden
> > [mailto:address@hidden
> On Behalf
> > Of Lin George
> > Sent: Thursday, April 27, 2006 8:41 AM
> > To: address@hidden
> > Subject: What is wrong with this simple rule in
> makefile?
> >
> >
> > Hello everyone,
> >
> >
> > I want to use g++ $(CFLAGS) to compile any .cpp
> files
> > into .o files. For example, using g++ $(CFLAGS)
> > foo.cpp to generate foo.o, using g++ $(CFLAGS)
> goo.cpp
> > to generate goo.o. CFLAGS is a variale which I
> defined
> > before. I write a rule in Makefile as,
> >
> > %.o :
> > g++ $(CFLAGS) %.cpp
> >
> > But when executing the Makefile, it reports error
> > message "g++: %.cpp: No such file or directory".
> >
> > How to fix it?
> >
> >
> > thanks in advance,
> > George
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> >
> > _______________________________________________
> > Help-make mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/help-make
> >
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com