#!/bin/sh # fmake, a fast way to compile very simple one-off programs # Author: John Tsiombikas # License: I place this script into the public domain, do whatever you like with it. # fmake looks at the first line of the file passed as its argument to find an fmake command # of the form: /*! command */ and executes it. # # This scheme is meant as a quick & dirty method of compiling small one-off programs without the # need to put them in a separate directory and provide a makefile, or having to remember every # library or compiler flag that it needs, and calling the compiler/linker manually every time. cmd=`head -1 $1 | grep '^/\*!.*\*/$' | sed 's/^\/\*\![ \t]*//' | sed 's/[ \t]*\*\/$//'` if [ -z "$cmd" ]; then cmd="gcc $1" fi echo $cmd exec $cmd