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
- Host: GitHub
- URL: https://github.com/refi64/tinymk
- Owner: refi64
- Created: 2014-07-17T19:44:39.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T19:16:25.000Z (almost 9 years ago)
- Last Synced: 2025-03-25T05:06:48.004Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
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 `_.