Source

camlspotter.bitbucket.org / omy / OMyMakefile.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>OMyMakefile &mdash; OMyMakefile v1.0.0 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '#',
        VERSION:     '1.0.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="OMyMakefile v1.0.0 documentation" href="index.html" />
    <link rel="next" title="OMyTar" href="OMyTar.html" />
    <link rel="prev" title="OMyExternal" href="OMyExternal.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="OMyTar.html" title="OMyTar"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="OMyExternal.html" title="OMyExternal"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">OMyMakefile v1.0.0 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="omymakefile">
<h1>OMyMakefile<a class="headerlink" href="#omymakefile" title="Permalink to this headline"></a></h1>
<p>Useful functions to build OCaml projects</p>
<div class="section" id="directories">
<h2>Directories<a class="headerlink" href="#directories" title="Permalink to this headline"></a></h2>
<p id="index-5"><strong>BIG_ROOT</strong></p>
<blockquote>
<div class="highlight-python"><pre>= $(dir .)</pre>
</div>
<p>The build root directory</p>
</blockquote>
<p id="index-6"><strong>PREFIX</strong></p>
<blockquote>
<div class="highlight-python"><pre>= $(getenv PREFIX)</pre>
</div>
<p>The prefix. Equal to the PREFIX environment variable</p>
</blockquote>
</div>
<div class="section" id="installation-mark-files">
<h2>Installation mark files<a class="headerlink" href="#installation-mark-files" title="Permalink to this headline"></a></h2>
<p id="index-7"><strong>INSTALLED</strong></p>
<blockquote>
<div class="highlight-python"><pre>= $(BIG_ROOT)/installed</pre>
</div>
<p>Installation mark files are put inside this directory.</p>
</blockquote>
<p id="index-8"><strong>Installed(packs)</strong></p>
<blockquote>
Returns the installation mark files of $(packs)</blockquote>
<p id="index-9"><strong>CreateInstalled(pack, targets)</strong></p>
<blockquote>
Create $(Installed $(pack)) file from the digests of $(targets)</blockquote>
</div>
<div class="section" id="misc-tools">
<h2>Misc tools<a class="headerlink" href="#misc-tools" title="Permalink to this headline"></a></h2>
<p id="index-10"><strong>mkdir_if_not_exists(dir)</strong></p>
<blockquote>
ditto.</blockquote>
</div>
<div class="section" id="ocamlfind">
<h2>OCamlFind<a class="headerlink" href="#ocamlfind" title="Permalink to this headline"></a></h2>
<p id="index-11"><strong>USE_OCAMLFIND</strong></p>
<blockquote>
<div class="highlight-python"><pre>=  true</pre>
</div>
<p>OMy requires OCamlFind! Do not ask me how to use OMy without OCamlFind. Please.</p>
</blockquote>
<p id="index-12"><strong>OCAML_PREINSTALLED_PACKS[]</strong></p>
<blockquote>
<div class="highlight-python"><pre>=  bigarray camlp4 dbm dynlink graphics num num-top stdlib str threads unix findlib</pre>
</div>
<p>Preinstalled libraries which are always available for normal ocaml.</p>
<p>You may want to add the required packages which are built and installed out of OMy framework:</p>
<div class="highlight-python"><pre>include OMyMakefile

OCAML_PREINSTALLED_PACKS += llvm # llvm has been installed already, independently

