[erlang-questions] Use of makefiles

Adam Lindberg <>
Thu Feb 28 14:47:32 CET 2008


Hi,

I prefer to use emakefiles and the OTP make utility. It's very simple but
most of the times good enough. Check it out here:
http://erlang.org/doc/man/make.html

Cheers!
Adam
--
Adam Lindberg
http://www.erlang-consulting.com
(Erlang Community: http://www.trapexit.org)

On Thu, Feb 28, 2008 at 2:15 PM, Dave Rafkind <>
wrote:

> Alexander Lamb wrote:
>
> > What are the various strategies to manage your build / run or build /
> > deploy cycles?
> >
>
> There is an interesting add-on for SCons here:
> http://pupeno.com/software/scons-erlang/
>
>
> However one day I thought I'd obsolete Make with a bash script (assumes
> code in esrc and binaries in ebin):
>
>
> #!/bin/bash
>
> ERLC=erlc
> SOURCE_ROOT=esrc
> DEST_ROOT=ebin
> # collect source directories
> for SOURCE_DIR in `find -L $SOURCE_ROOT -type d`; do
>  SOURCE_INCLUDES="$SOURCE_INCLUDES -I $SOURCE_DIR"
> done
>
> COMPILE="$ERLC $SOURCE_INCLUDES"
>
> mkdir -p $DEST_ROOT
>
> for SOURCE_TARGET in `find -L $SOURCE_ROOT -name "*.erl"`; do
>  DEST_TARGET=${DEST_ROOT}/${SOURCE_TARGET#*/}
>  DEST_TARGET=${DEST_TARGET%.erl}.beam
>  DEST_PATH=${DEST_TARGET%/*}
>
>  mkdir -p $DEST_PATH
>
>  CMD="$COMPILE -o $DEST_PATH $SOURCE_TARGET"
>
>  if [[ -e $DEST_TARGET ]]
>  then
>    if [[ $SOURCE_TARGET -nt $DEST_TARGET ]]
>    then
>      #echo $DEST_TARGET is old, recompiling to $DEST_PATH
>      echo "$CMD"
>      if $CMD
>      then
>        # do nothing
>        FOO=1
>      else
>        echo "Compilation halted due to errors."
>        exit 1
>      fi
>    fi
>  else
>    #echo $DEST_TARGET does not exist, compiling to $DEST_PATH
>    echo "$CMD"
>    if $CMD
>    then
>      # do nothing
>      FOO=1
>    else
>      echo "Compilation halted due to errors."
>      exit 1
>    fi
>  fi
> done
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080228/88c45ae4/attachment.html>


More information about the erlang-questions mailing list