This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: preprocessing java source
- To: Tony Kimball <alk at pobox dot com>
- Subject: Re: preprocessing java source
- From: Peter Moulder <reiter at netspace dot net dot au>
- Date: Sun, 24 Jun 2001 14:08:22 +1000 (EST)
- cc: green at redhat dot com, java at gcc dot gnu dot org, classpath at gnu dot org
On Sat, 23 Jun 2001, Tony Kimball wrote:
> Quoth Anthony Green on Saturday, 23 June:
> :
> : Any ideas/opinions?
> :
>
> ClassName.jpp -[cpp]-> ClassName.java -[gcj -C]-> ClassName.class -[gcj -o]-> ClassName.o
cpp produces `#' lines, which aren't valid in Java source. [I don't know
whether or not some compilers accept `#' lines as an extension.]
I use this in my makefiles. Make sure to add .cpp to .SUFFIXES
dependencies (or SUFFIXES variable if using automake).
.cpp:
# # The two-step process is to remove `#LINENUM' strings while
# # keeping line numbers the same as the input file (so long as no
# # #include's).
# # Note that `-P' isn't enough: it doesn't keep line numbers in
# # sync (e.g. it doesn't leave a line corresponding to `#endif').
$(CXXCPP) -C $(JAVACDEFINES) $< > $@.tmp
sed -f $(srcdir)/cppjava.sed $@.tmp > $@
rm -f $@.tmp
pjm.