# twiddle with whatever is necessary to link in PETSc.
#
# to make things more fun, the whole scheme was changed in petsc 2.3.0
+#
+# also sort of annoying is the fact that on Mac OS X, the trick with the
+# one library doesn't appear to work. Instead of a single library, we therefore
+# have to list all of them.
ifeq ($(DEAL_II_PETSC_VERSION_MINOR),2)
lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/lib/libg_c++/$(DEAL_II_PETSC_ARCH)
lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/lib/libO_c++/$(DEAL_II_PETSC_ARCH)
lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/lib/$(DEAL_II_PETSC_ARCH)
lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/lib/$(DEAL_II_PETSC_ARCH)
endif
-lib-contrib-petsc.g = $(LIBDIR)/libpetscall.g$(lib-suffix)
-lib-contrib-petsc.o = $(LIBDIR)/libpetscall$(lib-suffix)
+ifeq ($(findstring darwin,$(TARGET)),)
+ lib-contrib-petsc.g = $(LIBDIR)/libpetscall.g$(lib-suffix)
+ lib-contrib-petsc.o = $(LIBDIR)/libpetscall$(lib-suffix)
+else
+ lib-contrib-petsc.g = $(shell echo $(DEAL_II_PETSC_DIR)/lib/$(DEAL_II_PETSC_ARCH)/*$(lib-suffix))
+ lib-contrib-petsc.o = $(shell echo $(DEAL_II_PETSC_DIR)/lib/$(DEAL_II_PETSC_ARCH)/*$(lib-suffix))
+endif
+
# same for metis, except that there is only one library in that case
lib-contrib-metis = $(DEAL_II_METIS_DIR)/libmetis.a