+# split the objects into 3 exclusive sets: those used by both miniperl and
+# perl, and those used by just one or the other. Doesn't include the
+# actual perl(mini)main.o, nor any dtrace objects.
+
+common_objs = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
+mini_only_objs = opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
+main_only_objs = op$(OBJ_EXT) perl$(OBJ_EXT)
+
+miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
+perllib_objs_nodt = $(main_only_objs) $(common_objs)
+
+!NO!SUBS!
+
+# dtrace with -G modifies the source object files, which can cause
+# dependency issues, and can cause the dtrace -G to fail on FreeBSD
+# so separate the objects generated by $(CC) from those used to link
+# the executable when dtrace -G is involved.
+#
+# $(FOO:op%os=np%ns) isn't generally portable but is portable to
+# the makes on darwin, Solaris, FreeBSD and Linux, which is where we
+# use dtrace
+
+case "$usedtrace:$dtraceobject" in
+define:define)
+ $spitshell >>$Makefile <<'!NO!SUBS!'
+
+miniperl_dtrace_objs = $(miniperl_objs_nodt:%=mpdtrace/%)
+perllib_dtrace_objs = $(perllib_objs_nodt:%=libpdtrace/%)
+perlmain_dtrace_objs = maindtrace/perlmain$(OBJ_EXT)
+
+miniperl_objs = $(miniperl_dtrace_objs) $(DTRACE_MINI_O)
+perllib_objs = $(perllib_dtrace_objs) $(DTRACE_PERLLIB_O)
+perlmain_objs = $(perlmain_dtrace_objs) $(DTRACE_MAIN_O)
+
+miniperl_dep = $(DTRACE_MINI_O)
+perllib_dep = $(DTRACE_PERLLIB_O)
+perlmain_dep = $(DTRACE_MAIN_O)