Enable building Cabal with parsec
[ghc.git] / rules / shell-wrapper.mk
index b23e385..eb7d8f1 100644 (file)
@@ -5,8 +5,8 @@
 # This file is part of the GHC build system.
 #
 # To understand how the build system works and how to modify it, see
-#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
-#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#      http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
+#      http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
 #
 # -----------------------------------------------------------------------------
 
@@ -20,28 +20,33 @@ ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" ""
 $1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROGNAME).wrapper
 endif
 
+
 ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
 
+$1_$2_INPLACE_SHELL_WRAPPER_NAME = $$($1_$2_PROG)
+
 ifeq "$$($1_$2_TOPDIR)" "YES"
-INPLACE_WRAPPER = $$(INPLACE_LIB)/$$($1_$2_PROG)
+$1_$2_INPLACE_WRAPPER = $$(INPLACE_LIB)/bin/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME)
 else
-INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_PROG)
+$1_$2_INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME)
 endif
 
-all_$1_$2 : $$(INPLACE_WRAPPER)
+all_$1_$2 : $$($1_$2_INPLACE_WRAPPER)
 
-$$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@
+$(call clean-target,$1,$2_inplace_wrapper,$$($1_$2_INPLACE_WRAPPER))
+
+$$($1_$2_INPLACE_WRAPPER): WRAPPER=$$@
 ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
-$$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME)
+$$($1_$2_INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME)
 endif
-$$(INPLACE_WRAPPER): $$($1_$2_INPLACE)
+$$($1_$2_INPLACE_WRAPPER): $$($1_$2_INPLACE)
        $$(call removeFiles,                                                    $$@)
        echo '#!$$(SHELL)'                                                   >> $$@
        echo 'executablename="$$(TOP)/$$<"'                                  >> $$@
        echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"'                             >> $$@
        echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"'                              >> $$@
        echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"'                           >> $$@
-       echo 'pgmgcc="$$(WhatGccIsCalled)"'                                  >> $$@
+       echo 'pgmgcc="$$(CC)"'                                               >> $$@
        $$($1_$2_SHELL_WRAPPER_EXTRA)
        $$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
 ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES"
@@ -54,7 +59,8 @@ else
 endif
        $$(EXECUTABLE_FILE)                                                     $$@
 
-endif
+endif # $1_$2_WANT_INPLACE_WRAPPER
+
 
 ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES"
 
@@ -62,7 +68,7 @@ ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)" ""
 $1_$2_INSTALL_SHELL_WRAPPER_NAME = $$($1_$2_PROG)
 endif
 
-# Install the binary in $(libexecdir), and install a shell wrapper in $(bindir)
+# Install the binary in $(ghclibexecdir), and install a shell wrapper in $(bindir)
 INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
 BINDIST_WRAPPERS += $$($1_$2_SHELL_WRAPPER_NAME)
 
@@ -71,7 +77,7 @@ install: install_$1_$2_wrapper
 .PHONY: install_$1_$2_wrapper
 install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$(CrossCompilePrefix)$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
 install_$1_$2_wrapper:
-       $$(call INSTALL_DIR,"$$(DESTDIR)$$(bindir)")
+       $$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)"
        $$(call removeFiles,                                        "$$(WRAPPER)")
        $$(CREATE_SCRIPT)                                           "$$(WRAPPER)"
        echo '#!$$(SHELL)'                                       >> "$$(WRAPPER)"
@@ -86,7 +92,8 @@ install_$1_$2_wrapper:
        cat $$($1_$2_SHELL_WRAPPER_NAME)                         >> "$$(WRAPPER)"
        $$(EXECUTABLE_FILE)                                         "$$(WRAPPER)"
 
-endif
+endif # $1_$2_WANT_INSTALLED_WRAPPER
+
 
 ifeq "$$($1_$2_WANT_BINDIST_WRAPPER)" "YES"
 ifneq "$$(TargetOS_CPP)" "mingw32"
@@ -107,7 +114,7 @@ endif
        $$(EXECUTABLE_FILE)                                                   $$@
 
 endif
-endif
+endif # $1_$2_WANT_BINDIST_WRAPPER
 
 $(call profEnd, shell-wrapper($1,$2))
 endef