gcj

gcc + gdcコンパイルするついでに、gcj も作ってみた。

% gcj --version
gcj (GCC) 4.0.2 (gdc 0.16, using dmd 0.137)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% make
gcj -C CHoge.java
gcj -C Main.java
gcj --main=Main -o l01_java CHoge.class Main.class -lm -lgcj
% ls
CHoge.class     Main.class      Makefile        l01_java*
CHoge.java      Main.java       Makefile_java
% file *
CHoge.class:   compiled Java class data, version 45.3
CHoge.java:    ASCII C++ program text, with CRLF line terminators
Main.class:    compiled Java class data, version 45.3
Main.java:     ASCII C++ program text, with CRLF line terminators
Makefile:      ASCII make commands text, with CRLF line terminators
Makefile_java: ASCII make commands text, with CRLF line terminators
l01_java:      Mach-O executable ppc
% 

Java も言語なんだから、コンパイラを作ればネイティブバイナリを吐けるんだなあ。
JavaVM の上でしか動かない」という固定観念に取りつかれていた。いかんいかん。