.. 13-build .. _label13: ビルド関数とユーティリティ ================================== .. index:: single: .PHONY single: .DEFAULT single: .SUBDIRS single: .SCANNER single: .INCLUDE single: .ORDER single: .BUILD_BEGIN single: .BUILD_SUCCESS single: .BUILD_FAILURE .. _label13.1: ビルドイン .PHONY ターゲット -------------------------------------- .. The complete set of builtin .PHONY targets include the following. 以下にビルドイン ``.PHONY`` ターゲットの完全なリストを示します。 * **.PHONY** .. Declares new phony targets (Section 8.10). 新しいphonyターゲットを宣言します。(:ref:`label8.10`) * **.DEFAULT** .. Declare the default build targets (Section 8.7). デフォルトのビルドターゲットを宣言します。(:ref:`label8.7`) * **.SUBDIRS** .. Include a directory as part of the project (Section 8.8). プロジェクトの一部としてディレクトリをインクルードします。(:ref:`label8.8`) * **.SCANNER** .. Define a dependency scanner (Section 8.8). 依存関係のスキャナを定義します。(:ref:`label8.6`) * **.INCLUDE** .. Include a file (Section 8.9). ファイルをインクルードします。(:ref:`label8.9`) * **.ORDER** .. Define a file-dependency ordering rule (Section 10.3.6). ファイルの依存関係ルールの順番を定義します。(:ref:`label10.3.6`) * **.BUILD_BEGIN** .. Commands to be executed at the beginning of a build. ビルド開始時に実行されるコマンド * **.BUILD_SUCCESS** .. Commands to be executed if the build is successful. ビルドが成功したときに実行されるコマンド * **.BUILD_FAILURE** .. Commands to be executed if the build fails. ビルドが失敗したときに実行されるコマンド .. The .BUILD targets can be used to specify commands to be executed at the beginning and end of the build. The .BUILD_BEGIN target is built at the beginning of a project build, and one of .BUILD_FAILURE or .BUILD_SUCCESS is executed when the build terminates. ``.BUILD`` ターゲットはビルドの開始と終了時に実行されるコマンドを指定するために用いられます。 ``.BUILD_BEGIN`` ターゲットはプロジェクトをビルドする前に実行されて、 ``.BUILD_FAILURE`` または ``.BUILD_SUCCESS`` はビルドが終了したときに実行されます。 .. For example, the following set of rules simply print additional messages about the status of the build. 例えば、以下のルールの集合はビルドの状況について、簡単なメッセージを表示します。 :: .BUILD_BEGIN: echo Build starting .BUILD_SUCCESS: echo The build was successful .BUILD_FAILURE: println($"The build failed: $(length $(find-build-targets Failed)) targets could not be built") .. Another common use is to define notifications to be performed when the build completes. For example, the following rule will create a new X terminal displaying the summary of the build (using the BUILD_SUMMARY variable). 通常用いる別の使い方としては、ビルドが完了したときに通知するように定義するという方法があります。例えば、以下のルールでは(BUILD_SUMMARY変数を使うことで)ビルドの要約を新しいXターミナル上に表示します。 :: .BUILD_FAILURE: xterm -e vi $(BUILD_SUMMARY) .. If you do not wish to add these rules directly to your project (which is probably a good idea if you work with others), you can define them in your .omakerc (see Section A.8). あなたがプロジェクトに直接これらのルールを追加したくない場合(もしあなたが他の場所で実行するなら、これはよいアイデアです)、あなたはこれらのルールを ``.omakerc`` に定義することができます(詳細は :ref:`labelA.8` を参照してください)。 .. The find-build-targets function is useful for obtaining a firther summary of the build. Note that when output diversions are in effect (with the --output-* options — see Chapter A), any output produced by the commands is copied to a file. The name of the file is specified by the output-file field of the Target object. You may find this useful in defining custom build summaries. ``find-build-targets`` 関数はさらに具体的なビルドの状況を取得したいときに有用です。 ``--output-*`` オプションを使って出力先を変更している場合、コマンドによって生成された出力はファイルにコピーされることに注意してください。ファイル名は ``Target`` オブジェクトの ``output-file`` フィールドによって指定されます。あなたはビルドの状況をカスタマイズしたいときに、この方法を試してみてください。 .. _label13.2: オプションとバージョン管理 -------------------------------------- .. index:: single: OMakeFlags() .. _label13.2.1: OMakeFlags ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: OMakeFlags(options) options : String .. The OMakeFlags function is used to set omake options from within OMakefiles. The options have exactly the same format as options on the command line. ``OMakeFlags`` 関数はOMakefileの内部で ``omake`` のオプションを設定したいときに用いられます。オプションはコマンドライン上でのオプション指定と全く同じフォーマットで指定します。 .. For example, the following code displays the progress bar unless the VERBOSE environment variable is defined. 例えば、以下のコードは ``VERBOSE`` 環境変数が定義されるまで、プログレスバーを表示し続けます。 :: if $(not $(defined-env VERBOSE)) OMakeFlags(-S --progress) export .. index:: single: OMakeVersion() .. _label13.2.2: OMakeVersion ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: OMakeVersion(version1) OMakeVersion(version1, version2) version1, version2 : String .. The OMakeVersion function is used for version checking in OMakefiles. It takes one or two arguments. ``OMakeVersion`` 関数はOMakefileのバージョンをチェックするときに用いられます。この関数は1つ、または2つの引数を取ります。 .. In the one argument form, if the omake version number is less than , then an exception is raised. In the two argument form, the version must lie between version1 and version2. 1つの引数をとる形では、omakeのバージョン番号が ```` よりも低いときに例外を送出します。2つ引数をとる形では、omakeのバージョン番号は ``version1`` と ``version2`` の間になければなりません。 .. index:: single: cmp-versions() .. _label13.2.3: cmp-versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: $(cmp-versions version1, version2) version1, version2 : String .. The cmp-versions\ functions can be used to compare arbitrary version strings. It returns 0 when the two version strings are equal, a negative number when the first string represents an earlier version, and a positive number otherwise. ``cmp-versions`` 関数は任意のバージョン文字列を比較することができます。2つのバージョン文字列が等しいときには、この関数は0を返します。一方で、最初の文字列が2番めよりも若いバージョンであるときには負の値を返し、そのいづれでもないときには正の値を返します。 .. index:: single: DefineCommandVars() .. _label13.2.4: DefineCommandVars ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: DefineCommandVars() .. The DefineCommandVars function redefines the variables passed on the commandline. Variables definitions are passed on the command line in the form name=value. This function is primarily for internal use by omake to define these variables for the first time. ``DefineCommandVars`` 関数はコマンドライン上から受け渡した変数を再定義します。変数定義はコマンドラインから ``name=value`` の形で受け渡されます。この関数は、これらの変数を最初の時点で定義するため、omakeが内部で使用します。 .. _label13.3: 依存関係グラフの調査 -------------------------------------- .. index:: single: dependencies() single: dependencies-all() single: dependencies-proper() .. _label13.3.1: dependencies, dependencies-all, dependencies-proper ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: $(dependencies targets) : File Array $(dependencies-all targets) : File Array $(dependencies-proper targets) : File Array targets : File Array raises RuntimeException .. The dependencies function returns the set of immediate dependencies of the given targets. This function can only be used within a rule body and all the arguments to the dependency function must also be dependencies of this rule. This restriction ensures that all the dependencies are known when this function is executed. ``dependencies`` 関数は与えられたターゲットの明示的な依存関係の集合を返します。この関数はルールの本体だけに使うことができます。さらに、 ``dependency`` 関数のすべての引数は、このルールの依存先でなければいけません。この制約は、関数が実行されたときにすべての依存関係が解析されていることを保証してくれます。 .. The dependencies-all function is similar, but it expands the dependencies recursively, returning all of the dependencies of a target, not just the immediate ones. ``dependencies-all`` 関数は似ていますが、この関数は依存関係を再帰的に展開し、明示的な依存関係だけでなくターゲットの依存関係すべてを返してくれます。 .. The dependencies-proper function returns all recursive dependencies, except the dependencies that are leaf targets. A leaf target is a target that has no dependencies and no build commands; a leaf target corresponds to a source file in the current project. ``dependencies-proper`` 関数は『末端』となる依存先を除く、すべての依存関係を再帰的に返します。『末端』のターゲットは依存先やビルドコマンドが存在しないターゲット、つまり、現在のプロジェクト上にあるソースファイルの集合を指しています。 .. In all three functions, files that are not part of the current project are silently discarded. All three functions will return phony and scanner targets along with the “real” ones. この3つの関数では、現在のプロジェクトの一部でないファイルは無視されます。また、3つの関数はすべて『実際のファイル』に関連しているphonyやscannerターゲットも返します。 .. One purpose of the dependencies-proper function is for “clean” targets. For example, one way to delete all intermediate files in a build is with a rule that uses the dependencies-proper. Note however, that the rule requires building the project before it can be deleted. ``dependencies-proper`` 関数を使う一つの目的としては"clean"ターゲットを実装することが挙げられます。例えば、ビルドしたすべての明示的なファイルを削除する一つの方法としては、 ``dependencies-proper`` をルール部分に使うことです。しかしながら、このルールでは消去する前にプロジェクトをビルドすることが必要となってきます。 :: .PHONY: clean APP = ... # 対象となるアプリケーション名 clean: $(APP) rm -f $(dependencies-proper $(APP)) .. Also note that the dependencies-proper function will return the phony and scanner targets in addition to real one. ``dependencies-proper`` 関数はまた、実際のファイルに加えてphonyやscannerターゲットも返してしまうことに注意してください。 .. For other (possibly better) alternatives, see Section 10.3.3 and filter-proper-targets function. (さらにより良く実装している)別のサンプルについては、 :ref:`label10.3.3` か ``filter-proper-targets`` 関数を参照してください。 .. index:: single: target() .. _label13.3.2: target ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: $(target targets) : Target Array targets : File Sequence raises RuntimeException .. The target function returns the Target object associated with each of the targets. See the Target object for more information. ``target`` 関数はそれぞれのターゲットに関連しているTargetオブジェクトを返します。詳細な情報は ``Target`` オブジェクト( :ref:`label12.1.11` )を参照してください。 .. index:: single: find-build-targets() .. _label13.3.3: find-build-targets ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: $(find-build-targets tag) : Target Array tag : Succeeded | Failed .. The find-build-targets allow the results of the build to be examined. The tag must specifies which targets are to be returned; the comparison is case-insensitive. ``find-build-targets`` はビルドの実行結果を返します。 ``tag`` では、どのターゲットを返すべきなのかについて指定します。結果は ``tag`` の場合によって異なります。 * **Succeeded** .. The list of targets that were built successfully. ビルドが成功したターゲットのリスト * **Failed** .. The list of targets that could not be built. ビルドできなかったターゲットのリスト .. These are used mainly in conjuction with the .BUILD_SUCCESS (Section 13.1) and .BUILD_FAILURE (Section 13.1) phony targets. For example, adding the following to your project OMakefile will print the number of targets that failed (if the build failed). これらは主に ``.BUILD_SUCCESS`` や ``.BUILD_FAILURE`` phonyターゲットと一緒に使われます。例えば、あなたのプロジェクトの ``OMakefile`` に以下を加えることで、(ビルドが失敗したときに)失敗したターゲットの数を表示します。 :: .BUILD_FAILURE: echo "Failed target count: $(length $(find-build-targets Failed))" .. index:: single: project-directories() .. _label13.3.4: project-directories ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: $(project-directories) : Dir Array .. The project-directories function returns the list of all directories that are considered to be part of the project. ``project-directories`` 関数はプロジェクトの一部であると考えられる、すべてのディレクトリのリストを返します。 .. To get the complete directory list, this function should be called from within a rule body. 完全なディレクトリのリストを取得するためには、この関数をルールの本体で呼び出すべきです。 .. index:: single: rule() .. _label13.3.5: rule ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The rule function is called whenever a build rule is defined. It is unlikely that you will need to redefine this function, except in very exceptional cases. ``rule`` 関数はビルドルールが定義されたときにいつでも呼び出されます。非常に特別なケースを除いて、あなたはこの関数を再定義すべきではありません。 :: rule(multiple, target, pattern, sources, options, body) : Rule multiple : String target : Sequence pattern : Sequence sources : Sequence options : Array body : Body .. The rule function is called when a rule is evaluated. ``rule`` 関数はルールが評価されたときに呼び出されます。 * **multiple** .. A Boolean value indicating whether the rule was defined with a double colon ::. ルールがダブルコロン ``::`` を用いて定義されているかどうかを示しています。 * **target** .. The sequence of target names. ターゲット名のシーケンスです。 * **pattern** .. The sequence of patterns. This sequence will be empty for two-part rules. パターンのシーケンスです。このシーケンスは通常の2パートのルール定義のときには空となります。 * **sources** .. The sequence of dependencies. 依存関係のシーケンスです。 * **options** .. An array of options. Each option is represented as a Map object associating each specified option with a value. オプションの配列です。各々のオプションは、オプション名と値が関連付けられている ``Map`` (辞書型の)オブジェクトとして表現されます。 * **body** .. The body expression of the rule. ルールの内容を表しています。 .. Consider the following rule. 以下のルールを考えてみましょう。 :: target: pattern: sources :name1: option1 :name2: option2 expr1 expr2 .. This expression represents the following function call, where square brackets are used to indicate arrays, and the curly brackets represent a Map object. 上の式はまず以下の関数の呼び出しに置き換えられ、[]は配列を指定するために用いられ、さらに{}はMapオブジェクトに置き換わります。 :: rule(false, target, pattern, sources, { $|:name1:| = option1; $|:name2:| = option2 } [expr1; expr2]) .. index:: single: build() .. _label13.3.6: build ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: build(targets : File Array) : bool .. Build the given targets. The value is true iff the build was successful. This function can be used only in osh. 与えられたターゲットをビルドします。ビルドが成功した場合、この関数は真を返します。この関数は ``osh`` 上でのみ使うことができます。 .. _label13.4: OMakerootファイル -------------------------------------- .. The standard OMakeroot file defines the functions are rules for building standard projects. 標準のOMakerootファイルでは、普通のプロジェクトをビルドするためのルール関数を定義しています。 .. index:: single: ROOT single: CWD single: EMPTY single: STDROOT single: ABORT_ON_COMMAND_ERROR single: SCANNER_MODE .. _label13.4.1: 変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * **ROOT** .. The root directory of the current project. 現在のプロジェクトのルートディレクトリ * **CWD** .. The current working directory (the directory is set for each OMakefile in the project). カレント作業ディレクトリ(このディレクトリは、プロジェクトにある各々のOMakefileの集合です) * **EMPTY** .. The empty string. 空文字列 * **STDROOT** .. The name of the standard installed OMakeroot file. 標準でインストールされているOMakerootのファイル名 * **ABORT_ON_COMMAND_ERROR** .. If set to true, the construction of a target should be aborted whenever one of the commands to build it fail. This defaults to true, and should normally be left that way. trueに設定した場合、たとえコマンドの一つがビルドに失敗したとしても、ターゲットはそれを無視します。デフォルトの値はtrueで、通常はそのままにしておくべきです。 * **SCANNER_MODE** .. This variable should be defined as one of four values (defaults to enabled). この変数は以下の4つの値のうちの1つを選んで定義する必要があります(デフォルトは ``enabled`` です)。 * **enabled** .. Allow the use of default .SCANNER rules. Whenever a rule does not specify a :scanner: dependency explicitly, try to find a .SCANNER with the same target name. デフォルトの ``.SCANNER`` ルールを使うことを許可します。たとえルールが明示的に ``:scanner:`` 依存関係を指定していなくても、omakeは同じ名前のターゲットから ``.SCANNER`` を検索します。 * **disabled** .. Never use default .SCANNER rules. デフォルトの ``.SCANNER`` ルールを使いません。 * **warning** .. Allow the use of default .SCANNER rules, but print a warning whenever one is selected. デフォルトの ``.SCANNER`` ルールを使うことを許可しますが、そのうちの一つを使うことになったとき、omakeは常に警告を表示します。 * **error** .. Do not allow the use of default .SCANNER rules. If a rule does not specify a :scanner: dependency, and there is a default .SCANNER rule, the build will terminate abnormally. デフォルトの ``.SCANNER`` ルールを使うことを許可しません。もしルールが明示的に ``:scanner:`` 依存関係をしておらず、さらにデフォルトの ``.SCANNER`` を使うことになったとき、このルールのビルドは異常終了します。 .. index:: single: INSTALL single: PATHSEP single: DIRSEP single: EXT_OBJ single: EXT_LIB single: EXT_DLL single: EXT_ASM single: EXE .. _label13.4.2: システム変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The command to install a program (install on Unix, cp on Win32). The normal path separator (: on Unix, ; on Win32). The normal directory separator (/ on Unix, \ on Win32). File suffix for an object file (default is .o on Unix, and .obj on Win32). File suffix for a static library (default is .a on Unix, and .lib on Win32). File suffix for a shared library (default is .so on Unix, and .dll on Win32). File suffix for an assembly file (default is .s on Unix, and .asm on Win32). File suffix for executables (default is empty for Unix, and .exe on Win32 and Cygwin). * **INSTALL** : プログラムをインストールするためのコマンド( ``Unix`` は ``install`` 、 ``Win32`` は ``cp``) * **PATHSEP** : 通常用いるパスのセパレータ( ``Unix`` は ``:`` 、 ``Win32`` は ``;``) * **DIRSEP** : 通常用いるディレクトリのセパレータ( ``Unix`` は ``/`` 、 ``Win32`` は ``\``) * **EXT_OBJ** : オブジェクトファイルの拡張子( ``Unix`` は ``.o`` 、 ``Win32`` は ``.obj``) * **EXT_LIB** : 静的ライブラリの拡張子( ``Unix`` は ``.a`` 、 ``Win32`` は ``.lib``) * **EXT_DLL** : 共有ライブラリの拡張子( ``Unix`` は ``.so`` 、 ``Win32`` は ``.dll``) * **EXT_ASM** : アセンブリファイルの拡張子( ``Unix`` は ``.s`` 、 ``Win32`` は ``.asm``) * **EXE** : 実行可能形式の拡張子( ``Unix`` は空文字列 、 ``Win32`` や ``Cygwin`` は ``.exe``) .. _label13.5: C/C++コードのビルド -------------------------------------- .. OMake provides extensive support for building C and C++ programs. In order to use the functions defined in this section, you need to make sure the line is present in your OMakeroot file. OMakeではCやC++のプログラムのビルドを広範囲にわたってサポートする機能を提供しています。このセクションで列挙している関数を使うためには、まずあなたの ``OMakeroot`` ファイルに、以下の一行を追加してください。 :: open build/C .. _label13.5.1: 自動設定変数(Autoconfiguration variables) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. These variables will get defined based on the “autoconf-style” static. tests executed when you run OMake for the first time. You can use them to configure your project accordingly, and you should not redefine them. これらの変数はまず最初にOMakeを実行した時点でautoconfスタイルの ``static.`` が実行されて、その結果を元に決定されます。あなたのプロジェクトを調和の取れた状態にするためには、これらの変数を使用してください。また、あなたはこれらの変数を再定義すべきではありません。 .. You can use the --configure command line option (Section A.3.9) to force re-execution of all the tests. あなたは強制的にすべてのテストを実行させるために、 ``--configure`` コマンドラインオプション( :ref:`labelA.3.9` を参照)を使うことができます。 .. A different set of autoconfiguration tests is performed depending on the build environment involved — one set of tests would be performed in a Win32 environment, and another — in a Unix-like environment (including Linux, OS X and Cygwin). これらの自動設定変数の値はビルドする環境に依存します。これらの変数の一部は ``Win32`` の環境下と、(Linux, OS X, Cygwinを含む)Unixライクな環境下では異なるふるまいをします。 .. index:: single: GCC_FOUND single: GXX_FOUND .. _label13.5.1.1: Unixライクなシステム """""""""""""""""""""""""""""""""""""" .. A boolean flag specifying whether the gcc binary was found in your path. A boolean flag specifying whether the g++ binary was found in your path. * **GCC_FOUND** : ``gcc`` バイナリを発見したかどうかを示す真偽値 * **GXX_FOUND** : ``g++`` バイナリを発見したかどうかを示す真偽値 .. index:: single: CL_FOUND single: LIB_FOUND .. _label13.5.1.2: Win32 """""""""""""""""""""""""""""""""""""" .. A boolean flag specifying whether the cl binary was found in your path. A boolean flag specifying whether the lib binary was found in your path. * **CL_FOUND** : ``cl`` バイナリを発見したかどうかを示す真偽値 * **LIB_FOUND** : ``lib`` バイナリを発見したかどうかを示す真偽値 .. index:: single: CC single: CXX single: CPP single: CFLAGS single: CXXFLAGS single: INCLUDES single: LIBS single: CCOUT single: AS single: ASFLAGS single: ASOUT single: AR single: LD single: LDFLAGS single: LDFLAGS_DLL single: LDOUT single: YACC single: LEX .. _label13.5.2: C/C++用の設定変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The following variables can be redefined in your project. 以下の変数があなたのプロジェクト上で定義されています。 * **CC** .. The name of the C compiler (on Unix it defaults to gcc when gcc is present and to cc otherwise; on Win32 defaults to cl /nologo). Cコンパイラの名前( ``Unix`` では ``gcc`` が発見されたときはデフォルトの値として ``gcc`` が使われます。そうでない場合は ``cc`` が使われます。 ``Win32`` ではデフォルトの値は ``cl /nologo`` です。) * **CXX** .. The name of the C++ compiler (on Unix it defaults to gcc when gcc is present and to c++ otherwise; on Win32 defaults to cl /nologo). C++コンパイラの名前( ``Unix`` では ``gcc`` が発見されたときはデフォルトの値として ``gcc`` が使われます。そうでない場合は ``c++`` が使われます。 ``Win32`` ではデフォルトの値は ``cl /nologo`` です。) * **CPP** .. The name of the C preprocessor (defaults to cpp on Unix, and cl /E on Win32). Cプリプロセッサの名前( ``Unix`` ではデフォルトの値は ``cpp`` 、 ``Win32`` の場合は ``cl /E`` ) * **CFLAGS** .. Compilation flags to pass to the C compiler (default empty on Unix, and /DWIN32 on Win32). Cコンパイラに渡すコンパイルフラグ( ``Unix`` ではデフォルトの値は空文字列、 ``Win32`` の場合は ``/DWIN32`` ) * **CXXFLAGS** .. Compilation flags to pass to the C++ compiler (default empty on Unix, and /DWIN32 on Win32). C++コンパイラに渡すコンパイルフラグ( ``Unix`` ではデフォルトの値は空文字列、 ``Win32`` の場合は ``/DWIN32`` ) * **INCLUDES** .. Additional directories that specify the search path to the C and C++ compilers (default is .). The directories are passed to the C and C++ compilers with the -I option. The include path with -I prefixes is defined in the PREFIXED_INCLUDES variable. C/C++コンパイラに渡す、追加する検索パスを指定しているディレクトリの値(デフォルトの値は ``.`` )。これらのディレクトリは ``-I`` オプションを追加してC/C++コンパイラに受け渡されます。また、 ``-I`` 接頭辞を追加したインクルードパスは ``PREFIXED_INCLUDES`` 変数で定義されます。 * **LIBS** .. Additional libraries needed when building a program (default is empty). プログラムをビルドするときに必要となる追加ライブラリ(デフォルトの値は空文字列) * **CCOUT** .. The option to use for specifying the output file in C and C++ compilers (defaults to -o on Unix and /Fo on Win32). C/C++コンパイラの出力ファイルの場所を指定するオプション( ``Unix`` ではデフォルトの値は ``-o`` 、 ``Win32`` の場合は ``/Fo`` ) * **AS** .. The name of the assembler (defaults to as on Unix, and ml on Win32) アセンブラの名前( ``Unix`` ではデフォルトの値は ``as`` 、 ``Win32`` の場合は ``ml`` ) * **ASFLAGS** .. Flags to pass to the assembler (default is empty on Unix, and /c /coff on Win32). アセンブラに渡すフラグ( ``Unix`` ではデフォルトの値は空文字列、 ``Win32`` の場合は ``/c /coff`` ) * **ASOUT** .. The option string that specifies the output file for AS (defaults to -o on Unix and /Fo on Win32). ``AS`` の出力ファイルの場所を指定するオプション文字列( ``Unix`` ではデフォルトの値は ``-o`` 、 ``Win32`` の場合は ``/Fo`` ) * **AR** .. The name of the program to create static libraries (defaults to ar cq on Unix, and lib on Win32). 静的ライブラリを生成するためのプログラム名( ``Unix`` ではデフォルトの値は ``ar cq`` 、 ``Win32`` の場合は ``lib`` ) * **LD** .. The name of the linker (defaults to ld on Unix, and cl on Win32). リンカの名前( ``Unix`` ではデフォルトの値は ``ld`` 、 ``Win32`` の場合は ``cl`` ) * **LDFLAGS** .. Options to pass to the linker (default is empty). リンカに渡すオプション(デフォルトの値は空文字列) * **LDFLAGS_DLL** .. Options to pass to the linker when compiling a shared library (defaults to -shared on Unix and /DLL on Win32). 共有ライブラリをコンパイルするときにリンカに受け渡すオプション( ``Unix`` ではデフォルトの値は ``-shared`` 、 ``Win32`` の場合は ``/DLL`` ) * **LDOUT** .. The option to use for specifying the output file in C and C++ linkers (defaults to -o on Unix and /Fe on Win32). C/C++リンカが生成する出力ファイルの場所を指定するオプション( ``Unix`` ではデフォルトの値は ``-o`` 、 ``Win32`` の場合は ``/Fe`` ) * **YACC** .. The name of the yacc parser generator (default is yacc on Unix, empty on Win32). ``yacc`` パーサジェネレータの名前( ``Unix`` ではデフォルトの値は ``yacc`` 、 ``Win32`` の場合は空文字列) * **LEX** .. The name of the lex lexer generator (default is lex on Unix, empty on Win32). ``lex`` レキサジェネレータの名前( ``Unix`` ではデフォルトの値は ``lex`` 、 ``Win32`` の場合は空文字列) .. _label13.5.3: Cファイルの生成 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. Because the C scanners do not normally know anything about generated source files (such as generated header files), these files may need to be created before running the scanner. Cのスキャナは(生成されたヘッダファイルのような)生成されたソースファイルについては何も知りません。よって、これらのファイルはスキャナが実行される前に生成される必要があります。 .. index:: single: CGeneratedFiles() single: LocalCGeneratedFiles() .. _label13.5.3.1: CGeneratedFiles, LocalCGeneratedFiles """""""""""""""""""""""""""""""""""""""""""""""""""" :: CGeneratedFiles(files) LocalCGeneratedFiles(files) .. The CGeneratedFiles and LocalCGeneratedFiles functions specify files that need to be generated before any C files are scanned for dependencies. For example, if config.h and inputs.h are both generated files, specify: ``CGeneratedFiles`` と ``LocalCGeneratedFiles`` 関数は、Cファイルについての依存関係をスキャンする前に生成される必要があるファイルを指定します。例えば、 ``config.h`` と ``inputs.h`` が両方とも生成されるファイルである場合、以下のように指定します。 :: CGeneratedFiles(config.h inputs.h) .. The CGeneratedFiles function is global — its arguments will be generated before any C files anywhere in the project are scanned for dependencies. The LocalCGeneratedFiles function follows the normal scoping rules of OMake. ``CGeneratedFiles`` 関数は *グローバル* です。この関数で指定したファイルは、任意の場所にある任意のCファイルの依存関係をスキャンする前に生成されます。 ``LocalCGeneratedFiles`` 関数はOMakeの通常のスコープルールに従います。 .. _label13.5.4: Cプログラムとライブラリをビルド ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. index:: single: StaticCLibrary() single: DynamicCLibrary() single: EXT_LIB single: EXT_DLL single: EXT_OBJ single: CDLL_IMPLIES_STATIC .. _label13.5.4.1: StaticCLibrary, DynamicCLibrary """"""""""""""""""""""""""""""""""""""""""""""" .. The StaticCLibrary builds a static library and the DynamicCLibrary function builds a shared library (DLL). ``StaticCLibrary`` は静的ライブラリをビルドし、 ``DynamicCLibrary`` 関数は共有ライブラリ(DLL)をビルドします。 :: StaticCLibrary(, ) DynamicCLibrary(, ) .. The does not include the library suffix, and The list does not include the object suffix. These are obtained from the EXT_LIB (EXT_DLL) and EXT_OBJ variables. ```` にライブラリの拡張子は *含めません* 。また、同様にして ```` のリストにもオブジェクトの拡張子は含めません。これらの拡張子は ``EXT_LIB`` ( ``EXT_DLL`` )や ``EXT_OBJ`` 変数によって決定されます。 .. This function returns the library filename. この関数はライブラリのファイル名を返します。 .. The following command builds the library libfoo.a from the files a.o b.o c.o on Unix, or the library libfoo.lib from the files a.obj b.obj c.obj on Win32. 以下のコマンドは ``Unix`` 上のファイル ``a.o b.o c.o`` からライブラリ ``libfoo.a`` をビルドします。あるいは、 ``Win32`` 上のファイル ``a.obj b.obj c.obj`` からライブラリ ``libfoo.lib`` をビルドします。 :: StaticCLibrary(libfoo, a b c) .DEFAULT: $(StaticCLibrary libbar, a b c d) **CDLL_IMPLIES_STATIC** .. If the CDLL_IMPLIES_STATIC variable is enabled (this is default on Win32), all the DynamicC functions would assume that creating a shared library automatically created a static one. もし ``CDLL_IMPLIES_STATIC`` 変数が真である( ``Win32`` 上でこれはデフォルトの値です)ならば、すべての ``DynamicC`` 関数は共有ライブラリを自動的に生成し、さらに静的ライブラリを生成することを保障してくれます。 .. index:: single: StaticCLibraryCopy() single: DynamicCLibraryCopy() .. _label13.5.4.2: StaticCLibraryCopy, DynamicCLibraryCopy """"""""""""""""""""""""""""""""""""""""""""""""""""" .. The StaticCLibraryCopy and DynamicCLibraryCopy functions copy a library to an install location. ``StaticCLibraryCopy`` と ``DynamicCLibraryCopy`` 関数はインストール先にライブラリをコピーします。 :: StaticCLibraryCopy(, , ) DynamicCLibraryCopy(, , ) .. The is the name of a target (typically a .PHONY target); the is the installation directory, and is the library to be copied (without the library suffix). ```` はターゲットの名前を指定します(大抵は ``.PHONY`` ターゲットです)。 ```` はインストール先のディレクトリで、 ```` はコピーするライブラリ(拡張子は除く)を指定します。 .. This function returns the filename of the library in the target directory. この関数はターゲットディレクトリ内でのライブラリのファイル名を返します。 .. For example, the following code copies the library libfoo.a to the /usr/lib directory. 例えば、以下のコードではライブラリ ``libfoo.a`` を ``/usr/lib`` ディレクトリにコピーします。 :: .PHONY: install StaticCLibraryCopy(install, /usr/lib, libfoo) .. index:: single: StaticCLibraryInstall() single: DynamicCLibraryInstall() .. _label13.5.4.3: StaticCLibraryInstall, DynamicCLibraryInstall """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. The StaticCLibraryInstall and DynamicCLibraryInstall functions build a library, and set the install location in one step. Return the filename of the library in the target directory. ``StaticCLibraryInstall`` と ``DynamicCLibraryInstall`` 関数はライブラリをビルドし、さらに出力先にインストール先を指定します。これらの関数はターゲットディレクトリ内でのライブラリのファイル名を返します。 :: StaticCLibraryInstall(, , , ) DynamicCLibraryInstall(, , , ) :: StaticCLibraryInstall(install, /usr/lib, libfoo, a b c) .. index:: single: StaticCObject() single: StaticCObjectCopy() single: StaticCObjectInstall() .. _label13.5.4.4: StaticCObject, StaticCObjectCopy, StaticCObjectInstall """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. These functions mirror the StaticCLibrary, StaticCLibraryCopy, and StaticCLibraryInstall functions, but they build an object file (a .o file on Unix, and a .obj file on Win32). これらの関数は ``StaticCLibrary`` , ``StaticCLibraryCopy`` , ``StaticCLibraryInstall`` 関数と似ていますが、これらは *オブジェクト* ファイルをビルドします( ``Unix`` では ``.o`` ファイル、 ``Win32`` では ``.obj`` ファイル)。 .. index:: single: CProgram() single: CFLAGS single: LDFLAGS single: LIBS .. _label13.5.4.5: CProgram """"""""""""""""""""""""" .. The CProgram function builds a C program from a set of object files and libraries. ``CProgram`` 関数はオブジェクトファイルやライブラリの集合からCプログラムをビルドします。 :: CProgram(, ) .. The argument specifies the name of the program to be built; the argument specifies the files to be linked. The function returns the filename of the executable. ```` にはビルドするプログラムの名前を指定します。 ```` にはリンクするファイル名を指定します。この関数は実行可能なファイル名を返します。 .. Additional options can be passed through the following variables. オプションは以下の変数を受け渡すことで指定できます。 .. Flags used by the C compiler during the link step. Flags to pass to the loader. Additional libraries to be linked. * **CFLAGS** : リンクする際にCコンパイラに受け渡すフラグ * **LDFLAGS** : ローダー(loader)に受け渡すフラグ * **LIBS** : リンクするための追加ライブラリ .. For example, the following code specifies that the program foo is to be produced by linking the files bar.o and baz.o and libraries libfoo.a. 例えば、以下のコードはプログラム ``foo`` がファイル ``bar.o`` と ``baz.o`` 、そしてライブラリ ``libfoo.a`` をリンクすることによって生成します。 :: section LIBS = libfoo LDFLAGS += -lbar CProgram(foo, bar baz) .. index:: single: CProgramCopy() .. _label13.5.4.6: CProgramCopy """""""""""""""""""""""""""""""""""""" .. The CProgramCopy function copies a file to an install location. ``CProgramCopy`` 関数はインストール先にファイルをコピーします。 :: CProgramCopy(, , ) CProgramCopy(install, /usr/bin, foo) .. index:: single: CProgramInstall() .. _label13.5.4.7: CProgramInstall """""""""""""""""""""""""""""""""""""" .. The CProgramInstall function specifies a program to build, and a location to install, simultaneously. ``CProgramInstall`` 関数は同様にプログラムをビルドし、さらに出力先にインストール先を指定します。 :: CProgramInstall(, , , ) section LIBS = libfoo LDFLAGS += -lbar CProgramInstall(install, /usr/bin, foo, bar baz) .. index:: single: CXXProgram() single: CXXProgramInstall() single: CXX single: CXXFLAGS .. _label13.5.4.8: CXXProgram, CXXProgramInstall """""""""""""""""""""""""""""""""""""""""" .. The CXXProgram and CXXProgramInstall functions are equivalent to their C counterparts, except that would use $(CXX) and $(CXXFLAGS) for linking instead of $(CC) and $(CFLAGS). ``CXXProgram`` と ``CXXProgramInstall`` 関数は ``$(CC)`` や ``$(CFLAGS)`` の代わりに ``$(CXX)`` と ``$(CXXFLAGS)`` を使う点を除いて、対応するCの関数と等価です。 .. index:: single: StaticCXXLibrary() single: StaticCXXLibraryCopy() single: StaticCXXLibraryInstall() single: DynamicCXXLibrary() single: DynamicCXXLibraryCopy() single: DynamicCXXLibraryInstall() .. _label13.5.4.9: StaticCXXLibrary, StaticCXXLibraryCopy, StaticCXXLibraryInstall, DynamicCXXLibrary, DynamicCXXLibraryCopy, DynamicCXXLibararyInstall """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. Similarly, the six CXXLibrary functions the C++ equivalents of the corresponding CLibrary functions. 同様にして、6つの ``CXXLibrary`` 関数は関連する ``CLibrary`` 関数と等価です。 .. _label13.6: OCamlコードのビルド -------------------------------------- .. OMake provides extensive support for building OCaml code, including support for tools like ocamlfind, ocamlyacc and menhir. In order to use the functions defined in this section, you need to make sure the line OMakeではOCamlコードをビルドするための、広範的なサポートを提供しています。このサポートには ``ocamlfind`` 、 ``ocamlyacc`` 、 ``menhir`` のようなツールへのサポートも含まれています。このセクションで列挙している関数を使うためには、まずあなたの ``OMakeroot`` ファイルに、以下の一行を追加してください。 :: open build/OCaml .. index:: single: OCAMLOPT_EXISTS single: OCAMLFIND_EXISTS single: OCAMLDEP_MODULES_AVAILABLE single: MENHIR_AVAILABLE .. _label13.6.1: OCamlコンパイルに用いる自動設定用の変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. These variables will get defined based on the “autoconf-style” tests executed when you run OMake for the first time. You can use them to configure your project accordingly, and you should not redefine them. これらの変数はまず最初にOMakeを実行した時点で『自動設定スタイル(autoconf-style)』が実行されて、その結果を元に決定されます。あなたのプロジェクトを調和の取れた状態にするためには、これらの変数を使用してください。また、あなたはこれらの変数を再定義すべきではありません。 .. You can use the --configure command line option (Section A.3.9) to force re-execution of all the tests. あなたは強制的にすべてのテストを実行させるために、 ``--configure`` コマンドラインオプション( :ref:`labelA.3.9` を参照)を使うことができます。 * **OCAMLOPT_EXISTS** .. True when ocamlopt (or ocamlopt.opt) is available on your machine. あなたのマシン上で ``ocamlopt`` (あるいは ``ocamlopt.opt`` )が利用可能である場合は真となります。 * **OCAMLFIND_EXISTS** .. True when the ocamlfind is available on your machines. あなたのマシン上で ``ocamlfind`` が利用可能である場合は真となります。 * **OCAMLDEP_MODULES_AVAILABLE** .. True when a version of ocamldep that understands the -modules option is available on your machine. あなたのマシン上で ``-modules`` オプションが理解できるバージョンの ``ocamldep`` が利用可能である場合は真となります。 * **MENHIR_AVAILABLE** .. True when the Menhir parser-generator is available on your machine. あなたのマシン上でMenhirパーサジェネレータが利用可能である場合は真となります。 .. index:: single: USE_OCAMLFIND single: OCAMLC single: OCAMLOPT single: CAMLP4 single: OCAMLLEX single: OCAMLLEXFLAGS single: OCAMLYACC single: OCAMLYACCFLAGS single: OCAMLDEP single: OCAMLDEP_MODULES single: OCAMLDEP_MODULES_ENABLED single: OCAMLMKTOP single: OCAMLLINK single: OCAMLOPTLINK single: OCAMLINCLUDES single: OCAMLFIND single: OCAMLFINDFLAGS single: OCAMLPACKS single: BYTE_ENABLED single: NATIVE_ENABLED single: MENHIR_ENABLED .. _label13.6.2: OCamlコンパイルに用いる設定用の変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The following variables can be redefined in your project. 以下の変数はあなたのプロジェクト上で再定義可能な変数です。 * **USE_OCAMLFIND** .. Whether to use the ocamlfind utility (default false) ``ocamlfind`` ユーティリティを利用するかどうか(デフォルトは ``false`` ) * **OCAMLC** .. The OCaml bytecode compiler (default ocamlc.opt if it exists and USE_OCAMLFIND is not set, otherwise ocamlc). OCamlバイトコードコンパイラ( ``ocamlc.opt`` が存在していてかつ ``USE_OCAMLFIND`` が設定されていない場合は ``ocamlc.opt`` 。そうでない場合は ``ocamlc`` ) * **OCAMLOPT** .. The OCaml native-code compiler (default ocamlopt.opt if it exists and USE_OCAMLFIND is not set, otherwise ocamlopt). OCamlネイティブコードコンパイラ( ``ocamlc.opt`` が存在していてかつ ``USE_OCAMLFIND`` が設定されていない場合は ``ocamlc.opt`` 。そうでない場合は ``ocamlopt`` ) * **CAMLP4** .. The camlp4 preprocessor (default camlp4). ``camlp4`` プリプロセッサ(デフォルトは ``camlp4`` ) * **OCAMLLEX** .. The OCaml lexer generator (default ocamllex). OCamlレキサジェネレータ(デフォルトは ``ocamllex`` ) * **OCAMLLEXFLAGS** .. The flags to pass to ocamllex (default -q). ``ocamllex`` に渡すフラグ(デフォルトは ``-q`` ) * **OCAMLYACC** .. The OCaml parser generator (default ocamlyacc). OCamlパーサジェネレータ(デフォルトは ``ocamlyacc`` ) * **OCAMLYACCFLAGS** .. Additional options to pass to $(OCAMLYACC). ``$(OCAMLYACC)`` に渡す追加オプション * **OCAMLDEP** .. The OCaml dependency analyzer (default ocamldep). OCaml依存関係解析器(dependency analyzer)(デフォルトは ``ocamldep`` ) * **OCAMLDEP_MODULES** .. The OCaml dependency analyzer that understands the -module option (default ocamldep, if ocamldep -modules works, or ocamlrun ocamldep-omake, if ocamlrun ocamldep-omake -modules works, and empty when neither works). ``-module`` オプションが理解できるOCaml依存解析器(デフォルトの値は ``ocamldep`` 、ただし ``ocamldep`` が ``-modules`` で動いた場合のみ。 ``ocamlrun ocamldep-omake -module`` が動く場合は ``ocamlrun ocamldep-omake`` が使われる。どちらでもない場合は空となる) * **OCAMLDEP_MODULES_ENABLED** .. Instead of using OCAMLDEP in a traditional make-style fashion, run $(OCAMLDEP_MODULES) -modules and then postprocess the output internally to discover all the relevant generated .ml and .mli files. See Section 13.6.5 for more information on interactions between OMake, OCAMLDEP and generated files. Set to $(OCAMLDEP_MODULES_AVAILABLE) by default. 従来の伝統的な ``make -style`` の形で ``OCAMLDEP`` を使う代わりに ``$(OCAMLDEP_MODULES) -modules`` を実行させて、 関連しているすべての ``.ml`` と ``.mli`` ファイルを探しだし、その出力を内部で後処理します。OMakeと、 ``OCAMLDEP`` や生成されたファイルの相互間の動作に関して、より詳しく知りたい方は ":ref:`label13.6.5`" を参照してください。 * **OCAMLMKTOP** .. The OCaml toploop compiler (default ocamlmktop). OCamlトップループコンパイラ(デフォルトは ``ocamlmktop`` ) * **OCAMLLINK** .. The OCaml bytecode linker (default $(OCAMLC)). OCamlバイトコードリンカ(デフォルトは ``$(OCAMLC)`` ) * **OCAMLOPTLINK** .. The OCaml native-code linker (default $(OCAMLOPT)). OCamlネイティブコードリンカ(デフォルトは ``$(OCAMLOPT)`` ) * **OCAMLINCLUDES** .. Search path to pass to the OCaml compilers (default .). The search path with the -I prefix is defined by the PREFIXED_OCAMLINCLUDES variable. OCamlコンパイラに受け渡す検索パス(デフォルトは ``.`` )。 ``-I`` 接頭辞を加えた検索パスについては、 ``PREFIXED_OCAMLINCLUDES`` 変数で定義されています。 * **OCAMLFIND** .. The ocamlfind utility (default ocamlfind if USE_OCAMLFIND is set, otherwise empty). ``ocamlfind`` ユーティリティ( ``USE_OCAMLFIND`` が設定されている場合は ``ocamlfind`` 。そうでない場合は空文字) * **OCAMLFINDFLAGS** .. The flags to pass to ocamlfind (default empty, USE_OCAMLFIND must be set). ``ocamlfind`` に渡すフラグ(デフォルトは空文字で、 ``USE_OCAMLFIND`` が設定されていなければならない) * **OCAMLPACKS** .. Package names to pass to ocamlfind (USE_OCAMLFIND must be set). ``ocamlfind`` に渡すパッケージ名( ``USE_OCAMLFIND`` が設定されていなければならない) * **BYTE_ENABLED** .. Flag indicating whether to use the bytecode compiler (default true, when no ocamlopt found, false otherwise). バイトコードコンパイラを使用するかどうかを示すフラグ( ``ocamlopt`` が見つからない場合は ``true`` 。そうでない場合は ``false`` ) * **NATIVE_ENABLED** .. Flag indicating whether to use the native-code compiler (default true, when ocamlopt is found, false otherwise). Both BYTE_ENABLED and NATIVE_ENABLED can be set to true; at least one should be set to true. ネイティブコードコンパイラを使用するかどうかを示すフラグ( ``ocamlopt`` が見つかる場合は ``true`` 。そうでない場合は ``false`` )。 ``BYTE_ENABLED`` と ``NATIVE_ENABLED`` の両方はどちらとも真にすることができます。また、最低でも一つの変数は真であるべきです。 * **MENHIR_ENABLED** .. Define this as true if you wish to use menhir instead of ocamlyacc (default false). ``ocamlyacc`` の代わりに ``menhir`` を使いたい場合は ``true`` に設定してください(デフォルトは ``false`` )。 .. index:: single: OCAMLDEPFLAGS single: OCAMLPPFLAGS single: OCAMLCFLAGS single: OCAMLOPTFLAGS single: OCAMLFLAGS single: OCAML_BYTE_LINK_FLAGS single: OCAML_NATIVE_LINK_FLAGS single: OCAML_LINK_FLAGS single: MENHIR_FLAGS .. _label13.6.3: OCamlコマンドフラグ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The following variables specify additional options to be passed to the OCaml tools. 以下の変数はOCamlのツールに渡す *追加* オプションを示しています。 * **OCAMLDEPFLAGS** .. Flags to pass to OCAMLDEP and OCAMLDEP_MODULES. ``OCAMLDEP`` と ``OCAMLDEP_MODULES`` に渡すフラグ * **OCAMLPPFLAGS** .. Flags to pass to CAMLP4. ``CAMLP4`` に渡すフラグ * **OCAMLCFLAGS** .. Flags to pass to the byte-code compiler (default -g). バイトコードコンパイラに渡すフラグ(デフォルトは ``-g`` ) * **OCAMLOPTFLAGS** .. Flags to pass to the native-code compiler (default empty). ネイティブコードコンパイラに渡すフラグ(デフォルトは空) * **OCAMLFLAGS** .. Flags to pass to either compiler (default -warn-error A). 両方のコンパイラに渡すフラグ(デフォルトは ``-warn-error A`` ) * **OCAML_BYTE_LINK_FLAGS** .. Flags to pass to the byte-code linker (default empty). バイトコードリンカに渡すフラグ(デフォルトは空) * **OCAML_NATIVE_LINK_FLAGS** .. Flags to pass to the native-code linker (default empty). ネイティブコードリンカに渡すフラグ(デフォルトは空) * **OCAML_LINK_FLAGS** .. Flags to pass to either linker. 両方のリンカに渡すフラグ * **MENHIR_FLAGS** .. Additional flags to pass to menhir. ``menhir`` に渡す追加フラグ .. index:: single: OCAML_LIBS single: OCAML_OTHER_LIBS single: OCAML_CLIBS single: OCAML_LIB_FLAGS single: ABORT_ON_DEPENDENCY_ERRORS .. _label13.6.4: ライブラリ変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The following variables are used during linking. 以下の変数がリンクの際に用いられます。 * **OCAML_LIBS** .. Libraries to pass to the linker. These libraries become dependencies of the link step. リンカに渡すライブラリ。これらのライブラリはリンク作業時に依存先となります。 * **OCAML_OTHER_LIBS** .. Additional libraries to pass to the linker. These libraries are not included as dependencies to the link step. Typical use is for the OCaml standard libraries like unix or str. リンカに渡す追加ライブラリ。これらのライブラリはリンク作業時に依存先には *含まれません* 。一般的な使用方法としては、OCamlの ``unix`` や ``str`` のような標準ライブラリに用いられます。 * **OCAML_CLIBS** .. C libraries to pass to the linker. リンカに渡すCライブラリ * **OCAML_LIB_FLAGS** .. Extra flags for the library linker. ライブラリリンカに渡すその他のフラグ * **ABORT_ON_DEPENDENCY_ERRORS** .. OCaml linker requires the OCaml files to be listed in dependency order. Normally, all the functions presented in this section will automatically sort the list of OCaml modules passed in as the argument. However, this variable is set to true, the order of the files passed into these function will be left as is, but OMake will abort with an error message if the order is illegal. OCamlのリンカは依存する順番でリストされたOCamlのファイルを必要としています。通常、このセクションにあるすべての関数は ```` 引数として渡したOCamlのモジュールリストを自動的にソートします。しかし、この変数が ``true`` に設定してある場合、これらの関数に受け渡されたファイルの順番はそのままになります。また、OMakeはこの順番が正しくなかったとしても、生じたエラーメッセージを無視します。 .. _label13.6.5: OCamlファイルを生成 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. As of OCaml version 3.09.2, the standard ocamldep scanner is “broken”. The main issue is that it finds only those dependencies that already exist. If foo.ml contains a dependency on Bar, OCaml バージョン 3.09.2に関しては、標準の ``ocamldep`` スキャナは『壊れています』。これに関しての主な問題は、既に存在している依存関係しか検索しないという点です。例えば、 ``foo.ml`` が ``Bar`` に依存しているものとしましょう。 :: foo.ml: open Bar .. then the default ocamldep will only find the dependency if a file bar.ml or bar.ml exists in the include path. It will not find (or print) the dependency if, for example, only bar.mly exists at the time ocamldep is run, even though bar.ml and bar.mli can be generated from bar.mly. この場合、ファイル ``bar.ml`` あるいはインクルードパス上の ``bar.ml`` が存在しているときには、デフォルトの ``ocamldep`` はそのファイルの依存関係しか調べません。つまり、もし ``ocamldep`` を実行した時点では ``bar.mly`` しか存在しなかったとしたら、たとえ ``bar.ml`` と ``bar.mli`` が ``bar.mly`` から生成されたとしても、これらの依存関係は調べない(あるいは出力しない)のです。 .. OMake currently provides two methods for addressing this problem — one that requires manually specifying the generated files, and an experimental method for discovering such “hidden” dependencies automatically. The OCAMLDEP_MODULES_ENABLED variable controls which method is going to be used. When this variable is false, the manual specifications are expected and when it is true, the automated discovery will be attempted. 現状のOMakeでは、この問題を解決するための2つの方法を提供しています。一つは生成されるファイルを手動で指定してあげることです。二つめは実験的な方法ですが、自動的に『隠れた』依存関係を調査することです。 ``OCAMLDEP_MODULES_ENABLED`` 変数はどちらの方法を使うのか、制御する変数です。この変数が偽であるときには、手動で指定するという方法が期待されます。また、真であるときには、自動的な調査を試みます。 .. index:: single: OCamlGeneratedFiles() single: LocalOCamlGeneratedFiles() .. _label13.6.5.1: OCamlGeneratedFiles, LocalOCamlGeneratedFiles """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" :: OCamlGeneratedFiles(files) LocalOCamlGeneratedFiles(files) .. When the OCAMLDEP_MODULES_ENABLED variable variable is set to false, the OCamlGeneratedFiles and LocalOCamlGeneratedFiles functions specify files that need to be generated before any OCaml files are scanned for dependencies. For example, if parser.ml and lexer.ml are both generated files, specify: ``OCAMLDEP_MODULES_ENABLED`` 変数が ``false`` に設定してある場合、 ``OCamlGeneratedFiles`` と ``LocalOCamlGeneratedFiles`` 関数は任意のOCamlファイルが依存関係をスキャンする前に、生成される必要のあるファイルを指定します。例えば、 ``parser.ml`` と ``lexer.ml`` の両方が生成されるファイルであった場合、以下のように指定します。 :: OCamlGeneratedFiles(parser.ml lexer.ml) .. The OCamlGeneratedFiles function is global — its arguments will be generated before any OCaml files anywhere in the project are scanned for dependencies. The LocalOCamlGeneratedFiles function follows the normal scoping rules of OMake. ``OCamlGeneratedFiles`` 関数は *グローバル* です。この関数の引数は、プロジェクト上の任意の場所にある任意のOCamlファイルの依存関係をスキャンする前に生成されます。 ``LocalOCamlGeneratedFiles`` 関数はOMakeの通常のスコープルールに従います。 .. These functions have no effect when the OCAMLDEP_MODULES_ENABLED variable is true. これらの関数は ``OCAMLDEP_MODULES_ENABLED`` 変数が真であるときにはなんの影響も与えません。 .. _label13.6.5.2: 依存関係の解析中に生成されるファイルを自動的に調査 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. Having to specify the generated files manualy when OMake could discover them automatically is obviously suboptimal. To address this, we tell ocamldep to only find the free module names in a file and then post-process the results internally. OMakeが自動的に調査してくれるときに、いちいち手動で生成されるファイルを指定してあげるのは明らかに最適とは言えません。まずこれについて話すために、ファイルの自由なモジュール名 *のみ* を探しだす ``ocamldep`` について話し、その後内部でその結果を後処理することを伝えました。 .. This automated functionality is enabled when the OCAMLDEP_MODULES_ENABLED variable is set to true. By default, OCAMLDEP_MODULES_ENABLED variable will be set to $(OCAMLDEP_MODULES_AVAILABLE). この自動的な機構は ``OCAMLDEP_MODULES_ENABLED`` 変数が ``true`` に設定されているときに許可されます。通常、 ``OCAMLDEP_MODULES_ENABLED`` 変数は ``$(OCAMLDEP_MODULES_AVAILABLE)`` に設定されています。 .. Note that the ocamldep functionality this relies upon is only included in the OCaml version 3.10 and higher. Temporarily, we distribute a bytecode version ocamldep-omake of the appropriately modified ocamldep. The appropriate ocamldep will be discovered automatically — see and the OCAMLDEP_MODULES_AVAILABLE and OCAMLDEP_MODULES variables will be set accordingly. この処理に依存している ``ocamldep`` の機構はバージョン3.10のOCamlかそれ以降のみに含まれています。一時的に、私たちは ``ocamldep`` を似せて修正したバイトコードバージョンの ``ocamldep-omake`` を用意しました。この似せて作った ``ocamldep`` は自動的に依存関係を調査してくれます。詳細は ``OCAMLDEP_MODULES_AVAILABLE`` と ``OCAMLDEP_MODULES`` 変数の項を参照し、さらにこれらの変数を正しく設定し、利用してください。 .. index:: single: Menhir .. _label13.6.6: Menhirパーサジェネレータを使用 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. Menhir is a parser generator that is mostly compatible with ocamlyacc, but with many improvements. A few of these are listed here (excerpted from the Menhir home page http://cristal.inria.fr/~fpottier/menhir/). Menhirは ``ocamlyacc`` とほとんど互換性がとれており、かつ様々な改良がなされているパーサジェネレータです。機能の一部を以下にリストします(さらに知りたい方はMenhirのホームページ http://cristal.inria.fr/~fpottier/menhir/ を参照してください)。 .. Menhir's explanations are believed to be understandable by mere humans. Menhir allows grammar specifications to be split over multiple files. It also allows several grammars to share a single set of tokens. Menhir is able to produce parsers that are parameterized by Objective Caml modules. Added by jyh With the --infer option, Menhir can typecheck the semantic actions in your grammar at generation time. * Menhirの解釈(explanations)は、多くの人間が分かりやすくなるように改良されています。 * Menhirは複数のファイルにわたって文法を記述できます。これはまた、トークンの集合を複数のgrammerが共有できることを意味しています。 * MenhirはObjective Camlモジュールによって記述されたパーサを提供することができます。 * jyhによって ``-infer`` オプションが追加されました。これによって、Menhirは生成時にあなたの文法における意味動作(semantic actions)をチェック(typecheck)することができます。 .. note:: 訳注: 見ての通り、訳が安定していません。すいませんがあまり信用しないでください .. What do you need to do to use Menhir instead of ocamlyacc? どのようにして ``ocamlyacc`` の代わりにMenhirを使用できるのでしょうか? .. Place the following definition before the relevant section of your project (or at the top of your project OMakefile if you want to use Menhir everywhere). 1. あなたのプロジェクトの適切な位置(Menhirをどこでも使いたいのならプロジェクトトップの ``OMakefile`` )に、以下の定義を追加してください。 :: MENHIR_ENABLED = true .. Optionally, add any desired Menhir options to the MENHIR_FLAGS variable. 2. 必要ならば、Menhirに追加させたいオプションを ``MENHIR_FLAGS`` に追加してください。 :: MENHIR_FLAGS += --infer .. With this setup, any file with a .mly suffix will be compiled with Menhir. このセットアップによって、任意の ``.mly`` 拡張子のファイルはMenhirでコンパイルされます。 .. If your grammar is split across several files, you need to specify it explicitly, using the MenhirMulti function. もしあなたの文法(grammar)がいくつかのファイルにわたって分割されているのなら、あなたは ``MenhirMulti`` 関数を用いて、そのことを明示的に指定してあげる必要があります。 :: MenhirMulti(target, sources) target : 拡張子を除いたファイル名 sources : 拡張子を除いた、文法を定義しているファイル群 .. For example, if you want to generate the parser files parse.ml and parse.mli, from the grammar specified in files a.mly and b.mly, you would use the following. 例えば、文法を指定しているファイル ``a.mly`` と ``b.mly`` からパーサファイル ``parse.ml`` と ``parse.mli`` を生成したい場合は、以下のように記述します。 :: MenhirMulti(parse, a b) .. index:: single: OCamlLibrary() .. _label13.6.6.1: OCamlLibrary """""""""""""""""""""""""""""""""""""" .. The OCamlLibrary function builds an OCaml library. ``OCamlLibrary`` 関数はOCamlライブラリをビルドします。 :: OCamlLibrary(, ) .. The and are listed without suffixes. ```` と ```` は拡張子を *付けないで* 指定してください。 .. This function returns the list of all the targets that it defines the rules for (including the $(name)$(EXT_LIB) file when NATIVE_ENABLED is set). この関数はルールを定義しているすべてのターゲットのリスト( ``NATIVE_ENABLED`` が設定されているときは ``$(name)$(EXT_LIB)`` を含む)を返します。 .. The following code builds the libfoo.cmxa library from the files foo.cmx and bar.cmx (if NATIVE_ENABLED is set), and libfoo.cma from foo.cmo and bar.cmo (if BYTE_ENABLED is set). 以下のコードは( ``NATIVE_ENABLED`` が設定されている場合は) ``foo.cmx`` と ``bar.cmx`` から ``libfoo.cmxa`` ライブラリをビルドし、( ``BYTE_ENABLED`` が設定されている場合は) ``foo.cmo`` と ``bar.cmo`` から ``libfoo.cma`` をビルドします。 :: OCamlLibrary(libfoo, foo bar) .. index:: single: OCamlPackage() .. _label13.6.6.2: OCamlPackage """""""""""""""""""""""""""""""""""""" .. The OCamlPackage function builds an OCaml package. ``OCamlPackage`` 関数はOCamlパッケージをビルドします。 :: OCamlPackage(, ) .. The and are listed without suffixes. The must have been compiled with the -for-pack flag to the OCaml compiler. ```` と ```` は拡張子を *付けないで* 指定してください。 ```` はOCamlコンパイラに ``-for-pack `` フラグを加えた状態でコンパイルされます。 .. This function returns the list of all the targets that it defines the rules for (including the $(name)$(EXT_LIB) file when NATIVE_ENABLED is set). この関数はルールを定義しているすべてのターゲットのリスト( ``NATIVE_ENABLED`` が設定されているときは ``$(name)$(EXT_LIB)`` を含む)を返します。 .. The following code builds the libfoo.cmx package from the files package.cmx and bar.cmx (if NATIVE_ENABLED is set), and package.cmo from foo.cmo and bar.cmo (if BYTE_ENABLED is set). 以下のコードは( ``NATIVE_ENABLED`` が設定されている場合は) ``foo.cmx`` と ``bar.cmx`` から ``package.cmx`` パッケージをビルドし、( ``BYTE_ENABLED`` が設定されている場合は) ``foo.cmo`` と ``bar.cmo`` から ``package.cmo`` をビルドします。 :: OCamlPackage(package, foo bar) .. index:: single: OCamlLibraryCopy() .. _label13.6.6.3: OCamlLibraryCopy """""""""""""""""""""""""""""""""""""" .. The OCamlLibraryCopy function copies a library to an install location. ``OCamlLibraryCopy`` 関数はライブラリをインストール先にコピーします。 :: OCamlLibraryCopy(, , , ) .. The specify additional interface files to be copied if the INSTALL_INTERFACES variable is true. ```` では ``INSTALL_INTERFACES`` 変数が真である場合にコピーする、追加のインターフェイスファイルを指定します。 .. index:: single: OCamlLibraryInstall() .. _label13.6.6.4: OCamlLibraryInstall """""""""""""""""""""""""""""""""""""" .. The OCamlLibraryInstall function builds a library and copies it to an install location in one step. ``OCamlLibraryInstall`` 関数はライブラリをビルドし、加えてインストール先にコピーします。 :: OCamlLibraryInstall(, , , ) .. index:: single: OCamlProgram() single: OCAML_LIBS single: OCAML_OTHER_LIBS single: OCAML_CLIBS single: OCAML_BYTE_LINK_FLAGS single: OCAML_NATIVE_LINK_FLAGS single: OCAMLE_LINK_FLAGS .. _label13.6.6.5: OCamlProgram """""""""""""""""""""""""""""""""""""" .. The OCamlProgram function builds an OCaml program. It returns the array with all the targets for which it has defined the rules ($(name)$(EXE) and $(name).run and/or $(name).opt, depending on the NATIVE_ENABLED and BYTE_ENABLED variables). ``OCamlProgram`` 関数はOCamlプログラムをビルドします。この関数はルールを定義している、すべてのターゲットの配列を返します( ``$(name)$(EXE)`` , ``$(name).run`` ``$(name).opt`` は ``NATIVE_ENABLED`` と ``BYTE_ENABLED`` 変数の値に依存しています)。 :: OCamlProgram(, ) .. Additional variables used: 以下の変数が利用されます。 * **OCAML_LIBS** .. Additional libraries passed to the linker, without suffix. These files become dependencies of the target program. リンカに渡す追加ライブラリ(拡張子を除く)。これらのファイルは対象のプログラムの依存先となります。 * **OCAML_OTHER_LIBS** .. Additional libraries passed to the linker, without suffix. These files do not become dependencies of the target program. リンカに渡す追加ライブラリ(拡張子を除く)。これらのファイルは対象のプログラムの依存先に *なりません* 。 * **OCAML_CLIBS** .. C libraries to pass to the linker. リンカに渡すCライブラリ * **OCAML_BYTE_LINK_FLAGS** .. Flags to pass to the bytecode linker. バイトコードリンカに渡すフラグ * **OCAML_NATIVE_LINK_FLAGS** .. Flags to pass to the native code linker. ネイティブコードリンカに渡すフラグ * **OCAML_LINK_FLAGS** .. Flags to pass to both linkers. 両方のリンカに渡すフラグ .. index:: single: OCamlProgramCopy() single: NATIVE_ENABLED .. _label13.6.6.6: OCamlProgramCopy """""""""""""""""""""""""""""""""""""" .. The OCamlProgramCopy function copies an OCaml program to an install location. ``OCamlProgramInstall`` 関数はOCamlプログラムをインストール先にコピーします。 :: OCamlProgramCopy(, , ) .. Additional variables used: 以下の変数が利用されます。 * **NATIVE_ENABLED** .. If the NATIVE_ENABLED variable is set, the native-code executable is copied; otherwise the byte-code executable is copied. ``NATIVE_ENABLED`` 変数が設定されている場合、ネイティブコードの実行形式がコピーされます。そうでない場合はバイトコードの実行形式がコピーされます。 .. index:: single: OCamlProgramInstall() .. _label13.6.6.7: OCamlProgramInstall """""""""""""""""""""""""""""""""""""" .. The OCamlProgramInstall function builds a programs and copies it to an install location in one step. ``OCamlProgramInstall`` 関数はプログラムをビルドし、加えてインストール先にコピーします。 :: OCamlProgramInstall(, , , ) .. _label13.7: LaTeXファイルのビルド -------------------------------------- .. OMake provides support for building LATEX documents, including support for automatically running BiBTex and for producing PostScript and PDF files. In order to use the functions defined in this section, you need to make sure the line is present in your OMakeroot file. OMakeではLaTeXドキュメントのビルドをサポートします。このサポートには自動的にBiBTexを実行させ、PostScriptやPDFファイルを生成するためのサポートも含まれます。このセクションで列挙している関数を使うためには、まずあなたの ``OMakeroot`` ファイルに、以下の一行を追加してください。 :: open build/LaTeX .. index:: single: LATEX single: TETEX2_ENABLED single: LATEXFLAGS single: BIBTEX single: MAKEINDEX single: DVIPS single: DVIPSFLAGS single: DVIPDFM single: DVIPDFMFLAGS single: PDFLATEX single: PDFLATEXFLAGS single: USEPDFLATEX .. _label13.7.1: 設定用の変数 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. The following variables can be modified in your project. 以下の変数があなたのプロジェクト上で編集できます。 * **LATEX** .. The LATEX command (default latex). LaTeXコマンド(デフォルトは ``latex`` ) * **TETEX2_ENABLED** .. Flag indicating whether to use advanced LATEX options present in TeTeX v.2 (default value is determined the first time omake reads LaTeX.src and depends on the version of LATEX you have installed). TeTeX v.2にある、発展的なLaTeXオプションを利用するかどうかを示すフラグです(デフォルトの値は最初にomakeが ``LaTeX.src`` を読み込むことで決定されて、さらにインストールしてあるLaTeXのバージョンに依存します)。 * **LATEXFLAGS** .. The LATEX flags (defaults depend on the TETEX2_ENABLED variable) LaTexのフラグ(デフォルトの値は ``TETEX2_ENABLED`` 変数に依存する) * **BIBTEX** .. The BibTeX command (default bibtex). BibTeXコマンド(デフォルトは ``bibtex`` ) * **MAKEINDEX** .. The command to build an index (default makeindex). 索引をビルドするコマンド(デフォルトは ``makeindex`` ) * **DVIPS** .. The .dvi to PostScript converter (default dvips). ``.dvi`` からPostScriptに変換するコンバータ(デフォルトは ``dvips`` ) * **DVIPSFLAGS** .. Flags to pass to dvips (default -t letter). ``dvips`` に渡すフラグ(デフォルトは ``-t letter`` ) * **DVIPDFM** .. The .dvi to .pdf converter (default dvipdfm). ``.dvi`` から ``.pdf`` に変換するコンバータ(デフォルトは ``dvipdfm`` ) * **DVIPDFMFLAGS** .. Flags to pass to dvipdfm (default -p letter). ``dvipdfm`` に渡すフラグ(デフォルトは ``-p letter`` ) * **PDFLATEX** .. The .latex to .pdf converter (default pdflatex). ``.latex`` から ``.pdf`` に変換するコンバータ(デフォルトは ``pdflatex`` ) * **PDFLATEXFLAGS** .. Flags to pass to pdflatex (default is $`(LATEXFLAGS)). ``pdflatex`` に渡すフラグ(デフォルトは ``$`(LATEXFLAGS)`` ) * **USEPDFLATEX** .. Flag indicating whether to use pdflatex instead of dvipdfm to generate the .pdf document (default false). ``.pdf`` ドキュメントを生成するのにdvipdfmではなくpdflatexを使うかどうかを示すフラグ(デフォルトは ``false`` ) .. _label13.7.2: LaTeXドキュメントのビルド ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. index:: single: LaTeXDocument() single: TEXINPUTS single: TEXDEPS single: TEXVARS .. _label13.7.2.1: LaTeXDocument """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. The LaTeXDocument produces a LATEX document. ``LaTeXDocument`` 関数はLaTeXドキュメントを生成します。 :: LaTeXDocument(, ) .. The document and are listed without suffixes. This function returns the filenames for the generated .ps and .pdf files. ```` と ```` には拡張子を *付けないで* 指定してください。この関数は生成された ``.ps`` と ``.pdf`` ファイルのファイル名を返します。 .. Additional variables used: 以下の変数が利用されます。 * **TEXINPUTS** .. The LATEX search path (an array of directories, default is taken from the TEXINPUTS environment variable). LaTeXの検索パス(ディレクトリの配列で、デフォルトは ``TEXINPUTS`` 環境変数から取得される) * **TEXDEPS** .. Additional files this document depends on. このドキュメントに依存している追加ファイル * **TEXVARS** .. An array of names of the environment variables that are to be updated based on the value of OMake's TEXINPUTS variable. Defaults to TEXINPUTS BIBINPUTS BSTINPUTS. OMakeの ``TEXINPUTS`` 変数の値に基づいてアップデートすることになっている、環境変数の名前の配列。デフォルトは ``TEXINPUTS BIBINPUTS BSTINPUTS`` 。 .. index:: single: TeXGeneratedFiles() single: LocalTeXGeneratedFiles() .. _label13.7.2.2: TeXGeneratedFiles, LocalTeXGeneratedFiles """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" :: TeXGeneratedFiles(files) LocalTeXGeneratedFiles(files) .. The TeXGeneratedFiles and LocalTeXGeneratedFiles functions specify files that need to be generated before any LATEXfiles are scanned for dependencies. For example, if config.tex and inputs.tex are both generated files, specify: ``TeXGeneratedFiles`` と ``LocalTeXGeneratedFiles`` 関数は任意のLaTeXファイルの依存関係をスキャンする前に生成される必要のあるファイルを指定します。例えば、 ``config.tex`` と ``inputs.tex`` が両方とも生成されるファイルであった場合、以下のように指定します。 :: TeXGeneratedFiles(config.tex inputs.tex) .. The TeXGeneratedFiles function is global — its arguments will be generated before any TeX files anywhere in the project are scanned for dependencies. The LocalTeXGeneratedFiles function follows the normal scoping rules of OMake. ``TeXGeneratedFiles`` 関数は *グローバル* です。この関数で指定したファイルは、任意の場所にある任意のTeXファイルの依存関係をスキャンする前に生成されます。 ``LocalTeXGeneratedFiles`` 関数はOMakeの通常のスコープルールに従います。 .. index:: single: LaTeXDocumentCopy() .. _label13.7.2.3: LaTeXDocumentCopy """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. The LaTeXDocumentCopy copies the document to an install location. ``LaTeXDocumentCopy`` 関数はインストール先にドキュメントをコピーします。 :: LaTeXDocumentCopy(, , , ) .. This function copies just the .pdf and .ps files. この関数は ``.pdf`` と ``.ps`` ファイルだけコピーします。 .. index:: single: LaTeXDocumentInstall() .. _label13.7.2.4: LaTeXDocumentInstall """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .. The LaTeXDocumentInstall builds a document and copies it to an install location in one step. ``LaTeXDocumentInstall`` 関数はドキュメントをビルドし、加えてインストール先にドキュメントをコピーします。 :: LaTeXDocumentInstall(, , , , )