#!/bin/bash

#Get number of cpus on current platform
NUMCPUS=`grep -c processor /proc/cpuinfo`;

#version of mtoc
name=`echo *.tgz | sed 's/\.tgz//g'` 
echo $name

#Some cleanup
rm -rf src install $name

#Create src and install directories
mkdir src install

#Untar 
tar -zxvf  $name.tgz

#Move mtoc to src directory
mv $name/* src/
rm -rf $name

#Compile mtoc
cd src
rm -rf mtoc mtoc.exe

flex mtoc.l
gcc -o ../install/mtoc lex.yy.c -lfl
