Metadata-Version: 2.0
Name: faff
Version: 0.1.9
Summary: Make build tool substitute written in Python.
Home-page: https://github.com/mojzu/faff
Author: mojzu
Author-email: mail@mojzu.net
License: Public Domain
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Public Domain
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Software Development :: Build Tools
Requires-Dist: Jinja2 (==2.8)

Faff
====

.. image:: https://img.shields.io/pypi/v/faff.svg?style=flat-square
    :target: https://pypi.python.org/pypi/faff

.. image:: https://img.shields.io/pypi/status/faff.svg?style=flat-square
    :target: https://pypi.python.org/pypi/faff

.. image:: https://img.shields.io/pypi/l/faff.svg?style=flat-square
    :target: https://pypi.python.org/pypi/faff

.. image:: https://img.shields.io/travis/mojzu/faff/master.svg?style=flat-square
    :target: http://travis-ci.org/mojzu/faff

.. image:: https://img.shields.io/coveralls/mojzu/faff.svg?style=flat-square
    :target: https://coveralls.io/github/mojzu/faff

Faff is a Make build tool substitute written in Python. Input files similar
to ``Makefile``'s define rules which are used to build arbitrary targets that
may have dependencies.

Installation
------------

Install using pip.

.. code:: shell

  $ pip install faff

Quickstart
----------

Create a file in a new directory named ``faffin.py``.

.. code:: shell

  $ mkdir -p $DIR && cd $DIR
  $ touch faffin.py

Content of ``faffin.py`` file. This assumes that the ``gcc`` command is
available in the system path.

.. code:: python

  #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  import os
  from faff import (Variable, FileTarget, Rule, Run)

  # Absolute path to directory.
  root = os.path.abspath(os.path.dirname(__file__))

  # Root variable definition.
  Variable("ROOT", root)

  # File targets with path variable expansion.
  SOURCE = FileTarget("{ROOT}", "main.c")
  BINARY = FileTarget("{ROOT}", "main")

  # Compile and run binary rule.
  @Rule([BINARY, SOURCE])
  def all(target, depends, args):
      Run("gcc {_D} -o {_T}", root)
      Run("main", root)

Create a file in the directory named ``main.c``.

.. code:: shell

  $ touch main.c

Content of ``main.c`` file.

.. code:: c

  #include <stdio.h>

  int main(void) {
      printf("Hello, world!\r\n");
      return 0;
  }

Run the input file.

.. code:: shell

  $ faff
  faff: gcc $DIR/main.c -o $DIR/main
  faff: main
  Hello, world!
  faff: `all` updated (1/1 0.707s)

Documentation
-------------

TODO


