preprocessing java source

Peter Moulder reiter@netspace.net.au
Sat Jun 23 21:07:00 GMT 2001


On 2001年6月23日, 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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /