@@ -59,6 +59,18 @@ ifneq (,$(findstring PETSC_HAVE_KOKKOS 1,$(CONTENTS)))
59
59
export PETSC_HAVE_KOKKOS := 1
60
60
endif
61
61
62
+ # To prevent overlinking with conda builds, only explicitly link
63
+ # to the libraries we use in pflare
64
+ ifeq ($(CONDA_BUILD ) ,1)
65
+ PETSC_LINK_LIBS = -L${PETSC_DIR}/${PETSC_ARCH}/lib -lpetsc ${BLASLAPACK_LIB}
66
+ ifeq ($(PETSC_HAVE_KOKKOS ) ,1)
67
+ PETSC_LINK_LIBS += ${KOKKOS_LIB} ${KOKKOS_KERNELS_LIB}
68
+ endif
69
+ # Otherwise just use everything petsc uses to be safe
70
+ else
71
+ PETSC_LINK_LIBS = $(LDLIBS )
72
+ endif
73
+
62
74
# ~~~~~~~~~~~~~~~~~~~~~~~~
63
75
# ~~~~~~~~~~~~~~~~~~~~~~~~
64
76
@@ -158,8 +170,14 @@ $(OUT): $(OBJS)
158
170
ifeq ($(PETSC_USE_SHARED_LIBRARIES ) ,0)
159
171
$(AR) $(AR_FLAGS) $(OUT) $(OBJS)
160
172
$(RANLIB) $(OUT)
173
+ else
174
+ ifeq ($(findstring darwin,$(PETSC_ARCH ) ) ,darwin)
175
+ # macOS: Use -dynamiclib and set a relocatable @rpath install_name.
176
+ $(LINK.F) -dynamiclib -o $(OUT) $(OBJS) $(PETSC_LINK_LIBS) -install_name @rpath/$(notdir $(OUT))
161
177
else
162
- $(LINK.F) -shared -o $(OUT) $(OBJS) $(LDLIBS)
178
+ # Linux: Use -shared and set the soname.
179
+ $(LINK.F) -shared -o $(OUT) $(OBJS) $(PETSC_LINK_LIBS) -Wl,-soname,$(notdir $(OUT))
180
+ endif
163
181
endif
164
182
165
183
# Generate dependencies for parallel build with makedepf90
0 commit comments