aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Binary.hs2
-rw-r--r--src/FastMutInt.hs2
-rw-r--r--src/HaddockVersion.hs5
-rw-r--r--src/Main.hs39
-rw-r--r--src/Makefile115
5 files changed, 8 insertions, 155 deletions
diff --git a/src/Binary.hs b/src/Binary.hs
index f3bc6477..f1c98620 100644
--- a/src/Binary.hs
+++ b/src/Binary.hs
@@ -1,4 +1,4 @@
-{-# OPTIONS -cpp #-}
+{-# OPTIONS_GHC -cpp -fglasgow-exts #-}
--
-- (c) The University of Glasgow 2002
--
diff --git a/src/FastMutInt.hs b/src/FastMutInt.hs
index 39f4f99b..23001c1f 100644
--- a/src/FastMutInt.hs
+++ b/src/FastMutInt.hs
@@ -1,4 +1,4 @@
-{-# OPTIONS -cpp #-}
+{-# OPTIONS_GHC -cpp -fglasgow-exts #-}
--
-- (c) The University of Glasgow 2002
--
diff --git a/src/HaddockVersion.hs b/src/HaddockVersion.hs
index f3090b4e..4cb94271 100644
--- a/src/HaddockVersion.hs
+++ b/src/HaddockVersion.hs
@@ -8,10 +8,11 @@ module HaddockVersion (
projectName, projectVersion, projectUrl
) where
-import Version ( version )
+import Paths_Haddock ( version )
+import Data.Version ( showVersion )
projectName, projectUrl :: String
projectName = "Haddock"
projectUrl = "http://www.haskell.org/haddock/"
-projectVersion = version
+projectVersion = showVersion version
diff --git a/src/Main.hs b/src/Main.hs
index 0c9cdb0a..bed74040 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -1,3 +1,4 @@
+{-# OPTIONS_GHC -fglasgow-exts #-}
--
-- Haddock - A Haskell Documentation Tool
--
@@ -22,6 +23,7 @@ import HsSyn
import Map ( Map )
import qualified Map hiding ( Map )
import Set
+import Paths_Haddock ( getDataDir )
import Control.Exception ( bracket )
import Control.Monad ( when )
@@ -166,11 +168,7 @@ run flags files = do
verbose = Flag_Verbose `elem` flags
libdir <- case [str | Flag_Lib str <- flags] of
- [] -> do maybe_exec_dir <- getBaseDir
- -- Get directory of executable
- case maybe_exec_dir of
- Nothing -> return "."
- Just dir -> return dir
+ [] -> getDataDir -- provided by Cabal
fs -> return (last fs)
let css_file = case [str | Flag_CSS str <- flags] of
@@ -1404,34 +1402,3 @@ toModuleInfo descriptionOpt =
type ErrMsg = String
type ErrMsgM a = Writer [ErrMsg] a
-
-getBaseDir :: IO (Maybe String)
-#if defined(mingw32_HOST_OS)
-getBaseDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32.
- buf <- mallocArray len
- ret <- getModuleFileName nullPtr buf len
- if ret == 0 then free buf >> return Nothing
- else do s <- peekCString buf
- free buf
- return (Just (rootDir s))
- where
- rootDir s = reverse (dropList "/haddock.exe" (reverse (normalisePath s)))
-
-foreign import stdcall unsafe "GetModuleFileNameA"
- getModuleFileName :: Ptr () -> CString -> Int -> IO Int32
-#else
-getBaseDir :: IO (Maybe String) = do return Nothing
-#endif
-normalisePath :: String -> String
--- Just changes '\' to '/'
-
-#if defined(mingw32_HOST_OS)
-normalisePath xs = subst '\\' '/' xs
-subst a b ls = map (\ x -> if x == a then b else x) ls
-#else
-normalisePath xs = xs
-#endif
-dropList :: [b] -> [a] -> [a]
-dropList [] xs = xs
-dropList _ xs@[] = xs
-dropList (_:xs) (_:ys) = dropList xs ys
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index d97a1276..00000000
--- a/src/Makefile
+++ /dev/null
@@ -1,115 +0,0 @@
-TOP = ..
-include $(TOP)/mk/boilerplate.mk
-
-INSTALLING=1
-
-ghc_ge_504 := $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
-ghc_ge_603 := $(shell if (test $(GhcCanonVersion) -ge 603); then echo YES; else echo NO; fi)
-
-SRC_HC_OPTS += -fglasgow-exts -cpp
-
-# Use hierarchical libraries for GHC >= 5.04
-ifeq "$(ghc_ge_504)" "YES"
-SRC_HC_OPTS += -package network
-# Monad transformers live in their own package for GHC >= 6.3
-ifeq "$(ghc_ge_603)" "YES"
-SRC_HC_OPTS += -package mtl
-endif
-else
-SRC_HC_OPTS += -package data -package text -package util -package net
-endif
-
-ifeq "$(Windows)" "YES"
-HS_PROG_EXT = .exe
-else
-HS_PROG_EXT = .bin
-endif
-
-HS_PROG = haddock$(HS_PROG_EXT)
-
-# Why HOST platform, not TARGET platform??? Confusing...
-ifeq "$(Windows)" "YES"
-Main_HC_OPTS += -Dmingw32_HOST_OS=1
-endif
-
-HsParser_HC_OPTS += -Onot
-HaddockParse_HC_OPTS += -Onot
-
-# -----------------------------------------------------------------------------
-# Create the Version.hs file
-
-VERSION_HS = Version.hs
-EXTRA_SRCS += $(VERSION_HS)
-
-boot :: $(VERSION_HS)
-
-Version.hs : $(TOP)/mk/version.mk
- @$(RM) -f $(VERSION_HS)
- @echo "Creating $(VERSION_HS) ... "
- @echo "module Version where" >>$(VERSION_HS)
- @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS)
-
-# -----------------------------------------------------------------------------
-
-ifeq "$(INSTALLING)" "1"
-ifeq "$(BIN_DIST)" "1"
-HADDOCKLIB=$$\"\"datadir/haddock
-HADDOCKBIN=$$\"\"libexecdir/$(HS_PROG)
-else
-ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
-# --mixed is only provided by newer versions of cygpath (1.2 doesn't have it, for instance.)
-#HADDOCKLIB=$(shell cygpath --mixed $(datadir))
-HADDOCKLIB=$(shell cygpath -w $(datadir) | sed -e 's%\\%/%g')
-else
-HADDOCKLIB=$(datadir)
-endif
-HADDOCKBIN=$(libexecdir)/$(HS_PROG)
-endif # BIN_DIST
-else
-ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
-# See above comment re: --mixed
-#HADDOCKLIB=$(shell cygpath --mixed $(FPTOOLS_TOP_ABS)/haddock/html)
-HADDOCKLIB=$(shell cygpath -w $(FPTOOLS_TOP_ABS)/haddock/html | sed -e 's%\\%/%g')
-else
-HADDOCKLIB=$(FPTOOLS_TOP_ABS)/haddock/html
-endif
-HADDOCKBIN=$(FPTOOLS_TOP_ABS)/haddock/src/$(HS_PROG)
-endif # INSTALLING
-
-HAPPY_OPTS += $(GHC_HAPPY_OPTS)
-
-INSTALLED_SCRIPT_PROG = haddock-$(ProjectVersion)
-INPLACE_SCRIPT_PROG = haddock-inplace
-
-ifeq "$(INSTALLING)" "1"
-TOP_PWD := $(prefix)
-SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
-ifeq "$(Windows)" "NO"
-LINK = haddock
-endif
-else
-TOP_PWD := $(FPTOOLS_TOP_ABS)
-SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
-endif
-
-SCRIPT_OBJS=haddock.sh
-
-INTERP=$(SHELL)
-
-SCRIPT_SUBST_VARS = HADDOCKLIB HADDOCKBIN
-
-# The script isn't installed on MinGW; we run the binary directly
-ifeq "$(Windows)" "NO"
-INSTALL_SCRIPTS += $(SCRIPT_PROG)
-endif
-
-INSTALL_LIBEXECS = $(HS_PROG)
-
-# don't recurse on 'make install'
-#
-ifeq "$(INSTALLING)" "1"
-all clean distclean maintainer-clean ::
- $(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
-endif
-
-include $(TOP)/mk/target.mk