Fix typo in linking -ldl
Clear out the build scripts and core directories before copying.