An open API service indexing awesome lists of open source software.

https://github.com/refi64/tinymk

A single-file build tool based on CoffeeScript's cake and Shake, written in Python
https://github.com/refi64/tinymk

Last synced: 8 months ago
JSON representation

A single-file build tool based on CoffeeScript's cake and Shake, written in Python

Awesome Lists containing this project

README

          

TinyMk
======

TinyMk is a small but powerful make system written in Python and based on
`Cake `_ and
`Shake `_. It consists of a single script that's
around 350 lines long. Here's a somewhat complex example of using it:

.. code-block:: python

from tinymk import * # import TinyMk
import os, glob

sources = ['a.c', 'b.c', 'c.c']
objects = [os.path.splitext(src)[0]+'.o' for src in sources]

@task()
def build():
# invoke 2 other targets
invoke('build:headers')
invoke('build:app')

# create a task for each element in sources inside of the category objects
# ptask is like GNU make's pattern rules
# for each element in the sources list, call the function
@ptask('%.c', '%.o', sources, 'objects')
def objects(outs, src):
# outs is a list; since there is only one output, get it
out = outs[0]
# object the object file in the source has changed
run_d(out, dep, 'gcc -c %s -o %s' % (src, out))

# create a task named 'app' in the category 'build'
@task('build:')
def app():
# if we need to update the output file...
if need_to_update('app', sources):
cinvoke('objects')
# update the output file
run('gcc %s -o %s' % (' '.join(objects), 'app'))

# create a task named 'headers' in the category 'build'
@task('build:')
def headers():
# regenerate gen.h if gen.py has changed
run_d('gen.h', 'gen.py', 'python gen.py > gen.h')

main()

Even better, TinyMk is licensed under the MIT Expat license, so you can
distribute it with your application without needing to worry about licensing
troubles.

For more info, see the ``docs`` folder and the ``examples`` folder.

Prebuilt docs are available on
`ReadTheDocs `_.

Links
*****

- `GitHub `_.
- `Documentation on ReadTheDocs `_.
- `Mailing list `_.
- `Mailing list web interface `_.