These supersede my previous patches for this. The first bug fix has been updated to use macros like $(MKDIR_P) The second one, which is a makefile cleanup, not a bug fix, has been updated so that make distcheck works.