MacOS上でのKPIT GNU ToolsのコンパイルとR8C/M16C/M32CおよびH8の開発環境の構築
Leopard + fink およびSnow Leopard + MacPortsで確認しました。 下記はH8の開発環境ですがh8300のところを、m32cとすればR8C/M16C/M32C用のgccがビルドできます。 gmp、mpfr, mpcおよびlibiconvは下記の例ではfinkでインストールしたものを使っていますので、 その他prefix、bindir、mandir infordir は適当に読み替えて下さい。 また--with-ppl および --with-libelf でビルドしていますが、本当に必要かどうかはわかりません。
$ ./configure --prefix=/usr/local/share/h8 --target=h8300-elf --program-prefix=h8300-elf- \ --bindir=/usr/local/bin --mandir=/usr/local/man --infodir=/usr/local/share/info \ --disable-nls --disable-werror --with-ppl=/sw $ make $ sudo make install/usr/local/infoにできたファイルは頭にh8300-elf- (もしくはm32c-elf-)を追加したほうが良いと思います。 以下同様。
$ cd build $ ../configure --prefix=/usr/local/share/h8 --enable-languages=c \ --program-prefix=h8300-elf- --target=h8300-elf --disable-libssp --with-newlib \ --with-gmp=/sw --disable-nls --with-libiconv-prefix=/sw --with-libelf=/sw \ --bindir=/usr/local/bin --mandir=/usr/local/man --infodir=/usr/local/share/info $ make $ sudo make installここで --enable-languages=c,c++とするとうまくビルドできませんでした。次のnewlibと一緒に コンパイルする方法もあるとのことですが、よくわかりません。
$ ./configure --prefix=/usr/local/share/h8 --target=h8300-elf --program-prefix=h8300-elf- \ --bindir=/usr/local/bin --mandir=/usr/local/man --infodir=/usr/local/share/info \ --with-libelf=/sw $ make $ sudo make install
$ ../configure --prefix=/usr/local/share/h8 --enable-languages=c,c++ \ --program-prefix=h8300-elf- --target=h8300-elf --disable-libssp --with-newlib \ --with-gmp=/sw --disable-nls --with-libiconv-prefix=/sw --with-libelf=/sw \ --bindir=/usr/local/bin --mandir=/usr/local/man --infodir=/usr/local/share/info \ --disable-libstdcxx-pch $ make $ sudo make install2度目は--enable-languages=c,c++としてうまくいきました。--disable-libstdcxx-pchを追加しています。
$ ./configure --prefix=/usr/local/share/h8 --target=h8300-elf --program-prefix=h8300-elf- \ --bindir=/usr/local/bin --mandir=/usr/local/man --infodir=/usr/local/share/info \ --with-libelf=/sw $ make $ sudo make install
クロスコンパイラとして、fink にはavr, msp430が、MacPortsにはarm, avr, mipsなどがあるようです。