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)
37 echo '#!$$(SHELL)' >> $$@
38 echo 'executablename=$$(TOP)/$$<' >> $$@
39 echo 'datadir=$$(TOP)/$$(INPLACE_LIB)' >> $$@
40 echo 'bindir=$$(TOP)/$$(INPLACE_BIN)' >> $$@
41 cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
42 $$(EXECUTABLE_FILE) $$@
45 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER)" "YES"
47 ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)" ""
48 $1_$2_INSTALL_SHELL_WRAPPER_NAME = $$($1_$2_PROG)
51 # Install the binary in $(libexecdir), and install a shell wrapper in $(bindir)
52 INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
53 BINDIST_WRAPPERS += $$($1_$2_SHELL_WRAPPER_NAME)
55 install: install_$1_$2_wrapper
57 .PHONY: install_$1_$2_wrapper
58 install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)
59 install_$1_$2_wrapper:
60 $$(MKDIRHIER) $$(DESTDIR)$$(bindir)
62 echo '#!$$(SHELL)' >> $$(WRAPPER)
63 echo 'executablename=$$(libexecdir)/$$($1_$2_PROG)' >> $$(WRAPPER)
64 echo 'datadir=$$(datadir)' >> $$(WRAPPER)
65 echo 'bindir=$$(bindir)' >> $$(WRAPPER)
66 cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$(WRAPPER)
67 $$(EXECUTABLE_FILE) $$(WRAPPER)
69 endif # $1_$2_INSTALL_SHELL_WRAPPER
73 endif # $1_$2_SHELL_WRAPPER