GBDKライブラリドキュメント
GBDK libraries documentation

Prev
1章 GBDKとmaccerの使用
Chapter 1.Using GBDK and maccer

Next

Makefileの使用
Using Makefiles

最も有用な開発ツールのうちの1つは、「make」、自動的にオブジェクトファイルを維持するプログラムとソースコードで最新のイメージです。 、1つのファイルタイプ(通常プログラムの実行を含んでいる)から別のものまで到着する方法の1セットの規則を持っていることにより作動します。 例えば「make image.gb」をタイプすれば、makeはmage.cまたはimage.sという名前のCまたはアセンブラのファイルを捜し、それをコンパイル、リンクして、自動的にイメージimage.gbを作成します。 最後のmake以降変更されたものだけを再コンパイルするので、多数のファイルからプロジェクトを構成する場合、それ自身のものに実際に入ります。
One of the most useful development tools is 'make', a program that automatically keeps your object files and images up to date with your source code.It works by having a set of rules of how to get from one file type to another, which normally involves running a program.For example by typing 'make image.gb' make will look for a C or assembler file called image.c or image.s, compile it and link it automatically creating the image image.gb.It really comes into its own when you have a project made up of multiple files as it only recompiles those that have changed since the last make.

DOS用のGNU makeのコピーは DJGPP の一部として利用可能です。 ほとんどのUnixシステムはインストールされたmakeが付属します。
A copy of GNU make for DOS is available as part of DJGPP.Most Unix systems come with make installed.

Gameboy porjectsのための一般的なMakefileが続きます:
A general Makefile for Gameboy porjects follows:

AS = lcc -c
CC = lcc -Wa-l -Wl-m

BIN = astro.gb
OBJS =  render.o sin_table.o stars.o debug.o fp_long.o sqrt.o floor.o \
        ftou.o sin_cos.o const.o inv_trig.o

all: $(BIN)

%.s: %.ms
     maccer -o $@ $<

$(BIN): $(OBJS)
     $(CC) -o $(BIN) $(OBJS)

clean:
     rm -f $(BIN) $(OBJS) *~
最初の2行は、アセンブラとリンカとしてデフォルトシステムの代わりにlccを使用するようにmakeに説得します。 BIN行は、終わりで望むイメージファイルの名前を指定します。 OBJS行は、BINが構築されるためにどのオブジェクトファイルを作らなければならないか明示します。 %.s:%.ms行は、.ms(マクロ)ファイルからのlccのための.sファイルを生成する方法を形に伝えます。
The first two lines convince make to use lcc as the assembler and linker instead of the default system ones.The BIN line specifies the name of the image file you want at the end.The OBJS line specifies what object files must be made for BIN to be built.The %.s: %.ms line tells make how to generate .s files for lcc from .ms (macro) files.

例えば、アセンブラファイル「render.ms」を変更しましょう。 makeが実行された場合、astro.gbが次にはrender.msに依存するrender.oに依存することを知ります。 その後、astro.sにastro.msファイルを変更するためにmaccerを使用します。また、その後、astro.gbを作成するために他方のすべての.oファイルと最終的にリンクされるastro.oへのastro.sをアセンブルするためにlccを使用します。
For example, suppose that I change the assembler file 'render.ms'.When make is run, it will find that astro.gb depends on render.o which in turn depends on render.ms.It will then use maccer to change the astro.ms file to astro.s, then it will use lcc to assemble astro.s to astro.o which is finally linked with all the other .o files to create astro.gb



Prev
ホーム
Home

Next
GBDKとmaccerの使用
Using GBDK and maccer

Up
ターゲットとしてのGameboy
The Gameboy as a Target
1