This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: preprocessing java source


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]