Subdirs()</pre>
</div>
<p>It includes &#8220;findlib&#8221; by default. If you want to build findlib in OMy framework, you have to remove it from the list.</p>
</blockquote>
<p id="index-13"><strong>BYTE_ENABLED</strong></p>
<blockquote>
<div class="highlight-python"><pre>=  true</pre>
</div>
<p>If set false in a project directory, byte compilation is disabled there.</p>
</blockquote>
</div>
<div class="section" id="spot-files-ocamlspotter">
<h2>Spot files (OCamlSpotter)<a class="headerlink" href="#spot-files-ocamlspotter" title="Permalink to this headline"></a></h2>
<p id="index-14"><strong>setenv(OCAML_ANNOT, 1)</strong></p>
<blockquote>
Define OCAML_ANNOT so that custom ocamlc/ocamlopt automatically create spot/spit/annot files, even without -annot option.</blockquote>
</div>
<div class="section" id="packages">
<h2>Packages<a class="headerlink" href="#packages" title="Permalink to this headline"></a></h2>
<dl class="docutils" id="index-15">
<dt><strong>public.OCAMLPACKS[]</strong></dt>
<dd>OCaml packages required for compilation. MyCaml* functions automatically add necessary dependencies over packages in $(OCAMLPACKS).</dd>
</dl>
<dl class="docutils" id="index-16">
<dt><strong>public.CAMLP4PACKS[]</strong></dt>
<dd>CamlP4 syntax extension packages required for parsing. MyCaml* functions automatically add necessary dependencies over packages in $(CAMLP4PACKS).</dd>
</dl>
</div>
<div class="section" id="dependencies">
<h2>Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline"></a></h2>
<p id="index-17"><strong>RequirePackages(packages)</strong></p>
<blockquote>
<p>Add dependencies of any build activity over $(packages).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">These functions introduce implicit rules: <em>you may need to export it, if you use this function in a local context.</em></p>
</div>
</blockquote>
<p id="index-18"><strong>OCamlRequirePackages(packages)</strong></p>
<blockquote>
<p>Add dependencies of OCaml compiled files (cmx, cmo, etc.) over $(packages).
$(packages) listed in OCAML_PREINSTALLED_PACKS are ignored.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">These functions introduce implicit rules: <em>you may need to export it, if you use this function in a local context.</em></p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Usually you do not need to call this function. Use OCAMLPACKS variable instead.</p>
</div>
</blockquote>
<p id="index-19"><strong>OCamlRequireCamlP4Packages(packages)</strong></p>
<blockquote>
<p>Add dependencies of OCaml dependency analysis and build over $(packages).
Use this for adding dependencies for CamlP4 extensions.
$(packages) listed in OCAML_PREINSTALLED_PACKS are ignored.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">These functions introduce implicit rules: <em>you may need to export it, if you use this function in a local context.</em></p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Usually you do not need to call this function. Use CAML4PACKS variable instead.</p>
</div>
</blockquote>
<p id="index-20"><strong>%.auto.mli: %.ml</strong></p>
<blockquote>
<tt class="docutils literal"><span class="pre">omake</span> <span class="pre">xxx.auto.mli</span></tt> generates .mli file from xxx.ml</blockquote>
</div>
<div class="section" id="build-rules">
<h2>Build rules<a class="headerlink" href="#build-rules" title="Permalink to this headline"></a></h2>
<p id="index-21"><strong>MyOCamlPackage(library_name, files, cmodules, linkopts)</strong></p>
<blockquote>
<dl class="docutils">
<dt>Add a rule for OCaml package $(library_name).cmo, $(library_name).cmx and etc.</dt>
<dd><dl class="first last docutils">
<dt>library_name</dt>
<dd>target package name</dd>
<dt>files</dt>
<dd>ML module names (without .ml)</dd>
<dt>cmodules</dt>
<dd>C source files (without .c)</dd>
<dt>linkopts</dt>
<dd>C library link option (without OCaml -cclib options)</dd>
</dl>
</dd>
</dl>
<p>Example:</p>
<div class="highlight-python"><pre>MyOCamlPackage(foo, alpha beta, $(EMPTY), $(EMPTY))</pre>
</div>
<p>Todo: external C library</p>
</blockquote>
<p id="index-22"><strong>MyOCamlProgram(name, files)</strong></p>
<blockquote>
<dl class="docutils">
<dt>Add a rule to build a program $(name)</dt>
<dd><dl class="first last docutils">
<dt>name</dt>
<dd>Name of the program</dd>
<dt>files</dt>
<dd>OCaml module names (without .ml)</dd>
</dl>
</dd>
</dl>
</blockquote>
<p id="index-23"><strong>MyOCamlLibrary(name, files)</strong></p>
<blockquote>
<dl class="docutils">
<dt>Add rules to build OCaml library $(name)</dt>
<dd><dl class="first last docutils">
<dt>name</dt>
<dd>Name of the library</dd>
<dt>files</dt>
<dd>OCaml module name (without .ml)</dd>
</dl>
</dd>
</dl>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Probably you should use MyOCamlPackage</p>
</div>
</blockquote>
</div>
<div class="section" id="subdir-traversal">
<h2>Subdir traversal<a class="headerlink" href="#subdir-traversal" title="Permalink to this headline"></a></h2>
<p id="index-24"><strong>Subdirs_except(dirs)</strong></p>
<blockquote>
Recursively traverse the subdirs except $(dirs)</blockquote>
<p id="index-25"><strong>Subdirs()</strong></p>
<blockquote>
Recursively traverse all the subdirs</blockquote>
<p id="index-26"><strong>Subdirs_only(dirs)</strong></p>
<blockquote>
Recursively traverse the given subdirs $(dirs)</blockquote>
</div>
<div class="section" id="dependency-dot-files-for-graphviz">
<h2>Dependency dot files for Graphviz<a class="headerlink" href="#dependency-dot-files-for-graphviz" title="Permalink to this headline"></a></h2>
<p id="index-27"><strong>Dot()</strong></p>
<blockquote>
Add a rule for <tt class="docutils literal"><span class="pre">depend.dot</span></tt> for a dependency graph of OCaml files in the current directory</blockquote>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">OMyMakefile</a><ul>
<li><a class="reference external" href="#directories">Directories</a></li>
<li><a class="reference external" href="#installation-mark-files">Installation mark files</a></li>
<li><a class="reference external" href="#misc-tools">Misc tools</a></li>
<li><a class="reference external" href="#ocamlfind">OCamlFind</a></li>
<li><a class="reference external" href="#spot-files-ocamlspotter">Spot files (OCamlSpotter)</a></li>
<li><a class="reference external" href="#packages">Packages</a></li>
<li><a class="reference external" href="#dependencies">Dependencies</a></li>
<li><a class="reference external" href="#build-rules">Build rules</a></li>
<li><a class="reference external" href="#subdir-traversal">Subdir traversal</a></li>
<li><a class="reference external" href="#dependency-dot-files-for-graphviz">Dependency dot files for Graphviz</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="OMyExternal.html"
                                  title="previous chapter">OMyExternal</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="OMyTar.html"
                                  title="next chapter">OMyTar</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/OMyMakefile.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="OMyTar.html" title="OMyTar"
             >next</a> |</li>
        <li class="right" >
          <a href="OMyExternal.html" title="OMyExternal"
             >previous</a> |</li>
        <li><a href="index.html">OMyMakefile v1.0.0 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2011, Jun FURUSE.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
    </div>
  </body>
</html>