correctly generate CPPFLAGS, LDFLAGS, LIBS for building with PETSc