views:

145

answers:

6

I need something like make i.e. dependencies + executing shell commands where failing command stops make execution. But more deeply integrated with shell i.e. now in make each line is executed in separate context so it is not easy to set variable in one line and use it in following line (I do not want escape char at end of line because it is not readable). I want simple syntax (no XML) with control flow and functions (what is missing in make). It does not have to have support for compilation. I have to just bind together several components built using autotools, package them, trigger test and publish results.

I looked at: make, ant, maven, scons, waf, nant, rake, cons, cmake, jam and they do not fit my needs.

+2  A: 

Given that you want control flow, functions, everything operating in the same environment and no XML, it sounds like you want to use the available shell script languages (sh/bash/ksh/zsh), or Perl (insert your own favourite scripting language here!).

I note you've not looked at a-a-p. I'm not familiar with this, other than it's a make system from the people who brought us vim. So you may want to look over that.

Brian Agnew
A: 

A mix of makefile and a scripting language to choose which makefile to run at a time could do it.

Emmanuel Caradec
A: 

Have a look at fabricate

If that does not fulfill your needs of if you would rather not write your build script in Python, you could also use a combination of shell scripting + fabricate. Write the script as you would to build your project manually, but prepend build calls with "fabricate.py" so build dependencies are managed automatically.

Simple example:

#!/bin/bash
EXE="myapp"
CC="fabricate.py gcc" # let fabricate handle dependencies
FILES="file1.c file2.c file3.c"
OBJS=""

# build link
for F in $FILES; do
    echo $CC -c $F
    if [ $? -ne 0 ]; then
        echo "Build failed while compiling $F" >2
        exit $?
    fi
    OBJS="$OBJS ${F/.c/.o}"
done

# link
$CC -o $EXE $OBJS
lsc
A: 

I have had the same needs. My current solution is to use makefiles to accurately represent the graph dependency (you have to read "Recursive make considered harmful"). Those makefiles trigger bash scripts that take makefiles variables as parameters. This way you have not to deal with the problem of shell context and you get a clear separation between the dependencies and the actions.

I'm currently considering waf as it seems well designed and fast enough.

neuro
A: 

You might want to google for SCons; it's a Make-replacement written in Python.

Regards

Mark

High Performance Mark
A: 

take a look at doit

  • you can use shell commands or python functions to define tasks (builds).
  • very easy to use. write scripts in python. "no api" (you dont need to import anything in your script)
  • it has good support to track dependencies and targets
schettino72