summaryrefslogtreecommitdiff
path: root/driver/ghci
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-04-26 11:42:15 +0000
committerIan Lynagh <igloo@earth.li>2009-04-26 11:42:15 +0000
commit34cc75e1a62638f2833815746ebce0a9114dc26b (patch)
treeef21e8fd7af1356beea9cce7d6efb8a65374e24c /driver/ghci
parent74e1368d4688ee16f6decdf2cd3ebe27506b26ba (diff)
downloadhaskell-34cc75e1a62638f2833815746ebce0a9114dc26b.tar.gz
GHC new build system megapatch
Diffstat (limited to 'driver/ghci')
-rw-r--r--driver/ghci/Makefile66
-rw-r--r--driver/ghci/ghc.mk50
2 files changed, 53 insertions, 63 deletions
diff --git a/driver/ghci/Makefile b/driver/ghci/Makefile
index 47f51b8c23..afb57176fb 100644
--- a/driver/ghci/Makefile
+++ b/driver/ghci/Makefile
@@ -1,63 +1,3 @@
-#-----------------------------------------------------------------------------
-# $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$(exeext)
-C_PROG_VERSIONED = ghci-$(ProjectVersion)$(exeext)
-C_OBJS += ghci.res
-
-all :: $(C_PROG_VERSIONED)
-$(C_PROG_VERSIONED) : $(C_PROG)
- cp $< $@
-else
-C_SRCS=
-endif
-
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-INSTALL_PROGS += $(C_PROG) $(C_PROG_VERSIONED)
-GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
-GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
-install::
- $(RM) -f $(GHCII_SCRIPT)
- echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
- echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
- chmod +x $(GHCII_SCRIPT)
- cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED)
- chmod +x $(GHCII_SCRIPT_VERSIONED)
-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-$(ProjectVersion) --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
+dir = driver/ghci
+TOP = ../..
+include $(TOP)/mk/sub-makefile.mk
diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk
new file mode 100644
index 0000000000..14e27123a7
--- /dev/null
+++ b/driver/ghci/ghc.mk
@@ -0,0 +1,50 @@
+ifneq "$(Windows)" "YES"
+
+install: install_driver_ghci
+
+.PHONY: install_driver_ghci
+install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
+install_driver_ghci:
+ $(MKDIRHIER) $(DESTDIR)$(bindir)
+ $(RM) -f $(WRAPPER)
+ echo '#!$(SHELL)' >> $(WRAPPER)
+ echo 'exec $(bindir)/ghc-$(ProjectVersion) --interactive ${1+"$@"}' >> $(WRAPPER)
+ $(EXECUTABLE_FILE) $(WRAPPER)
+ $(RM) -f $(DESTDIR)$(bindir)/ghci
+ $(LN_S) ghci-$(ProjectVersion) $(DESTDIR)$(bindir)/ghci
+
+else # Windows...
+
+driver/ghci_dist_C_SRCS = ghci.c
+driver/ghci_dist_PROG = ghci$(exeext)
+driver/ghci_dist_INSTALL = YES
+driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res
+
+$(eval $(call build-prog,driver/ghci,dist,0))
+
+driver/ghci_dist_PROG_VER = ghci-$(ProjectVersion)$(exeext)
+
+INSTALL_BINS += driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER)
+
+driver/ghci/ghci.res : driver/ghci/ghci.rc driver/ghci/ghci.ico
+ windres --preprocessor="$(CPP) -xc -DRC_INVOKED" -o driver/ghci/ghci.res -i driver/ghci/ghci.rc -O coff
+
+driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER) : driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG)
+ $(CP) $< $@
+
+install : install_driver_ghcii
+
+.PHONY: install_driver_ghcii
+install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh
+install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh
+install_driver_ghcii:
+ $(MKDIRHIER) $(DESTDIR)$(bindir)
+ $(RM) -f $(GHCII_SCRIPT)
+ echo "#!$(SHELL)" >> $(GHCII_SCRIPT)
+ echo 'exec "$$0"/../ghc --interactive $${1+"$$@"}' >> $(GHCII_SCRIPT)
+ $(EXECUTABLE_FILE) $(GHCII_SCRIPT)
+ cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED)
+ $(EXECUTABLE_FILE) $(GHCII_SCRIPT_VERSIONED)
+
+endif
+