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.
For example, the following code displays the progress bar unless the VERBOSE environment variable is defined.
if $(not $(defined-env VERBOSE)) OMakeFlags(-S --progress) export
OMakeVersion(version1) OMakeVersion(version1, version2) version1, version2 : String
The OMakeVersion function is used for version checking in OMakefiles. It takes one or two arguments.
In the one argument form, if the omake version number is less than <version1>, then an exception is raised. In the two argument form, the version must lie between version1 and version2.
$(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.
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.
The standard OMakeroot file defines the functions are rules for building standard projects.
omake provides extensive support for building C programs.
The following variables can be redefined in your project.
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(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.
The StaticCLibrary builds a static library.
StaticCLibrary(<target>, <files>)
The <target> does not include the library suffix, and The <files> list does not include the object suffix. These are obtained from the EXT_LIB and EXT_OBJ variables.
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.
StaticCLibrary(libfoo, a b c) .DEFAULT: $(StaticCLibrary libbar, a b c d)
The StaticCLibraryCopy function copies the static library to an install location.
StaticCLibraryCopy(<tag>, <dir>, <lib>)
The <tag> is the name of a target (typically a .PHONY target); the <dir> is the installation directory, and <lib> is the library to be copied (without the library suffix).
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.
.PHONY: install StaticCLibraryCopy(install, /usr/lib, libfoo)
The StaticCLibraryInstall function builds a library, and sets the install location in one step. It returns the filename of the library in the target directory.
StaticCLibraryInstall(<tag>, <dir>, <libname>, <files>)
StaticCLibraryInstall(install, /usr/lib, libfoo, a b c)
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).
The CProgram function builds a C program from a set of object files and libraries.
CProgram(<name>, <files>)
The <name> argument specifies the name of the program to be built; the <files> argument specifies the files to be linked. The function returns the filename of the executable.
Additional options can be passed through the following variables.
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.
section LIBS = libfoo$(EXT_LIB) CProgram(foo, bar baz)
The CProgramCopy function copies a file to an install location.
CProgramCopy(<tag>, <dir>, <program>)
CProgramCopy(install, /usr/bin, foo)
The CProgramInstall function specifies a program to build, and a location to install, simultaneously.
CProgramInstall(<tag>, <dir>, <name>, <files>)
section LIBS = libfoo$(EXT_LIB) CProgramInstall(install, /usr/bin, foo, bar baz)
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).
The following variables can be redefined in your project.
The following variables specify additional options to be passed to the OCaml tools.
The following variables are used during linking.
OCamlGeneratedFiles(files) LocalOCamlGeneratedFiles(files)
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:
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.
The OCamlLibrary function builds an OCaml library.
OCamlLibrary(<libname>, <files>)
The <libname> and <files> are listed without suffixes.
Additional variables used by the function:
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).
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).
OCamlLibrary(libfoo, foo bar)
The OCamlLibraryCopy function copies a library to an install location.
OCamlLibraryCopy(<tag>, <libdir>, <libname>, <interface-files>)
The <interface-files> specify additional interface files to be copied if the INSTALL_INTERFACES variable is true.
The OCamlLibraryInstall function builds a library and copies it to an install location in one step.
OCamlLibraryInstall(<tag>, <libdir>, <libname>, <files>)
The OCamlProgram function builds an OCaml program. It returns the array with all the targets for which it have defined the rules ($(name)$(EXE) and $(name).run and/or $(name).opt, depending on the NATIVE_ENABLED and BYTE_ENABLED variables).
OCamlProgram(<name>, <files>)
Additional variables used:
The OCamlProgramCopy function copies an OCaml program to an install location.
OCamlProgramCopy(<tag>, <bindir>, <name>)
Additional variables used:
The OCamlProgramInstall function builds a programs and copies it to an install location in one step.
OCamlProgramInstall(<tag>, <bindir>, <name>, <files>)
The following variables can be modified in your project.
The LaTeXDocument produces a LaTeX document.
LaTeXDocument(<name>, <texfiles>)
The document <name> and <texfiles> are listed without suffixes. This function returns the filenames for the generated .ps and .pdf files.
Additional variables used:
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(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.
The LaTeXDocumentCopy copies the document to an install location.
LaTeXDocumentCopy(<tag>, <libdir>, <installname>, <docname>)
This function copies just the .pdf and .ps files.
The LaTeXDocumentInstall builds a document and copies it to an install location in one step.
LaTeXDocumentInstall(<tag>, <libdir>, <installname>, <docname>, <files>)
$(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.
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.
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.
In all three functions, files that are not part of the current project are silently discarded.
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. For a shorter form, see the filter-proper-targets function.
.PHONY: clean APP = ... # the name of the target application clean: $(APP) rm $(dependencies-proper $(APP))
$(target targets) : Rule 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.
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(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.
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.
rule(false, target, pattern, sources, [[:name1:, option1], [:name2:, option2]] [expr1; expr2])
omake(1), omake-quickstart(1), omake-options(1), omake-root(1), omake-language(1), omake-shell(1), omake-rules(1), omake-base(1), omake-system(1), omake-pervasives(1), osh(1), make(1)
Version: 0.9.6.9 of April 11, 2006.
©2003-2006, Mojave Group, Caltech
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Jason Hickey et. al.
Caltech 256-80
Pasadena, CA 91125, USA
Email: omake-devel@metaprl.org
WWW: http://www.cs.caltech.edu/~jyh