Alan Larkin wrote:
> I cant figure out how to write a Makefile.am which directs that a %.cpp
> be preprocessed to a %.i (and not compiled). Anybody got a suggestion?
>
> Something like:
>
> AM_CPPFLAGS = -I$(top_srcdir)/src @INCLTDL@
> bin_PROGRAMS = Quadratic
> Quadratic_SOURCES = Quadratic.cpp
> Quadratic_CPPFLAGS = -E #-o Quadratic.i
That's the same as setting CXX to CPP - no way it's going to work.
> chokes with the following:
>
> <snip>
> g++ -DHAVE_CONFIG_H -I. -I../src -E -g -O2 -MT Quadratic-Quadratic.o
> -MD -MP -MF .deps/Quadratic-Quadratic.Tpo -c -o Quadratic-Quadratic.o
> `test -f 'Quadratic.cpp' || echo './'`Quadratic.cpp
>
> mv -f .deps/Quadratic-Quadratic.Tpo .deps/Quadratic-Quadratic.Po
> /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o Quadratic
> Quadratic-Quadratic.o
>
> g++ -g -O2 -o Quadratic Quadratic-Quadratic.o Quadratic-Quadratic.o:
> file not recognized: File format not recognized
> collect2: ld returned 1 exit status
> make[1]: *** [Quadratic] Error 1
> <snip>
>
> Thanks very much.
Something like this perhaps (should also work in cases where "$(CC) -E"
is not equivalent to "$(CPP)"):
.i.cpp:
$(CPP) $(CPPFLAGS) -o $@ $<
noinst_DATA: Quadratic.i