Export targetdir so that script can use this information unless overwritten by --target

Export targetdir so that script can use this information unless overwritten by --target