help-make
[Top][All Lists]
Advanced

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

Re: make can not find .cpp file, any general comments or suggestions to


From: Paul D. Smith
Subject: Re: make can not find .cpp file, any general comments or suggestions to debug?
Date: Sun, 7 May 2006 15:08:33 -0400

%% Lin George <address@hidden> writes:

  lg> Thank you Greg!
  lg> A great answer!

  >> If you only want to preprocess a file, you could use
  >> CPP = gcc
  >> $(CPP) $(CPPFLAGS) -E source.o -o source.i

I don't recommend this, actually: to be more correct you should use:

    CPP = gcc -E

Then something like:

    COMPILE.i = $(CPP) $(CPPFLAGS) -o $@

    %.i : %.c
            $(COMPILE.i) $<
    %.i : %.cc
            $(COMPILE.i) $<

The -E flag is what tells "gcc" to stop after the preprocessing stage,
and so it more correctly belongs directly in the CPP macro.  If you were
using a different preprocessor, like "cpp" directly, you would want to
replace the entire thing and not have the extra "-E" lying around.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]