If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions

Friday, January 16, 2009

Which build utility to run?

I have the following as a script called "mk" and set in my .vimrc
set makeprg=mk


#!/bin/bash
# Guess which make utility to use

# Miki Tebeka <miki.tebeka@gmail.com>

makecmd=""
if [ -f SConstruct ]; then
makecmd="scons -Q -D"
elif [ -f build.xml ]; then
makecmd="ant"
elif [ -f Makefile ]; then
makecmd="make"
elif [ -f makefile ]; then
makecmd="make"
elif [ "$OSTYPE" == "WINNT" ]; then
proj=`ls *.dsp 2>/dev/null`
if [ -f $proj ]; then
makecmd="msdev $proj /MAKE"
fi
fi

if [ -z "$makecmd" ]; then
echo "can't find project file"
exit 1
fi

$makecmd $@

No comments:

Blog Archive