Because it is possible. Anything else ?
Joke apart, while GNU make is really good at declaring targets dependancies and dealing with them, writing generic rules, hacking existing Makefile or even parallel builds, you may want to use a more advanced programming language for writing rules, with the following advantages:
- access to a huge library of tools
- easier syntax for dealing with strings
- ...
Download python.mk
:
$ curl https://raw.githubusercontent.com/jeanparpaillon/python.mk/master/python.mk > python.mk
Run bootstrap target:
$ make -f python.mk bootstrap
Example:
include python.mk
DIR = $(shell print getcwd())
all:
print "$(DIR)"
By default, the following code is run for each Python command: from os import *
.
You can set your startup code by setting PYTHONSTARTUP variable, for instance:
include python.mk
PYTHONSTARTUP = startup.py