Fixed Makefiles to support static linking.