Escape some $s in makefiles for consistency
[ghc-hetmet.git] / rules / build-perl.mk
index 468572c..86f729f 100644 (file)
@@ -22,8 +22,8 @@ define build-perl
 # $1 = dir
 # $2 = distdir
 
-ifeq "$$($1_$2_LIBEXEC)" "YES"
-$1_$2_INPLACE = $(INPLACE_LIB)/$$($1_$2_PROG)
+ifeq "$$($1_$2_TOPDIR)" "YES"
+$1_$2_INPLACE = $(INPLACE_TOPDIR)/$$($1_$2_PROG)
 else
 $1_$2_INPLACE = $(INPLACE_BIN)/$$($1_$2_PROG)
 endif
@@ -34,10 +34,11 @@ $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
 .PHONY: clean_$1
 clean_$1 : clean_$1_$2
 
+# INPLACE_BIN etc. might be empty if we're cleaning
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
 ifneq "$$(BINDIST)" "YES"
 $1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$(UNLIT)
        "$$(MKDIRHIER)" $1/$2
-       "$$(RM)" $$(RM_OPTS) $$@
        "$$(UNLIT)" $$(UNLIT_OPTS) $$< $$@
 
 $1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl
@@ -49,9 +50,9 @@ $1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl
 
 $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG)
        "$$(MKDIRHIER)" $$(dir $$@)
-       "$$(RM)" $$(RM_OPTS) $$@
        "$$(CP)" $$< $$@
        $$(EXECUTABLE_FILE) $$@
 endif
+endif
 
 endef