1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
7 # To understand how the build system works and how to modify it, see
8 # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
11 # -----------------------------------------------------------------------------
17 ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
19 ifeq "$$(Windows)" "YES"
21 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER)" "YES"
22 # Just install the binary on Windows
28 ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" ""
29 $1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper
32 ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
33 all_$1_$2 : $$(INPLACE_BIN)/$$($1_$2_PROG)
35 $$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@
36 $$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE) $$($1_$2_SHELL_WRAPPER_NAME)
37 "$$(RM)" $$(RM_OPTS) $$@
38 echo '#!$$(SHELL)' >> $$@
39 echo 'executablename="$$(TOP)/$$<"' >> $$@
40 echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
41 echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
42 echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
43 echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@
44 $$($1_$2_SHELL_WRAPPER_EXTRA)
45 $$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
46 cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
47 $$(EXECUTABLE_FILE) $$@
50 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER)" "YES"
52 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)" ""
53 $1_$2_INSTALL_SHELL_WRAPPER_NAME = $$($1_$2_PROG)
56 # Install the binary in $(libexecdir), and install a shell wrapper in $(bindir)
57 INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
58 BINDIST_WRAPPERS += $$($1_$2_SHELL_WRAPPER_NAME)
60 install: install_$1_$2_wrapper
62 .PHONY: install_$1_$2_wrapper
63 install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
64 install_$1_$2_wrapper:
65 $$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)"
66 "$$(RM)" $$(RM_OPTS) "$$(WRAPPER)"
67 $$(CREATE_SCRIPT) "$$(WRAPPER)"
68 echo '#!$$(SHELL)' >> "$$(WRAPPER)"
69 echo 'exedir="$$(ghclibexecdir)"' >> "$$(WRAPPER)"
70 echo 'exeprog="$$($1_$2_PROG)"' >> "$$(WRAPPER)"
71 echo 'executablename="$$$$exedir/$$$$exeprog"' >> "$$(WRAPPER)"
72 echo 'datadir="$$(datadir)"' >> "$$(WRAPPER)"
73 echo 'bindir="$$(bindir)"' >> "$$(WRAPPER)"
74 echo 'topdir="$$(topdir)"' >> "$$(WRAPPER)"
75 echo 'pgmgcc="$$(WhatGccIsCalled)"' >> "$$(WRAPPER)"
76 $$($1_$2_SHELL_WRAPPER_EXTRA)
77 $$($1_$2_INSTALL_SHELL_WRAPPER_EXTRA)
78 cat $$($1_$2_SHELL_WRAPPER_NAME) >> "$$(WRAPPER)"
79 $$(EXECUTABLE_FILE) "$$(WRAPPER)"
81 endif # $1_$2_INSTALL_SHELL_WRAPPER
85 endif # $1_$2_SHELL_WRAPPER