views:

82

answers:

1

The advantage of writing a Makefile is that "make" is generally assumed to be present on the various Unices (Linux and Mac primarily).

Now I have the following Makefile:

PYTHON := python

all: e installdeps

e:
        virtualenv --distribute --python=${PYTHON} e

installdeps:
        e/bin/python setup.py develop
        e/bin/pip install unittest2

test:   
        e/bin/unit2 discover

clean:  
        rm -rf e

As you can see this Makefile uses simple targets and variable substitution. Can this be achieved on Windows? By that mean - without having to install external tools (like cygwin make); perhaps make.cmd? Typing "make installdeps" for instance, should work both on Unix and Windows.

+4  A: 

Something simple like that, yes. However, if you'd like to continue to improve that makefile, you might consider just writing the "makefile" (rather installation script) in a more portable language. You have to have some assumptions. If its a python project, I'm sure you assume python is installed. So write the equivalent of your makefile in python.

xyld
Along those lines, you might want to look into Scons, which is a build system coded in Python.
David Zaslavsky
good point, but it is an extra package to install. At least with a python project, you can assume that python is installed, it might be too much to assume that scons is installed, even though it is written in python.
xyld
Scons is some of the most hideous Python code I have ever seen.
fuzzy lollipop
@fuzzy good to know, maybe I won't spend time looking into it then someday
xyld
Nomenclature wise I wince when someone says "makefile" meaning a script written in a language *other* than make. May I suggest 'Write your "installation script" in python.'? Very good suggestion, though.
dmckee
@dmckee good point, your "Write your 'installation script'" is definitely what I meant without saying it.
xyld