specify 'root' or current directory as macro variable

also changed the code to create/clean output dirs before capturing
outputs.