Document -ddump-timings
[ghc.git] / rules / shell-wrapper.mk
index 6b84072..bdab6e2 100644 (file)
@@ -26,25 +26,27 @@ 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_INPLACE_SHELL_WRAPPER_NAME)
+$1_$2_INPLACE_WRAPPER = $$(INPLACE_LIB)/bin/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME)
 else
-INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME)
+$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_WRAPPER): 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 '#!/bin/sh'                                                     >> $$@
        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"
@@ -75,10 +77,10 @@ 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)"
+       echo '#!/bin/sh'                                         >> "$$(WRAPPER)"
        echo 'exedir="$$(ghclibexecdir)/bin"'                    >> "$$(WRAPPER)"
        echo 'exeprog="$$($1_$2_PROG)"'                          >> "$$(WRAPPER)"
        echo 'executablename="$$$$exedir/$$$$exeprog"'           >> "$$(WRAPPER)"
@@ -104,7 +106,7 @@ BINDIST_EXTRAS += $$($1_$2_BINDIST_WRAPPER)
 
 $$($1_$2_BINDIST_WRAPPER): $1/$2/build/tmp/$$($1_$2_PROG)
        $$(call removeFiles,                                                  $$@)
-       echo '#!$$(SHELL)'                                                 >> $$@
+       echo '#!/bin/sh'                                                   >> $$@
 ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES"
        echo '$$(call prependLibraryPath,$$($1_$2_DEP_LIB_REL_DIRS_SEARCHPATH))' >> $$@
 endif