diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-10-04 17:56:11 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-10-04 17:56:11 +0100 |
commit | ed5ebee4df62e438b7d7bcd32b672510c362206e (patch) | |
tree | 7bedff3b6a80517bbe377323923b1e7d676fd258 | |
parent | b9fccbc8bc377cde8e75bce8c78470e3c4fa4018 (diff) | |
parent | 911bc5ce96f54a3be63e6e7dcfa9bc6ccb8495e0 (diff) | |
download | haskell-ed5ebee4df62e438b7d7bcd32b672510c362206e.tar.gz |
Merge branch 'master' of darcs.haskell.org:/home/darcs/ghc
31 files changed, 490 insertions, 307 deletions
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 6b47db3965..0cf98fe3fd 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -1185,13 +1185,6 @@ searchForLibUsingGcc dflags so dirs = do -- ---------------------------------------------------------------------------- -- Loading a dyanmic library (dlopen()-ish on Unix, LoadLibrary-ish on Win32) -mkSOName :: Platform -> FilePath -> FilePath -mkSOName platform root - = case platformOS platform of - OSDarwin -> ("lib" ++ root) <.> "dylib" - OSMinGW32 -> root <.> "dll" - _ -> ("lib" ++ root) <.> "so" - -- Darwin / MacOS X only: load a framework -- a framework is a dynamic library packaged inside a directory of the same -- name. They are searched for in different paths than normal libraries. diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 0566d6ad65..08420efde6 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -371,7 +371,7 @@ linkingNeeded dflags linkables pkg_deps = do | Just c <- map (lookupPackage pkg_map) pkg_deps, lib <- packageHsLibs dflags c ] - pkg_libfiles <- mapM (uncurry findHSLib) pkg_hslibs + pkg_libfiles <- mapM (uncurry (findHSLib dflags)) pkg_hslibs if any isNothing pkg_libfiles then return True else do e_lib_times <- mapM (tryIO . getModificationUTCTime) (catMaybes pkg_libfiles) @@ -408,9 +408,11 @@ ghcLinkInfoSectionName :: String ghcLinkInfoSectionName = ".debug-ghc-link-info" -- if we use the ".debug" prefix, then strip will strip it by default -findHSLib :: [String] -> String -> IO (Maybe FilePath) -findHSLib dirs lib = do - let batch_lib_file = "lib" ++ lib <.> "a" +findHSLib :: DynFlags -> [String] -> String -> IO (Maybe FilePath) +findHSLib dflags dirs lib = do + let batch_lib_file = if dopt Opt_Static dflags + then "lib" ++ lib <.> "a" + else mkSOName (targetPlatform dflags) lib found <- filterM doesFileExist (map (</> batch_lib_file) dirs) case found of [] -> return Nothing @@ -1662,13 +1664,24 @@ linkBinary dflags o_files dep_packages = do -- explicit packages with the auto packages and all of their -- dependencies, and eliminating duplicates. + full_output_fn <- if isAbsolute output_fn + then return output_fn + else do d <- getCurrentDirectory + return $ normalise (d </> output_fn) pkg_lib_paths <- getPackageLibraryPath dflags dep_packages - let pkg_lib_path_opts = concat (map get_pkg_lib_path_opts pkg_lib_paths) + let pkg_lib_path_opts = concatMap get_pkg_lib_path_opts pkg_lib_paths get_pkg_lib_path_opts l | osElfTarget (platformOS platform) && dynLibLoader dflags == SystemDependent && not (dopt Opt_Static dflags) - = ["-L" ++ l, "-Wl,-rpath", "-Wl," ++ l] + = let libpath = if dopt Opt_RelativeDynlibPaths dflags + then "$ORIGIN" </> + (l `makeRelativeTo` full_output_fn) + else l + rpath = if dopt Opt_RPath dflags + then ["-Wl,-rpath", "-Wl," ++ libpath] + else [] + in ["-L" ++ l, "-Wl,-rpath-link", "-Wl," ++ l] ++ rpath | otherwise = ["-L" ++ l] let lib_paths = libraryPaths dflags diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 7ae46532c5..ccaf814dbf 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -339,6 +339,8 @@ data DynFlag | Opt_SccProfilingOn | Opt_Ticky | Opt_Static + | Opt_RPath + | Opt_RelativeDynlibPaths | Opt_Hpc -- output style opts @@ -768,15 +770,18 @@ pgm_lc dflags = sPgm_lc (settings dflags) opt_L :: DynFlags -> [String] opt_L dflags = sOpt_L (settings dflags) opt_P :: DynFlags -> [String] -opt_P dflags = sOpt_P (settings dflags) +opt_P dflags = concatMap (wayOptP (targetPlatform dflags)) (ways dflags) + ++ sOpt_P (settings dflags) opt_F :: DynFlags -> [String] opt_F dflags = sOpt_F (settings dflags) opt_c :: DynFlags -> [String] -opt_c dflags = sOpt_c (settings dflags) +opt_c dflags = concatMap (wayOptc (targetPlatform dflags)) (ways dflags) + ++ sOpt_c (settings dflags) opt_a :: DynFlags -> [String] opt_a dflags = sOpt_a (settings dflags) opt_l :: DynFlags -> [String] -opt_l dflags = sOpt_l (settings dflags) +opt_l dflags = concatMap (wayOptl (targetPlatform dflags)) (ways dflags) + ++ sOpt_l (settings dflags) opt_windres :: DynFlags -> [String] opt_windres dflags = sOpt_windres (settings dflags) opt_lo :: DynFlags -> [String] @@ -812,13 +817,6 @@ data HscTarget | HscNothing -- ^ Don't generate any code. See notes above. deriving (Eq, Show) -showHscTargetFlag :: HscTarget -> String -showHscTargetFlag HscC = "-fvia-c" -showHscTargetFlag HscAsm = "-fasm" -showHscTargetFlag HscLlvm = "-fllvm" -showHscTargetFlag HscInterpreted = "-fbyte-code" -showHscTargetFlag HscNothing = "-fno-code" - -- | Will this target result in an object file on the disk? isObjectTarget :: HscTarget -> Bool isObjectTarget HscC = True @@ -969,8 +967,6 @@ wayTag WayDyn = "dyn" wayTag WayProf = "p" wayTag WayEventLog = "l" wayTag WayPar = "mp" --- wayTag WayPar = "mt" --- wayTag WayPar = "md" wayTag WayGran = "mg" wayTag WayNDP = "ndp" @@ -981,8 +977,6 @@ wayRTSOnly WayDyn = False wayRTSOnly WayProf = False wayRTSOnly WayEventLog = True wayRTSOnly WayPar = False --- wayRTSOnly WayPar = False --- wayRTSOnly WayPar = False wayRTSOnly WayGran = False wayRTSOnly WayNDP = False @@ -993,33 +987,14 @@ wayDesc WayDyn = "Dynamic" wayDesc WayProf = "Profiling" wayDesc WayEventLog = "RTS Event Logging" wayDesc WayPar = "Parallel" --- wayDesc WayPar = "Parallel ticky profiling" --- wayDesc WayPar = "Distributed" wayDesc WayGran = "GranSim" wayDesc WayNDP = "Nested data parallelism" -wayOpts :: Platform -> Way -> DynP () -wayOpts platform WayThreaded = do - -- FreeBSD's default threading library is the KSE-based M:N libpthread, - -- which GHC has some problems with. It's currently not clear whether - -- the problems are our fault or theirs, but it seems that using the - -- alternative 1:1 threading library libthr works around it: - let os = platformOS platform - case os of - OSFreeBSD -> upd $ addOptl "-lthr" - OSSolaris2 -> upd $ addOptl "-lrt" - _ - | os `elem` [OSOpenBSD, OSNetBSD] -> - do upd $ addOptc "-pthread" - upd $ addOptl "-pthread" - _ -> - return () -wayOpts _ WayDebug = return () -wayOpts platform WayDyn = do - upd $ addOptP "-DDYNAMIC" - upd $ addOptc "-DDYNAMIC" - let os = platformOS platform - case os of +wayExtras :: Platform -> Way -> DynP () +wayExtras _ WayThreaded = return () +wayExtras _ WayDebug = return () +wayExtras platform WayDyn = + case platformOS platform of OSMinGW32 -> -- On Windows, code that is to be linked into a dynamic -- library must be compiled with -fPIC. Labels not in @@ -1028,59 +1003,69 @@ wayOpts platform WayDyn = do setFPIC OSDarwin -> setFPIC - _ | os `elem` [OSOpenBSD, OSNetBSD] -> - -- Without this, linking the shared libHSffi fails - -- because it uses pthread mutexes. - upd $ addOptl "-optl-pthread" _ -> return () -wayOpts _ WayProf = do - setDynFlag Opt_SccProfilingOn - upd $ addOptP "-DPROFILING" - upd $ addOptc "-DPROFILING" -wayOpts _ WayEventLog = do - upd $ addOptP "-DTRACING" - upd $ addOptc "-DTRACING" -wayOpts _ WayPar = do - setDynFlag Opt_Parallel - upd $ addOptP "-D__PARALLEL_HASKELL__" - upd $ addOptc "-DPAR" - exposePackage "concurrent" - upd $ addOptc "-w" - upd $ addOptl "-L${PVM_ROOT}/lib/${PVM_ARCH}" - upd $ addOptl "-lpvm3" - upd $ addOptl "-lgpvm3" -{- -wayOpts WayPar = - [ "-fparallel" - , "-D__PARALLEL_HASKELL__" - , "-optc-DPAR" - , "-optc-DPAR_TICKY" - , "-package concurrent" - , "-optc-w" - , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}" - , "-optl-lpvm3" - , "-optl-lgpvm3" ] -wayOpts WayPar = - [ "-fparallel" - , "-D__PARALLEL_HASKELL__" - , "-D__DISTRIBUTED_HASKELL__" - , "-optc-DPAR" - , "-optc-DDIST" - , "-package concurrent" - , "-optc-w" - , "-optl-L${PVM_ROOT}/lib/${PVM_ARCH}" - , "-optl-lpvm3" - , "-optl-lgpvm3" ] --} -wayOpts _ WayGran = do - setDynFlag Opt_GranMacros - upd $ addOptP "-D__GRANSIM__" - upd $ addOptc "-DGRAN" - exposePackage "concurrent" -wayOpts _ WayNDP = do - setExtensionFlag Opt_ParallelArrays - setDynFlag Opt_Vectorise +wayExtras _ WayProf = setDynFlag Opt_SccProfilingOn +wayExtras _ WayEventLog = return () +wayExtras _ WayPar = do setDynFlag Opt_Parallel + exposePackage "concurrent" +wayExtras _ WayGran = do setDynFlag Opt_GranMacros + exposePackage "concurrent" +wayExtras _ WayNDP = do setExtensionFlag Opt_ParallelArrays + setDynFlag Opt_Vectorise + +wayOptc :: Platform -> Way -> [String] +wayOptc platform WayThreaded = case platformOS platform of + OSOpenBSD -> ["-pthread"] + OSNetBSD -> ["-pthread"] + _ -> [] +wayOptc _ WayDebug = [] +wayOptc _ WayDyn = ["-DDYNAMIC"] +wayOptc _ WayProf = ["-DPROFILING"] +wayOptc _ WayEventLog = ["-DTRACING"] +wayOptc _ WayPar = ["-DPAR", "-w"] +wayOptc _ WayGran = ["-DGRAN"] +wayOptc _ WayNDP = [] + +wayOptl :: Platform -> Way -> [String] +wayOptl platform WayThreaded = + case platformOS platform of + -- FreeBSD's default threading library is the KSE-based M:N libpthread, + -- which GHC has some problems with. It's currently not clear whether + -- the problems are our fault or theirs, but it seems that using the + -- alternative 1:1 threading library libthr works around it: + OSFreeBSD -> ["-lthr"] + OSSolaris2 -> ["-lrt"] + OSOpenBSD -> ["-pthread"] + OSNetBSD -> ["-pthread"] + _ -> [] +wayOptl _ WayDebug = [] +wayOptl platform WayDyn = + case platformOS platform of + OSOpenBSD -> -- Without this, linking the shared libHSffi fails + -- because it uses pthread mutexes. + ["-optl-pthread"] + OSNetBSD -> -- Without this, linking the shared libHSffi fails + -- because it uses pthread mutexes. + ["-optl-pthread"] + _ -> [] +wayOptl _ WayProf = [] +wayOptl _ WayEventLog = [] +wayOptl _ WayPar = ["-L${PVM_ROOT}/lib/${PVM_ARCH}", + "-lpvm3", + "-lgpvm3"] +wayOptl _ WayGran = [] +wayOptl _ WayNDP = [] + +wayOptP :: Platform -> Way -> [String] +wayOptP _ WayThreaded = [] +wayOptP _ WayDebug = [] +wayOptP _ WayDyn = ["-DDYNAMIC"] +wayOptP _ WayProf = ["-DPROFILING"] +wayOptP _ WayEventLog = ["-DTRACING"] +wayOptP _ WayPar = ["-D__PARALLEL_HASKELL__"] +wayOptP _ WayGran = ["-D__GRANSIM__"] +wayOptP _ WayNDP = [] ----------------------------------------------------------------------------- @@ -1177,7 +1162,7 @@ defaultDynFlags mySettings = dirsToClean = panic "defaultDynFlags: No dirsToClean", generatedDumps = panic "defaultDynFlags: No generatedDumps", haddockOptions = Nothing, - flags = IntSet.fromList (map fromEnum (defaultFlags (sTargetPlatform mySettings))), + flags = IntSet.fromList (map fromEnum (defaultFlags mySettings)), warningFlags = IntSet.fromList (map fromEnum standardWarnings), ghciScripts = [], language = Nothing, @@ -1678,7 +1663,9 @@ parseDynamicFlagsFull activeFlags cmdline dflags0 args = do ghcError (CmdLineError ("combination not supported: " ++ intercalate "/" (map wayDesc theWays))) - return (dflags3, leftover, sh_warns ++ warns) + let (dflags4, consistency_warnings) = makeDynFlagsConsistent dflags3 + + return (dflags4, leftover, consistency_warnings ++ sh_warns ++ warns) -- | Check (and potentially disable) any extensions that aren't allowed @@ -1790,15 +1777,13 @@ dynamic_flags = [ -- is required to get the RTS ticky support. ----- Linker -------------------------------------------------------- - -- -static is the default. If -dynamic has been given then, due to the - -- way wayOpts is currently used, we've already set -DDYNAMIC etc. - -- It's too fiddly to undo that, so we just give an error if - -- Opt_Static has been unset. - , Flag "static" (noArgM (\dfs -> do unless (dopt Opt_Static dfs) (addErr "Can't use -static after -dynamic") - return dfs)) - , Flag "dynamic" (NoArg (unSetDynFlag Opt_Static >> addWay WayDyn)) + , Flag "static" (NoArg (do setDynFlag Opt_Static + removeWay WayDyn)) + , Flag "dynamic" (NoArg (do unSetDynFlag Opt_Static + addWay WayDyn)) -- ignored for compat w/ gcc: , Flag "rdynamic" (NoArg (return ())) + , Flag "relative-dynlib-paths" (NoArg (setDynFlag Opt_RelativeDynlibPaths)) ------- Specific phases -------------------------------------------- -- need to appear before -pgmL to be parsed as LLVM flags. @@ -2290,7 +2275,8 @@ fFlags = [ ( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ), ( "prof-count-entries", Opt_ProfCountEntries, nop ), ( "prof-cafs", Opt_AutoSccsOnIndividualCafs, nop ), - ( "hpc", Opt_Hpc, nop ) + ( "hpc", Opt_Hpc, nop ), + ( "use-rpaths", Opt_RPath, nop ) ] -- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@ @@ -2456,10 +2442,9 @@ xFlags = [ ( "TypeHoles", Opt_TypeHoles, nop ) ] -defaultFlags :: Platform -> [DynFlag] -defaultFlags platform +defaultFlags :: Settings -> [DynFlag] +defaultFlags settings = [ Opt_AutoLinkPackages, - Opt_Static, Opt_SharedImplib, @@ -2471,7 +2456,8 @@ defaultFlags platform Opt_GhciSandbox, Opt_GhciHistory, Opt_HelpfulErrors, - Opt_ProfCountEntries + Opt_ProfCountEntries, + Opt_RPath ] ++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns] @@ -2484,6 +2470,12 @@ defaultFlags platform _ -> [] _ -> []) + ++ (if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings) + then [] + else [Opt_Static]) + + where platform = sTargetPlatform settings + impliedFlags :: [(ExtensionFlag, TurnOnFlag, ExtensionFlag)] impliedFlags = [ (Opt_RankNTypes, turnOn, Opt_ExplicitForAll) @@ -2747,7 +2739,10 @@ setDumpFlag dump_flag = NoArg (setDumpFlag' dump_flag) addWay :: Way -> DynP () addWay w = do upd (\dfs -> dfs { ways = w : ways dfs }) dfs <- liftEwM getCmdLineState - wayOpts (targetPlatform dfs) w + wayExtras (targetPlatform dfs) w + +removeWay :: Way -> DynP () +removeWay w = upd (\dfs -> dfs { ways = filter (w /=) (ways dfs) }) -------------------------- setDynFlag, unSetDynFlag :: DynFlag -> DynP () @@ -2881,59 +2876,16 @@ setObjTarget l = updM set where set dflags | isObjectTarget (hscTarget dflags) - = case l of - HscC - | platformUnregisterised (targetPlatform dflags) -> - do addWarn ("Compiler not unregisterised, so ignoring " ++ flag) - return dflags - HscAsm - | cGhcWithNativeCodeGen /= "YES" -> - do addWarn ("Compiler has no native codegen, so ignoring " ++ - flag) - return dflags - HscLlvm - | not ((arch == ArchX86_64) && (os == OSLinux || os == OSDarwin)) && - (not (dopt Opt_Static dflags) || dopt Opt_PIC dflags) - -> - do addWarn ("Ignoring " ++ flag ++ " as it is incompatible with -fPIC and -dynamic on this platform") - return dflags - _ -> return $ dflags { hscTarget = l } + = return $ dflags { hscTarget = l } | otherwise = return dflags - where platform = targetPlatform dflags - arch = platformArch platform - os = platformOS platform - flag = showHscTargetFlag l setFPIC :: DynP () setFPIC = updM set - where - set dflags - | cGhcWithNativeCodeGen == "YES" || platformUnregisterised (targetPlatform dflags) - = let platform = targetPlatform dflags - in case hscTarget dflags of - HscLlvm - | (platformArch platform == ArchX86_64) && - (platformOS platform `elem` [OSLinux, OSDarwin]) -> - do addWarn "Ignoring -fPIC as it is incompatible with LLVM on this platform" - return dflags - _ -> return $ dopt_set dflags Opt_PIC - | otherwise - = ghcError $ CmdLineError "-fPIC is not supported on this platform" + where set dflags = return $ dopt_set dflags Opt_PIC unSetFPIC :: DynP () unSetFPIC = updM set - where - set dflags - = let platform = targetPlatform dflags - in case platformOS platform of - OSDarwin - | platformArch platform == ArchX86_64 -> - do addWarn "Ignoring -fno-PIC on this platform" - return dflags - _ | not (dopt Opt_Static dflags) -> - do addWarn "Ignoring -fno-PIC as -fstatic is off" - return dflags - _ -> return $ dopt_unset dflags Opt_PIC + where set dflags = return $ dopt_unset dflags Opt_PIC setOptLevel :: Int -> DynFlags -> DynP DynFlags setOptLevel n dflags @@ -3145,6 +3097,8 @@ compilerInfo dflags ("Support SMP", cGhcWithSMP), ("Tables next to code", cGhcEnableTablesNextToCode), ("RTS ways", cGhcRTSWays), + ("Dynamic by default", if dYNAMIC_BY_DEFAULT dflags + then "YES" else "NO"), ("Leading underscore", cLeadingUnderscore), ("Debug on", show debugIsOn), ("LibDir", topDir dflags), @@ -3184,3 +3138,48 @@ tARGET_MAX_WORD dflags 8 -> toInteger (maxBound :: Word64) w -> panic ("tARGET_MAX_WORD: Unknown platformWordSize: " ++ show w) +-- Whenever makeDynFlagsConsistent does anything, it starts over, to +-- ensure that a later change doesn't invalidate an earlier check. +-- Be careful not to introduce potential loops! +makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String]) +makeDynFlagsConsistent dflags + | hscTarget dflags == HscC && + not (platformUnregisterised (targetPlatform dflags)) + = if cGhcWithNativeCodeGen == "YES" + then let dflags' = dflags { hscTarget = HscAsm } + warn = "Compiler not unregisterised, so using native code generator rather than compiling via C" + in loop dflags' warn + else let dflags' = dflags { hscTarget = HscLlvm } + warn = "Compiler not unregisterised, so using LLVM rather than compiling via C" + in loop dflags' warn + | hscTarget dflags /= HscC && + platformUnregisterised (targetPlatform dflags) + = loop (dflags { hscTarget = HscC }) + "Compiler unregisterised, so compiling via C" + | hscTarget dflags == HscAsm && + cGhcWithNativeCodeGen /= "YES" + = let dflags' = dflags { hscTarget = HscLlvm } + warn = "No native code generator, so using LLVM" + in loop dflags' warn + | hscTarget dflags == HscLlvm && + not ((arch == ArchX86_64) && (os == OSLinux || os == OSDarwin)) && + (not (dopt Opt_Static dflags) || dopt Opt_PIC dflags) + = if cGhcWithNativeCodeGen == "YES" + then let dflags' = dflags { hscTarget = HscAsm } + warn = "Using native code generator rather than LLVM, as LLVM is incompatible with -fPIC and -dynamic on this platform" + in loop dflags' warn + else ghcError $ CmdLineError "Can't use -fPIC or -dynamic on this platform" + | os == OSDarwin && + arch == ArchX86_64 && + not (dopt Opt_PIC dflags) + = loop (dopt_set dflags Opt_PIC) + "Enabling -fPIC as it is always on for this platform" + | otherwise = (dflags, []) + where loc = mkGeneralSrcSpan (fsLit "when making flags consistent") + loop updated_dflags warning + = case makeDynFlagsConsistent updated_dflags of + (dflags', ws) -> (dflags', L loc warning : ws) + platform = targetPlatform dflags + arch = platformArch platform + os = platformOS platform + diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index 7c1f169440..ec5f6ee792 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -37,6 +37,8 @@ module HscTypes ( PackageInstEnv, PackageRuleBase, + mkSOName, + -- * Annotations prepareAnnotations, @@ -157,6 +159,7 @@ import Fingerprint import MonadUtils import Bag import ErrUtils +import Platform import Util import Control.Monad ( mplus, guard, liftM, when ) @@ -1778,6 +1781,15 @@ type OrigNameCache = ModuleEnv (OccEnv Name) \end{code} +\begin{code} +mkSOName :: Platform -> FilePath -> FilePath +mkSOName platform root + = case platformOS platform of + OSDarwin -> ("lib" ++ root) <.> "dylib" + OSMinGW32 -> root <.> "dll" + _ -> ("lib" ++ root) <.> "so" +\end{code} + %************************************************************************ %* * diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 87171545f8..f9927de2f0 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -87,6 +87,7 @@ module Util ( escapeSpaces, parseSearchPath, Direction(..), reslash, + makeRelativeTo, -- * Utils for defining Data instances abstractConstr, abstractDataType, mkNoRepType, @@ -1006,6 +1007,17 @@ reslash d = f slash = case d of Forwards -> '/' Backwards -> '\\' + +makeRelativeTo :: FilePath -> FilePath -> FilePath +this `makeRelativeTo` that = directory </> thisFilename + where (thisDirectory, thisFilename) = splitFileName this + thatDirectory = dropFileName that + directory = joinPath $ f (splitPath thisDirectory) + (splitPath thatDirectory) + + f (x : xs) (y : ys) + | x == y = f xs ys + f xs ys = replicate (length ys) ".." ++ xs \end{code} %************************************************************************ diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 280d9e3f34..b438bf5cbd 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -18,7 +18,7 @@ dnl-------------------------------------------------------------------- FP_GMP -bootstrap_target=`ghc/stage2/build/tmp/ghc-stage2 +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'` +bootstrap_target=@TargetPlatform@ FPTOOLS_SET_PLATFORM_VARS BuildingCrossCompiler=NO diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk index 88c6aafeca..7220090696 100644 --- a/driver/ghci/ghc.mk +++ b/driver/ghci/ghc.mk @@ -32,6 +32,7 @@ driver/ghci_dist_C_SRCS = ghci.c ../utils/cwrapper.c ../utils/getLocation.c driver/ghci_dist_CC_OPTS += -I driver/utils driver/ghci_dist_PROG = ghci$(exeext) driver/ghci_dist_INSTALL = YES +driver/ghci_dist_INSTALL_INPLACE = YES driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res $(eval $(call build-prog,driver/ghci,dist,1)) @@ -796,57 +796,53 @@ TAGS: TAGS_compiler # Installation install: install_libs install_packages install_libexecs \ - install_libexec_scripts install_bins install_topdirs + install_bins install_topdirs ifeq "$(HADDOCK_DOCS)" "YES" install: install_docs endif -install_bins: $(INSTALL_BINS) - $(call INSTALL_DIR,"$(DESTDIR)$(bindir)") - for i in $(INSTALL_BINS); do \ - $(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(bindir)") ; \ - done - -install_libs: $(INSTALL_LIBS) - $(call INSTALL_DIR,"$(DESTDIR)$(ghclibdir)") - for i in $(INSTALL_LIBS); do \ +define installLibsTo +# $1 = libraries to install +# $2 = directory to install to + $(call INSTALL_DIR,$2) + for i in $1; do \ case $$i in \ *.a) \ - $(call INSTALL_DATA,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)"); \ + $(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \ $(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \ *.dll) \ - $(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)") ; \ - $(STRIP_CMD) "$(DESTDIR)$(ghclibdir)"/$$i ;; \ + $(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \ + $(STRIP_CMD) $2/$$i ;; \ *.so) \ - $(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)") ;; \ + $(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,$2) ;; \ *.dylib) \ - $(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)");; \ + $(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,$2);; \ *) \ - $(call INSTALL_DATA,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)"); \ + $(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \ esac; \ done +endef -install_libexec_scripts: $(INSTALL_LIBEXEC_SCRIPTS) -ifeq "$(INSTALL_LIBEXEC_SCRIPTS)" "" - @: -else - $(call INSTALL_DIR,"$(DESTDIR)$(ghclibexecdir)") - for i in $(INSTALL_LIBEXEC_SCRIPTS); do \ - $(call INSTALL_SCRIPT,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)"); \ +install_bins: $(INSTALL_BINS) + $(call INSTALL_DIR,"$(DESTDIR)$(bindir)") + for i in $(INSTALL_BINS); do \ + $(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(bindir)") ; \ done -endif + +install_libs: $(INSTALL_LIBS) + $(call installLibsTo, $(INSTALL_LIBS), "$(DESTDIR)$(ghclibdir)") install_libexecs: $(INSTALL_LIBEXECS) ifeq "$(INSTALL_LIBEXECS)" "" @: else - $(call INSTALL_DIR,"$(DESTDIR)$(ghclibexecdir)") + $(call INSTALL_DIR,"$(DESTDIR)$(ghclibexecdir)/bin") for i in $(INSTALL_LIBEXECS); do \ - $(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)"); \ + $(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(ghclibexecdir)/bin"); \ done # We rename ghc-stage2, so that the right program name is used in error # messages etc. - "$(MV)" "$(DESTDIR)$(ghclibexecdir)/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/ghc" + "$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc" endif install_topdirs: $(INSTALL_TOPDIRS) @@ -884,8 +880,8 @@ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d # Install packages in the right order, so that ghc-pkg doesn't complain. # Also, install ghc-pkg first. ifeq "$(Windows)" "NO" -INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/ghc -INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/ghc-pkg +INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc +INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg else INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe @@ -914,14 +910,29 @@ install_packages: rts/package.conf.install $(call INSTALL_DIR,"$(DESTDIR)$(topdir)") $(call removeTrees,"$(INSTALLED_PACKAGE_CONF)") $(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)") + $(call INSTALL_DIR,"$(DESTDIR)$(topdir)/rts-1.0") + $(call installLibsTo, $(RTS_INSTALL_LIBS), "$(DESTDIR)$(topdir)/rts-1.0") +ifeq "$(DYNAMIC_BY_DEFAULT)" "YES" + $(foreach p, $(PKGS_THAT_ARE_INTREE_ONLY), \ + $(call installLibsTo, $(wildcard libraries/$p/dist-install/build/*.so libraries/$p/dist-install/build/*.dll libraries/$p/dist-install/build/*.dylib), "$(DESTDIR)$(topdir)/$p-$(libraries/$p_dist-install_VERSION)")) +endif + $(foreach p, $(INSTALLED_PKG_DIRS), \ + $(call make-command, \ + CROSS_COMPILE="$(CrossCompilePrefix)" \ + "$(GHC_CABAL_INPLACE)" copy \ + "$(STRIP_CMD)" \ + $p $(INSTALL_DISTDIR_$p) \ + '$(DESTDIR)' \ + '$(prefix)' \ + '$(ghclibdir)' \ + '$(docdir)/html/libraries')) "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install $(foreach p, $(INSTALLED_PKG_DIRS), \ $(call make-command, \ - CROSS_COMPILE="$(CrossCompilePrefix)" \ - "$(GHC_CABAL_INPLACE)" install \ + CROSS_COMPILE="$(CrossCompilePrefix)" \ + "$(GHC_CABAL_INPLACE)" register \ "$(INSTALLED_GHC_REAL)" \ "$(INSTALLED_GHC_PKG_REAL)" \ - "$(STRIP_CMD)" \ "$(DESTDIR)$(topdir)" \ $p $(INSTALL_DISTDIR_$p) \ '$(DESTDIR)' \ @@ -977,6 +988,7 @@ $(eval $(call bindist,.,\ $(wildcard libraries/*/dist-install/doc/) \ $(wildcard libraries/*/*/dist-install/doc/) \ $(filter-out settings,$(INSTALL_LIBS)) \ + $(RTS_INSTALL_LIBS) \ $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \ mk/project.mk \ mk/install.mk.in \ diff --git a/ghc/ghc.mk b/ghc/ghc.mk index e177b9274c..ac8ce66245 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -77,6 +77,9 @@ ghc_stage3_SHELL_WRAPPER = YES ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper +ghc_stage1_INSTALL_INPLACE = YES +ghc_stage2_INSTALL_INPLACE = YES +ghc_stage3_INSTALL_INPLACE = YES ghc_stage$(INSTALL_GHC_STAGE)_INSTALL = YES ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion) diff --git a/includes/ghc.mk b/includes/ghc.mk index 065dd0a60b..dd38a6d6c0 100644 --- a/includes/ghc.mk +++ b/includes/ghc.mk @@ -44,6 +44,10 @@ ifneq "$(GhcWithSMP)" "YES" includes_CC_OPTS += -DNOSMP endif +ifeq "$(DYNAMIC_BY_DEFAULT)" "YES" +includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT +endif + ifneq "$(BINDIST)" "YES" ifeq "$(PORTING_HOST)" "YES" @@ -148,6 +152,7 @@ else includes_dist-derivedconstants_C_SRCS = mkDerivedConstants.c includes_dist-derivedconstants_PROG = mkDerivedConstants$(exeext) +includes_dist-derivedconstants_INSTALL_INPLACE = YES $(eval $(call build-prog,includes,dist-derivedconstants,0)) diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c index 199e2edeb6..a58c500928 100644 --- a/includes/mkDerivedConstants.c +++ b/includes/mkDerivedConstants.c @@ -776,6 +776,14 @@ main(int argc, char *argv[]) #endif ); + constantBool("dYNAMIC_BY_DEFAULT", +#ifdef DYNAMIC_BY_DEFAULT + 1 +#else + 0 +#endif + ); + constantInt("lDV_SHIFT", LDV_SHIFT); constantInteger("iLDV_CREATE_MASK", LDV_CREATE_MASK); constantInteger("iLDV_STATE_CREATE", LDV_STATE_CREATE); diff --git a/mk/config.mk.in b/mk/config.mk.in index 0005ab00ef..93618a9702 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -129,6 +129,12 @@ endif PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),\ $(SharedLibsPlatformList)),YES,NO) +SharedLibsByDefaultPlatformList = \ + x86_64-unknown-linux + +DYNAMIC_BY_DEFAULT = $(if $(filter $(TARGETPLATFORM),\ + $(SharedLibsByDefaultPlatformList)),YES,NO) + # Build a compiler that will build *unregisterised* libraries and # binaries by default. Unregisterised code is supposed to compile and # run without any support for architecture-specific assembly mangling, @@ -261,7 +267,7 @@ endif # (see GhcWithSMP). GhcRTSWays += thr thr_debug thr_l GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),thr_p,) -GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)),dyn debug_dyn thr_dyn thr_debug_dyn,) +GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)),dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn,) # We can only build GHCi threaded if we have a threaded RTS: GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO) diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk index a94d2b620b..4baf02ab43 100644 --- a/mk/validate-settings.mk +++ b/mk/validate-settings.mk @@ -26,8 +26,13 @@ GhcStage2HcOpts += -O -fwarn-tabs -dcore-lint # running of the tests, and faster building of the utils to be installed GhcLibHcOpts += -O -dcore-lint + +# We define DefaultFastGhcLibWays in this style so that the value is +# correct even if the user alters DYNAMIC_BY_DEFAULT +DefaultFastGhcLibWays = $(if $(filter $(DYNAMIC_BY_DEFAULT),YES),v dyn,v) + ifeq "$(ValidateSpeed)" "FAST" -GhcLibWays := v +GhcLibWays = $(DefaultFastGhcLibWays) else GhcLibWays := $(filter v dyn,$(GhcLibWays)) endif diff --git a/mk/ways.mk b/mk/ways.mk index c2dcf072fb..2c125e6b7f 100644 --- a/mk/ways.mk +++ b/mk/ways.mk @@ -22,7 +22,7 @@ # # The ways currently defined. # -ALL_WAYS=v p t l s mp mg debug dyn thr thr_l debug_dyn thr_dyn thr_debug_dyn thr_p thr_debug debug_p thr_debug_p +ALL_WAYS=v p t l s mp mg debug dyn thr thr_l debug_dyn thr_dyn thr_debug_dyn thr_p thr_debug debug_p thr_debug_p l_dyn thr_l_dyn # # The following ways currently have treated specially, p t mg, @@ -34,23 +34,23 @@ ALL_WAYS=v p t l s mp mg debug dyn thr thr_l debug_dyn thr_dyn thr_debug_dyn thr # Way 'v': WAY_v_NAME=vanilla -WAY_v_HC_OPTS= +WAY_v_HC_OPTS= -static # Way 'p': WAY_p_NAME=profiling -WAY_p_HC_OPTS= -prof +WAY_p_HC_OPTS= -static -prof # Way 'l': WAY_l_NAME=event logging -WAY_l_HC_OPTS= -eventlog +WAY_l_HC_OPTS= -static -eventlog # Way `mp': WAY_mp_NAME=parallel -WAY_mp_HC_OPTS=-parallel +WAY_mp_HC_OPTS= -static -parallel # Way `mg': WAY_mg_NAME=GranSim -WAY_mg_HC_OPTS=-gransim +WAY_mg_HC_OPTS= -static -gransim # # These ways apply to the RTS only: @@ -58,31 +58,31 @@ WAY_mg_HC_OPTS=-gransim # Way 'thr': WAY_thr_NAME=threaded -WAY_thr_HC_OPTS=-optc-DTHREADED_RTS +WAY_thr_HC_OPTS= -static -optc-DTHREADED_RTS # Way 'thr_p': WAY_thr_p_NAME=threaded profiled -WAY_thr_p_HC_OPTS=-optc-DTHREADED_RTS -prof +WAY_thr_p_HC_OPTS= -static -optc-DTHREADED_RTS -prof # Way 'thr_l': WAY_thr_l_NAME=threaded event logging -WAY_thr_l_HC_OPTS=-optc-DTHREADED_RTS -eventlog +WAY_thr_l_HC_OPTS= -static -optc-DTHREADED_RTS -eventlog # Way 'debug': WAY_debug_NAME=debug -WAY_debug_HC_OPTS=-optc-DDEBUG +WAY_debug_HC_OPTS= -static -optc-DDEBUG # Way 'debug_p': WAY_debug_p_NAME=debug profiled -WAY_debug_p_HC_OPTS=-optc-DDEBUG -prof +WAY_debug_p_HC_OPTS= -static -optc-DDEBUG -prof # Way 'thr_debug': WAY_thr_debug_NAME=threaded -WAY_thr_debug_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG +WAY_thr_debug_HC_OPTS= -static -optc-DTHREADED_RTS -optc-DDEBUG # Way 'thr_debug_p': WAY_thr_debug_p_NAME=threaded debug profiling -WAY_thr_debug_p_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -prof +WAY_thr_debug_p_HC_OPTS= -static -optc-DTHREADED_RTS -optc-DDEBUG -prof # Way 'dyn': build dynamic shared libraries WAY_dyn_NAME=dyn @@ -93,9 +93,18 @@ WAY_thr_dyn_NAME=thr_dyn WAY_thr_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS # Way 'thr_debug_dyn': -WAY_thr_debug_dyn_NAME=thr_dyn +WAY_thr_debug_dyn_NAME=thr_debug_dyn WAY_thr_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS -optc-DDEBUG # Way 'debug_dyn': -WAY_debug_dyn_NAME=thr_dyn +WAY_debug_dyn_NAME=debug_dyn WAY_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DDEBUG + +# Way 'l_dyn': +WAY_l_dyn_NAME=event logging dynamic +WAY_l_dyn_HC_OPTS= -fPIC -dynamic -eventlog + +# Way 'thr_l_dyn': +WAY_thr_l_dyn_NAME=threaded event logging dynamic +WAY_thr_l_dyn_HC_OPTS= -fPIC -dynamic -optc-DTHREADED_RTS -eventlog + diff --git a/rts/ghc.mk b/rts/ghc.mk index 9fdf6bebb5..726199e455 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -508,9 +508,9 @@ endif # ----------------------------------------------------------------------------- # installing -INSTALL_LIBS += $(ALL_RTS_LIBS) -INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*) -INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL)) +RTS_INSTALL_LIBS += $(ALL_RTS_LIBS) +RTS_INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*) +RTS_INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL)) install: install_libffi_headers diff --git a/rts/package.conf.in b/rts/package.conf.in index 9068549e21..9fc87211f5 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -16,7 +16,7 @@ hidden-modules: import-dirs: #ifdef INSTALLING -library-dirs: LIB_DIR PAPI_LIB_DIR +library-dirs: LIB_DIR"/rts-1.0" PAPI_LIB_DIR #else /* !INSTALLING */ library-dirs: TOP"/rts/dist/build" PAPI_LIB_DIR #endif diff --git a/rules/build-package.mk b/rules/build-package.mk index c97f8c4b2c..d21f449d93 100644 --- a/rules/build-package.mk +++ b/rules/build-package.mk @@ -115,6 +115,13 @@ $$(foreach way,$$($1_$2_WAYS),$$(eval \ $$(call build-package-way,$1,$2,$$(way),$3) \ )) +# Programs will need to depend on either the vanilla lib (if -static +# is the default) or the dyn lib (if -dynamic is the default). We +# conservatively make them depend on both, to keep things simple. +# If dyn libs are not being built then $$($1_$2_dyn_LIB) will just +# expand to the empty string, and be ignored. +$1_$2_PROGRAM_DEP_LIB = $$($1_$2_v_LIB) $$($1_$2_dyn_LIB) + # C and S files are possibly built the "dyn" way. ifeq "$$(BuildSharedLibs)" "YES" $(call c-objs,$1,$2,dyn) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 2a76943301..6e6d1c11f1 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -54,6 +54,26 @@ ifeq "$$($1_USES_CABAL)" "YES" $1_$2_USES_CABAL = YES endif +ifeq "$$(Windows)" "YES" +$1_$2_WANT_INPLACE_WRAPPER = NO +else ifneq "$$($1_$2_INSTALL_INPLACE)" "YES" +$1_$2_WANT_INPLACE_WRAPPER = NO +else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" +$1_$2_WANT_INPLACE_WRAPPER = YES +else +$1_$2_WANT_INPLACE_WRAPPER = NO +endif + +ifeq "$$(Windows)" "YES" +$1_$2_WANT_INSTALLED_WRAPPER = NO +else ifneq "$$($1_$2_INSTALL)" "YES" +$1_$2_WANT_INSTALLED_WRAPPER = NO +else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" +$1_$2_WANT_INSTALLED_WRAPPER = YES +else +$1_$2_WANT_INSTALLED_WRAPPER = NO +endif + $(call package-config,$1,$2,$3) $1_$2_depfile_base = $1/$2/build/.depend @@ -66,8 +86,8 @@ $1_$2_INPLACE = endif else # Where do we install the inplace version? -ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" -$1_$2_INPLACE = $$(INPLACE_LIB)/$$($1_$2_PROG) +ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" +$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) else ifeq "$$($1_$2_TOPDIR)" "YES" $1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG) @@ -93,7 +113,7 @@ $(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG)) # INPLACE_BIN might be empty if we're distcleaning ifeq "$(findstring clean,$(MAKECMDGOALS))" "" -ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" +ifeq "$$($1_$2_INSTALL_INPLACE)" "YES" $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/. "$$(CP)" -p $$< $$@ endif @@ -142,17 +162,25 @@ ifeq "$$($1_$2_v_HS_OBJS)" "" $1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main endif +ifneq "$3" "0" +ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES" +$1_$2_GHC_LD_OPTS = \ + -fno-use-rpaths \ + $$(addprefix -optl-Wl$$(comma)-rpath -optl-Wl$$(comma),$$($1_$2_RPATHS)) +endif +endif + ifneq "$$(BINDIST)" "YES" # The quadrupled $'s here are because the _v_LIB variables aren't # necessarily set when this part of the makefile is read $1/$2/build/tmp/$$($1_$2_PROG) : \ $$(foreach dep,$$($1_$2_DEP_NAMES),\ $$(if $$(filter ghc,$$(dep)),\ - $(if $(filter 0,$3),$$(compiler_stage1_v_LIB),\ - $(if $(filter 1,$3),$$(compiler_stage2_v_LIB),\ - $(if $(filter 2,$3),$$(compiler_stage2_v_LIB),\ + $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\ + $(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\ + $(if $(filter 2,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\ $$(error Bad build stage)))),\ - $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_v_LIB))) + $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB))) ifeq "$$($1_$2_LINK_WITH_GCC)" "NO" $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. @@ -184,7 +212,7 @@ endif $(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE)) ifeq "$$($1_$2_INSTALL)" "YES" -ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" +ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES" INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG) else ifeq "$$($1_$2_TOPDIR)" "YES" INSTALL_TOPDIRS += $1/$2/build/tmp/$$($1_$2_PROG) diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk index 1fab27f0c4..8085ad150a 100644 --- a/rules/shell-wrapper.mk +++ b/rules/shell-wrapper.mk @@ -16,31 +16,47 @@ $(call profStart, shell-wrapper($1,$2)) # $1 = dir # $2 = distdir -ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" - ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" "" $1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper endif -ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" -all_$1_$2 : $$(INPLACE_BIN)/$$($1_$2_PROG) +ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" + +ifeq "$$($1_$2_TOPDIR)" "YES" +INPLACE_WRAPPER = $$(INPLACE_LIB)/$$($1_$2_PROG) +else +INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_PROG) +endif + +all_$1_$2 : $$(INPLACE_WRAPPER) $$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@ -$$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE) $$($1_$2_SHELL_WRAPPER_NAME) - $$(call removeFiles, $$@) - echo '#!$$(SHELL)' >> $$@ - echo 'executablename="$$(TOP)/$$<"' >> $$@ - echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@ - echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@ - echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@ - echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@ +ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" +$$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME) +endif +$$(INPLACE_WRAPPER): $$($1_$2_INPLACE) + $$(call removeFiles, $$@) + echo '#!$$(SHELL)' >> $$@ + echo 'executablename="$$(TOP)/$$<"' >> $$@ + echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@ + echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@ + echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@ + echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@ $$($1_$2_SHELL_WRAPPER_EXTRA) $$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA) - cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@ - $$(EXECUTABLE_FILE) $$@ +ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES" + echo 'export LD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH)"' >> $$@ +endif +ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" + cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@ +else + echo 'exec "$$$$executablename" $$$${1+"$$$$@"}' >> $$@ +endif + $$(EXECUTABLE_FILE) $$@ + endif -ifeq "$$($1_$2_INSTALL)" "YES" +ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES" ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)" "" $1_$2_INSTALL_SHELL_WRAPPER_NAME = $$($1_$2_PROG) @@ -59,7 +75,7 @@ install_$1_$2_wrapper: $$(call removeFiles, "$$(WRAPPER)") $$(CREATE_SCRIPT) "$$(WRAPPER)" echo '#!$$(SHELL)' >> "$$(WRAPPER)" - echo 'exedir="$$(ghclibexecdir)"' >> "$$(WRAPPER)" + echo 'exedir="$$(ghclibexecdir)/bin"' >> "$$(WRAPPER)" echo 'exeprog="$$($1_$2_PROG)"' >> "$$(WRAPPER)" echo 'executablename="$$$$exedir/$$$$exeprog"' >> "$$(WRAPPER)" echo 'datadir="$$(datadir)"' >> "$$(WRAPPER)" @@ -70,9 +86,7 @@ install_$1_$2_wrapper: cat $$($1_$2_SHELL_WRAPPER_NAME) >> "$$(WRAPPER)" $$(EXECUTABLE_FILE) "$$(WRAPPER)" -endif # $1_$2_INSTALL - -endif # $1_$2_SHELL_WRAPPER && !Windows +endif $(call profEnd, shell-wrapper($1,$2)) endef diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk index 5e48299646..7a7142c19b 100644 --- a/utils/compare_sizes/ghc.mk +++ b/utils/compare_sizes/ghc.mk @@ -3,6 +3,7 @@ utils/compare_sizes_USES_CABAL = YES utils/compare_sizes_PACKAGE = compareSizes utils/compare_sizes_MODULES = Main utils/compare_sizes_dist-install_PROG = compareSizes$(exeext) +utils/compare_sizes_dist-install_INSTALL_INPLACE = NO $(eval $(call build-prog,utils/compare_sizes,dist-install,1)) diff --git a/utils/genapply/ghc.mk b/utils/genapply/ghc.mk index 4f78bc9600..805fd6f697 100644 --- a/utils/genapply/ghc.mk +++ b/utils/genapply/ghc.mk @@ -12,6 +12,7 @@ utils/genapply_dist_MODULES = GenApply utils/genapply_dist_PROG = $(GHC_GENAPPLY_PGM) +utils/genapply_dist_INSTALL_INPLACE = YES utils/genapply_HC_OPTS += -package pretty diff --git a/utils/genprimopcode/ghc.mk b/utils/genprimopcode/ghc.mk index 5cbf82e831..d119d8dfb3 100644 --- a/utils/genprimopcode/ghc.mk +++ b/utils/genprimopcode/ghc.mk @@ -13,5 +13,6 @@ utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax utils/genprimopcode_dist_PROG = $(GHC_GENPRIMOP_PGM) utils/genprimopcode_dist_HC_OPTS = -package array +utils/genprimopcode_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/genprimopcode,dist,0)) diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 3e43800a78..58ab921c45 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -37,12 +37,18 @@ main = do hSetBuffering stdout LineBuffering runHsColour distDir dir args' "check" : dir : [] -> doCheck dir - "install" : ghc : ghcpkg : strip : topdir : directory : distDir - : myDestDir : myPrefix : myLibdir : myDocdir - : relocatableBuild : args' -> - doInstall ghc ghcpkg strip topdir directory distDir - myDestDir myPrefix myLibdir myDocdir - relocatableBuild args' + "copy" : strip : directory : distDir + : myDestDir : myPrefix : myLibdir : myDocdir + : args' -> + doCopy strip directory distDir + myDestDir myPrefix myLibdir myDocdir + args' + "register" : ghc : ghcpkg : topdir : directory : distDir + : myDestDir : myPrefix : myLibdir : myDocdir + : relocatableBuild : args' -> + doRegister ghc ghcpkg topdir directory distDir + myDestDir myPrefix myLibdir myDocdir + relocatableBuild args' "configure" : args' -> case break (== "--") args' of (config_args, "--" : distdir : directories) -> mapM_ (generate config_args distdir) directories @@ -121,37 +127,26 @@ runHsColour distdir directory args = withCurrentDirectory directory $ defaultMainArgs ("hscolour" : "--builddir" : distdir : args) -doInstall :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath - -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath - -> String -> [String] - -> IO () -doInstall ghc ghcpkg strip topdir directory distDir +doCopy :: FilePath -> FilePath + -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath + -> [String] + -> IO () +doCopy strip directory distDir myDestDir myPrefix myLibdir myDocdir - relocatableBuildStr args + args = withCurrentDirectory directory $ do - relocatableBuild <- case relocatableBuildStr of - "YES" -> return True - "NO" -> return False - _ -> die ["Bad relocatableBuildStr: " ++ - show relocatableBuildStr] let copyArgs = ["copy", "--builddir", distDir] ++ (if null myDestDir then [] else ["--destdir", myDestDir]) ++ args - regArgs = "register" : "--builddir" : distDir : args copyHooks = userHooks { copyHook = noGhcPrimHook $ modHook False $ copyHook userHooks } - regHooks = userHooks { - regHook = modHook relocatableBuild - $ regHook userHooks - } defaultMainWithHooksArgs copyHooks copyArgs - defaultMainWithHooksArgs regHooks regArgs where noGhcPrimHook f pd lbi us flags = let pd' @@ -168,23 +163,46 @@ doInstall ghc ghcpkg strip topdir directory distDir in f pd' lbi us flags modHook relocatableBuild f pd lbi us flags = do let verbosity = normal - idts = installDirTemplates lbi - idts' = idts { - prefix = toPathTemplate $ - if relocatableBuild - then "$topdir" - else myPrefix, - libdir = toPathTemplate $ - if relocatableBuild - then "$topdir" - else myLibdir, - libsubdir = toPathTemplate "$pkgid", - docdir = toPathTemplate $ - if relocatableBuild - then "$topdir/../doc/html/libraries/$pkgid" - else (myDocdir </> "$pkgid"), - htmldir = toPathTemplate "$docdir" - } + idts = updateInstallDirTemplates relocatableBuild + myPrefix myLibdir myDocdir + (installDirTemplates lbi) + progs = withPrograms lbi + stripProgram' = stripProgram { + programFindLocation = \_ -> return (Just strip) } + + progs' <- configureProgram verbosity stripProgram' progs + let lbi' = lbi { + withPrograms = progs', + installDirTemplates = idts + } + f pd lbi' us flags + +doRegister :: FilePath -> FilePath -> FilePath -> FilePath + -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath + -> String -> [String] + -> IO () +doRegister ghc ghcpkg topdir directory distDir + myDestDir myPrefix myLibdir myDocdir + relocatableBuildStr args + = withCurrentDirectory directory $ do + relocatableBuild <- case relocatableBuildStr of + "YES" -> return True + "NO" -> return False + _ -> die ["Bad relocatableBuildStr: " ++ + show relocatableBuildStr] + let regArgs = "register" : "--builddir" : distDir : args + regHooks = userHooks { + regHook = modHook relocatableBuild + $ regHook userHooks + } + + defaultMainWithHooksArgs regHooks regArgs + where + modHook relocatableBuild f pd lbi us flags + = do let verbosity = normal + idts = updateInstallDirTemplates relocatableBuild + myPrefix myLibdir myDocdir + (installDirTemplates lbi) progs = withPrograms lbi ghcpkgconf = topdir </> "package.conf.d" ghcProgram' = ghcProgram { @@ -194,11 +212,9 @@ doInstall ghc ghcpkg strip topdir directory distDir programPostConf = \_ _ -> return $ ["--global-package-db", ghcpkgconf] ++ ["--force" | not (null myDestDir) ], programFindLocation = \_ -> return (Just ghcpkg) } - stripProgram' = stripProgram { - programFindLocation = \_ -> return (Just strip) } configurePrograms ps conf = foldM (flip (configureProgram verbosity)) conf ps - progs' <- configurePrograms [ghcProgram', ghcPkgProgram', stripProgram'] progs + progs' <- configurePrograms [ghcProgram', ghcPkgProgram'] progs let Just ghcPkgProg = lookupProgram ghcPkgProgram' progs' instInfos <- dump verbosity ghcPkgProg GlobalPackageDB let installedPkgs' = PackageIndex.fromList instInfos @@ -215,11 +231,32 @@ doInstall ghc ghcpkg strip topdir directory distDir lbi' = lbi { libraryConfig = mlc', installedPkgs = installedPkgs', - installDirTemplates = idts', + installDirTemplates = idts, withPrograms = progs' } f pd lbi' us flags +updateInstallDirTemplates :: Bool -> FilePath -> FilePath -> FilePath + -> InstallDirTemplates + -> InstallDirTemplates +updateInstallDirTemplates relocatableBuild myPrefix myLibdir myDocdir idts + = idts { + prefix = toPathTemplate $ + if relocatableBuild + then "$topdir" + else myPrefix, + libdir = toPathTemplate $ + if relocatableBuild + then "$topdir" + else myLibdir, + libsubdir = toPathTemplate "$pkgid", + docdir = toPathTemplate $ + if relocatableBuild + then "$topdir/../doc/html/libraries/$pkgid" + else (myDocdir </> "$pkgid"), + htmldir = toPathTemplate "$docdir" + } + -- The packages are built with the package ID ending in "-inplace", but -- when they're installed they get the package hash appended. We need to -- fix up the package deps so that they use the hash package IDs, not @@ -331,8 +368,12 @@ generate config_args distdir directory dep_ids = map snd (externalPackageDeps lbi) + let libraryDirs = forDeps Installed.libraryDirs wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs - wrappedLibraryDirs <- wrap $ forDeps Installed.libraryDirs + wrappedLibraryDirs <- wrap libraryDirs + let depDynlibDirName d = display (Installed.sourcePackageId d) + rpaths = map (\d -> "'$$ORIGIN/../" ++ depDynlibDirName d ++ "'") + dep_pkgs let variablePrefix = directory ++ '_':distdir let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)), @@ -342,6 +383,7 @@ generate config_args distdir directory variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi), variablePrefix ++ "_DEPS = " ++ unwords (map display dep_ids), variablePrefix ++ "_DEP_NAMES = " ++ unwords (map (display . packageName) dep_ids), + variablePrefix ++ "_RPATHS = " ++ unwords rpaths, variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi), variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi), variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi), @@ -364,6 +406,7 @@ generate config_args distdir directory variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, + variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), @@ -388,5 +431,6 @@ generate config_args distdir directory | head s == ' ' = die ["Leading space in value to be wrapped:", s] | last s == ' ' = die ["Trailing space in value to be wrapped:", s] | otherwise = return ("\'" ++ s ++ "\'") + mkSearchPath = intercalate [searchPathSeparator] boolToYesNo True = "YES" boolToYesNo False = "NO" diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 0a3e920e7a..ae1a213122 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -55,6 +55,7 @@ $(GHC_CABAL_DIR)_PACKAGE = ghc-cabal $(GHC_CABAL_DIR)_dist-install_PROG = ghc-cabal$(exeext) $(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO $(GHC_CABAL_DIR)_dist-install_MODULES = Main +$(GHC_CABAL_DIR)_dist-install_MORE_HC_OPTS = -static $(eval $(call build-prog,utils/ghc-cabal,dist-install,1)) diff --git a/utils/ghc-pwd/ghc.mk b/utils/ghc-pwd/ghc.mk index 5efe3b8fdf..f2feef4f52 100644 --- a/utils/ghc-pwd/ghc.mk +++ b/utils/ghc-pwd/ghc.mk @@ -1,7 +1,9 @@ utils/ghc-pwd_USES_CABAL = YES utils/ghc-pwd_PACKAGE = ghc-pwd +utils/ghc-pwd_dist-install_INSTALL_INPLACE = YES utils/ghc-pwd_dist-install_PROG = ghc-pwd$(exeext) +utils/ghc-pwd_dist-install_MORE_HC_OPTS += -static $(eval $(call build-prog,utils/ghc-pwd,dist-install,1)) diff --git a/utils/ghctags/ghc.mk b/utils/ghctags/ghc.mk index 73a520157c..b167a3c069 100644 --- a/utils/ghctags/ghc.mk +++ b/utils/ghctags/ghc.mk @@ -10,8 +10,9 @@ # # ----------------------------------------------------------------------------- -utils/ghctags_dist-install_MODULES = Main -utils/ghctags_dist-install_HC_OPTS = -package ghc -utils/ghctags_dist-install_INSTALL = NO -utils/ghctags_dist-install_PROG = ghctags$(exeext) +utils/ghctags_dist-install_MODULES = Main +utils/ghctags_dist-install_HC_OPTS = -package ghc +utils/ghctags_dist-install_INSTALL = NO +utils/ghctags_dist-install_INSTALL_INPLACE = YES +utils/ghctags_dist-install_PROG = ghctags$(exeext) $(eval $(call build-prog,utils/ghctags,dist-install,2)) diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk index 30a9d05658..59791c840d 100644 --- a/utils/hp2ps/ghc.mk +++ b/utils/hp2ps/ghc.mk @@ -10,14 +10,15 @@ # # ----------------------------------------------------------------------------- -utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ - Reorder.c TopTwenty.c AuxFile.c Deviation.c \ - HpFile.c Marks.c Scale.c TraceElement.c \ - Axes.c Dimensions.c Key.c PsFile.c Shade.c \ - Utilities.c +utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ + Reorder.c TopTwenty.c AuxFile.c Deviation.c \ + HpFile.c Marks.c Scale.c TraceElement.c \ + Axes.c Dimensions.c Key.c PsFile.c Shade.c \ + Utilities.c utils/hp2ps_dist_EXTRA_LIBRARIES = m -utils/hp2ps_dist_PROG = hp2ps$(exeext) -utils/hp2ps_dist_INSTALL = YES +utils/hp2ps_dist_PROG = hp2ps$(exeext) +utils/hp2ps_dist_INSTALL = YES +utils/hp2ps_dist_INSTALL_INPLACE = YES utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) diff --git a/utils/hpc/ghc.mk b/utils/hpc/ghc.mk index 9a8f8ad54e..2485e1639d 100644 --- a/utils/hpc/ghc.mk +++ b/utils/hpc/ghc.mk @@ -13,7 +13,8 @@ utils/hpc_dist-install_MODULES = Main HpcCombine HpcDraft HpcFlags HpcLexer \ HpcMarkup HpcOverlay HpcParser HpcReport \ HpcShowTix HpcUtils -utils/hpc_dist-install_HC_OPTS = -cpp -package hpc -utils/hpc_dist-install_INSTALL = YES -utils/hpc_dist-install_PROG = hpc$(exeext) +utils/hpc_dist-install_HC_OPTS = -cpp -package hpc +utils/hpc_dist-install_INSTALL = YES +utils/hpc_dist-install_INSTALL_INPLACE = YES +utils/hpc_dist-install_PROG = hpc$(exeext) $(eval $(call build-prog,utils/hpc,dist-install,1)) diff --git a/utils/mkUserGuidePart/ghc.mk b/utils/mkUserGuidePart/ghc.mk index fa96769249..ff917848a1 100644 --- a/utils/mkUserGuidePart/ghc.mk +++ b/utils/mkUserGuidePart/ghc.mk @@ -10,10 +10,11 @@ # # ----------------------------------------------------------------------------- -utils/mkUserGuidePart_dist_MODULES = Main -utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext) -utils/mkUserGuidePart_HC_OPTS = -package ghc +utils/mkUserGuidePart_dist_MODULES = Main +utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext) +utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES +utils/mkUserGuidePart_HC_OPTS = -package ghc -static -utils/mkUserGuidePart/dist/build/Main.o: $(ALL_STAGE1_LIBS) $(compiler_stage2_v_LIB) +utils/mkUserGuidePart/dist/build/Main.o: $(ALL_STAGE1_LIBS) $(compiler_stage2_PROGRAM_DEP_LIB) $(eval $(call build-prog,utils/mkUserGuidePart,dist,1)) diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk index 6ff84f0c62..0c045b4e2b 100644 --- a/utils/runghc/ghc.mk +++ b/utils/runghc/ghc.mk @@ -15,6 +15,7 @@ utils/runghc_dist-install_USES_CABAL = YES utils/runghc_dist-install_PROG = runghc$(exeext) utils/runghc_dist-install_SHELL_WRAPPER = YES utils/runghc_dist-install_INSTALL = YES +utils/runghc_dist-install_INSTALL_INPLACE = YES utils/runghc_dist-install_INSTALL_SHELL_WRAPPER_NAME = runghc-$(ProjectVersion) utils/runghc_dist-install_EXTRA_HC_OPTS = -cpp -DVERSION="\"$(ProjectVersion)\"" diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk index f46c3b32ad..1bdf4a07b6 100644 --- a/utils/unlit/ghc.mk +++ b/utils/unlit/ghc.mk @@ -14,6 +14,7 @@ utils/unlit_dist_C_SRCS = unlit.c utils/unlit_dist_PROG = $(GHC_UNLIT_PGM) utils/unlit_dist_TOPDIR = YES utils/unlit_dist_INSTALL = YES +utils/unlit_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/unlit,dist,0)) |