summaryrefslogtreecommitdiff
path: root/driver/ghci/Makefile
blob: 789aec0c215d03315a28f891388eb725a27b322e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.11 2005/05/05 00:58:38 sof Exp $
#

TOP=../..
include $(TOP)/mk/boilerplate.mk

# -----------------------------------------------------------------------------
# ghci script

ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
C_PROG = ghci
C_OBJS += ghci.res
else
C_SRCS=
endif

ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
INSTALL_PROGS    += $(C_PROG)
GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
install::
	$(RM) -f $(GHCII_SCRIPT)
	echo "#!$(SHELL)"                                  >> $(GHCII_SCRIPT)
	echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
	chmod +x $(GHCII_SCRIPT)
else
LINK = ghci
LINK_TARGET = $(LINK)-$(ProjectVersion)
INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET)
install::
	$(RM) -f $(INSTALLED_SCRIPT)
	echo "#!$(SHELL)"                                   >> $(INSTALLED_SCRIPT)
	echo 'exec $(bindir)/ghc --interactive $${1+"$$@"}' >> $(INSTALLED_SCRIPT)
	$(EXECUTABLE_FILE) $(INSTALLED_SCRIPT)
endif

ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
INPLACE_SCRIPT = ghci
INPLACE_GHC = $(FPTOOLS_TOP_ABS)/ghc/stage2-inplace/ghc
CLEAN_FILES += $(INPLACE_SCRIPT)
all::
	$(RM) -f $(INPLACE_SCRIPT)
	echo "#!$(SHELL)"                                    >> $(INPLACE_SCRIPT)
	echo "exec $(INPLACE_GHC) --interactive $${1+"$$@"}" >> $(INPLACE_SCRIPT)
	$(EXECUTABLE_FILE) $(INPLACE_SCRIPT)
endif

ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
ghci.res : ghci.rc ghci.ico
	windres --preprocessor="$(CPP) -xc -DRC_INVOKED" -o ghci.res -i ghci.rc -O coff
endif

include $(TOP)/mk/bindist.mk

include $(TOP)/mk/target.mk