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): $$($1_$2_INPLACE)
36 "$$(RM)" $$(RM_OPTS) $$@
37 echo '#!$$(SHELL)' >> $$@
38 echo 'executablename=$$(TOP)/$$<' >> $$@
39 echo 'datadir=$$(TOP)/$$(INPLACE_LIB)' >> $$@
40 echo 'bindir=$$(TOP)/$$(INPLACE_BIN)' >> $$@
41 echo 'topdir=$$(TOP)/$$(INPLACE_TOPDIR)' >> $$@
42 cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
43 $$(EXECUTABLE_FILE) $$@
46 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER)" "YES"
48 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)" ""
49 $1_$2_INSTALL_SHELL_WRAPPER_NAME = $$($1_$2_PROG)
52 # Install the binary in $(libexecdir), and install a shell wrapper in $(bindir)
53 INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
54 BINDIST_WRAPPERS += $$($1_$2_SHELL_WRAPPER_NAME)
56 install: install_$1_$2_wrapper
58 .PHONY: install_$1_$2_wrapper
59 install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
60 install_$1_$2_wrapper:
61 $$(INSTALL_DIR) $$(DESTDIR)$$(bindir)
62 "$$(RM)" $$(RM_OPTS) $$(WRAPPER)
63 $$(CREATE_SCRIPT) $$(WRAPPER)
64 echo '#!$$(SHELL)' >> $$(WRAPPER)
65 echo 'executablename=$$(ghclibexecdir)/$$($1_$2_PROG)' >> $$(WRAPPER)
66 echo 'datadir=$$(datadir)' >> $$(WRAPPER)
67 echo 'bindir=$$(bindir)' >> $$(WRAPPER)
68 echo 'topdir=$$(topdir)' >> $$(WRAPPER)
69 cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$(WRAPPER)
70 $$(EXECUTABLE_FILE) $$(WRAPPER)
72 endif # $1_$2_INSTALL_SHELL_WRAPPER
76 endif # $1_$2_SHELL_WRAPPER