all: create_run_script build_binaries clean_source create_run_script: @echo 'Creating run script for numerical lab' @echo '#!/bin/sh' > ./run @echo '# this script is generating automatically by Makefile' >> ./run @echo >> ./run @echo '# setting environmental variables' >> ./run @echo "LABPATH=`pwd` ; export LABPATH" >> ./run @echo 'LABBIN=$$LABPATH'"/bin/`uname` ; export LABBIN" >> ./run @echo 'LABTMP=/tmp/$$USER ; export LABTMP' >> ./run @echo >> ./run @echo '# creating tmp directory space for user' >> ./run @echo 'if [ ! -d $$LABTMP ] ; then' >> ./run @echo ' mkdir $$LABTMP' >> ./run @echo 'fi' >> ./run @echo >> ./run @echo '# copy lab notebooks into current directory' >> ./run @echo 'for n in 1 2 3 4 5 6 ; do' >> ./run @echo ' if [ ! -f $$n.nb ] ; then' >> ./run @echo ' cp $$LABPATH/$$n/$$n.nb .' >> ./run @echo ' fi' >> ./run @echo 'done' >> ./run @echo >> ./run @echo '# start with first or specified notebook' >> ./run @echo 'if [ "$$1" = "" ] ; then' >> ./run @echo ' nb=1.nb' >> ./run @echo 'else' >> ./run @echo ' nb=$$1' >> ./run @echo 'fi' >> ./run @echo >> ./run @echo '# run mathematica in the background' >> ./run @echo 'if [ "`uname`" = "Darwin" ] ; then' >> ./run @echo ' open $$nb &' >> ./run @echo 'else' >> ./run @echo ' mathematica $$nb &' >> ./run @echo 'fi' >> ./run build_binaries: @if [ ! -d bin/`uname` ] ; then \ echo "Creating directory bin/`uname` for binaries" ; \ mkdir bin/`uname` ; \ fi @echo 'Building all binaries for numerical lab' @for d in [1-6] ; do \ if [ -f $$d/Makefile ] ; then \ ( cd $$d ; make all ) ; \ fi ; \ done clean_source: @echo "Cleaning up source subdirectories" @for d in [1-6] ; do \ if [ -f $$d/Makefile ] ; then \ ( cd $$d ; make clean ) ; \ fi ; \ done