From 1d5a157c646f497c36a11588f5d0c1442eb7c777 Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Thu, 22 Jan 1998 10:13:49 +0000
Subject: [PATCH] [project @ 1998-01-22 10:13:49 by simonm] Even more gruesome
 hack to avoid -odir $* problems in make depend.

---
 mk/target.mk | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/mk/target.mk b/mk/target.mk
index 1ce8239b0876..c46d23d57933 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -62,14 +62,6 @@
 # Compiler produced files that are targets of the source's imports.
 MKDEPENDHS_OBJ_SUFFICES=o
 
-# HC_OPTS sometimes contains $*, which will expand to nothing in the depend
-# rule below.  So we replace $* with a dummy value for passing to mkdependHS
-# and hope it works.  
-#
-# This crops up with GhcLibHcOpts which ends in '-split_objs -odir $*'
-
-MKDEPENDHS_HC_OPTS = $(patsubst $*,dollar_star,$(HC_OPTS))
-
 depend :: $(MKDEPENDHS_SRCS) $(MKDEPENDC_SRCS)
 	@$(RM) .depend
 	@touch .depend
@@ -80,9 +72,14 @@ ifneq "$(MKDEPENDC_SRCS)" ""
 	$(MKDEPENDC) -f .depend $(MKDEPENDC_OPTS) -- $(CC_OPTS) -- $(MKDEPENDC_SRCS)
 endif
 ifneq "$(MKDEPENDHS_SRCS)" ""
-	$(MKDEPENDHS) -M -optdep-f -optdep.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-optdep-o -optdep$(obj)) $(MKDEPENDHS_OPTS) $(MKDEPENDHS_HC_OPTS) $(MKDEPENDHS_SRCS)
+	$(MKDEPENDHS) -M -optdep-f -optdep.depend $(foreach way,$(WAYS),-optdep-s -optdep$(way)) $(foreach obj,$(MKDEPENDHS_OBJ_SUFFICES),-optdep-o -optdep$(obj)) $(MKDEPENDHS_OPTS) $(patsubst -odir,,$(HC_OPTS)) $(MKDEPENDHS_SRCS)
 endif
 
+# the above patsubst is a hack to remove the '-odir $*' from HC_OPTS
+# which is present when we're splitting objects.  The $* maps to
+# nothing, since this isn't a pattern rule, so we have to get rid of
+# the -odir too to avoid problems.
+
 ##################################################################
 # 			boot
 #
-- 
GitLab