41d1f15c1713e5723bd4d03278c94da6aa5f1403
[ghc.git] / driver / ghci / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 # http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 ifeq "$(GhcWithInterpreter)" "YES"
14 ifneq "$(Windows_Host)" "YES"
15
16 install: install_driver_ghci
17
18 .PHONY: install_driver_ghci
19 install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
20 install_driver_ghci:
21 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
22 $(call removeFiles, "$(WRAPPER)")
23 $(CREATE_SCRIPT) "$(WRAPPER)"
24 echo '#!$(SHELL)' >> "$(WRAPPER)"
25 echo 'exec "$(bindir)/ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)"
26 $(EXECUTABLE_FILE) "$(WRAPPER)"
27 $(call removeFiles,"$(DESTDIR)$(bindir)/ghci")
28 $(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci"
29
30 else # Windows_Host...
31
32 driver/ghci_dist_C_SRCS = ghci.c ../utils/cwrapper.c ../utils/getLocation.c ../utils/isMinTTY.c
33 driver/ghci_dist_CC_OPTS += -I driver/utils
34 driver/ghci_dist_PROGNAME = ghci
35 driver/ghci_dist_INSTALL = YES
36 driver/ghci_dist_INSTALL_INPLACE = YES
37 driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res
38
39 $(eval $(call build-prog,driver/ghci,dist,1))
40
41 driver/ghci_dist_PROG_VER = ghci-$(ProjectVersion)$(exeext1)
42
43 INSTALL_BINS += driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER)
44
45 driver/ghci/ghci.res : driver/ghci/ghci.rc driver/ghci/ghci.ico
46 "$(WINDRES)" --preprocessor="$(CPP) -xc -DRC_INVOKED" -o driver/ghci/ghci.res -i driver/ghci/ghci.rc -O coff
47
48 driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER) : driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG)
49 "$(CP)" $< $@
50
51 install : install_driver_ghcii
52
53 .PHONY: install_driver_ghcii
54 install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
55 install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
56 install_driver_ghcii:
57 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
58 $(call removeFiles,"$(GHCII_SCRIPT)")
59 echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
60 echo 'exec "$$(dirname "$$0")"/ghc --interactive "$$@"' >> $(GHCII_SCRIPT)
61 $(EXECUTABLE_FILE) $(GHCII_SCRIPT)
62 cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED)
63 $(EXECUTABLE_FILE) $(GHCII_SCRIPT_VERSIONED)
64
65 endif
66 endif
67