diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-03-04 09:42:36 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-03-04 09:42:36 +0000 |
commit | df2e8675ae1c1d336f290679c206cf0165493266 (patch) | |
tree | 69f5ccec1aaa6910745446219f32acb7e77034e6 | |
parent | c3ad38d7dc39ef583ddfb586413baa2e57ca3ee8 (diff) | |
parent | 2fb8da2b5b7e56f59c976c0c5352a9314f1f0e34 (diff) | |
download | haskell-df2e8675ae1c1d336f290679c206cf0165493266.tar.gz |
Merge branch 'master' of http://darcs.haskell.org/ghc
63 files changed, 881 insertions, 854 deletions
diff --git a/HACKING b/HACKING deleted file mode 100644 index 8ceff18881..0000000000 --- a/HACKING +++ /dev/null @@ -1,63 +0,0 @@ -Getting started with hacking on GHC ------------------------------------ - -So you've decided to hack on GHC, congratulations! We hope you have a -rewarding experience. This file will point you in the direction of -information to help you get started right away. - - -The GHC Developer's Wiki ------------------------- - - The home for GHC Developers, with information on accessing the - latest sources, the bug tracker, and documentation on the - code: - - http://hackage.haskell.org/trac/ghc - - In particular, the wiki contains the following pages of interest to - new hackers: - - Quick Start for developers - - http://hackage.haskell.org/trac/ghc/wiki/Building/Hacking - - This section on the wiki will get you up and running with a - serviceable build tree in no time. - - Don't skip this! By default, GHC builds with all optimizations - and profiling; most hackers will want a quicker build, so creating - a mk/build.mk file and knowing how to rebuild only parts of GHC is - very important. - - This is part of the "Building GHC" section of the wiki, which - has more detailed information on GHC's build system should you - need it. - - - Coding conventions - - http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions - - This wiki page explains the ground rules for code that is intended - to go into the mainline compiler source. - - - The GHC Commentary - - http://hackage.haskell.org/trac/ghc/wiki/Commentary - - Notes on the internals and architecture of GHC. - - -Mailing lists -------------- - - Ask on glasgow-haskell-users@haskell.org if you have difficulties. - If you're working with the current darcs sources of GHC, then - cvs-ghc@haskell.org might be a more appropriate (developers hang - out here). See http://www.haskell.org/mailman/listinfo for - subscription. - - -Happy Hacking! --The GHC Team diff --git a/HACKING.md b/HACKING.md new file mode 100644 index 0000000000..c88669761a --- /dev/null +++ b/HACKING.md @@ -0,0 +1,149 @@ +Contributing to the Glasgow Haskell Compiler +============================================ + +So you've decided to hack on GHC, congratulations! We hope you have a +rewarding experience. This file will point you in the direction of +information to help you get started right away. + +The GHC Developer's Wiki +======================== + +The home for GHC hackers is our Trac instance, located here: + +<http://hackage.haskell.org/trac/ghc> + +From here, you can file bugs (or look them up,) use the wiki, view the +`git` history, among other things. Of particular note is the building +page, which has the high level overview of the build process and how +to get the source: + +<http://hackage.haskell.org/trac/ghc/wiki/Building> + +Contributing patches to GHC in a hurry +====================================== + +Make sure your system has the necessary tools to compile GHC. You can +find an overview here: + +<http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation> + +Next, clone the repository and all the associated libraries: + +``` +$ git clone http://darcs.haskell.org/ghc.git/ +$ cd ghc +$ ./sync-all --testsuite get +``` + +First copy `mk/build.mk.sample` to `mk/build.mk` and ensure it has +your preferred build settings. (You probably want to at least set +`BuildFlavour` to `quick`): + +``` +$ cp mk/build.mk.sample mk/build.mk +$ ... double-check mk/build.mk ... +``` + +Now build. If you have multiple cores, **you should always use them to +speed up compilation**: + +``` +$ ./boot +$ ./configure +$ make -jN # <N> is the number of cores you have. +``` + +You can use the `./inplace/bin/ghc-stage2` binary to play with the +newly built compiler. + +Now, hack on your copy and rebuild (with `make`) as necessary. + +Then start by making your commits however you want. When you're done, you +can use `git format-patch` to create a series of `.patch` files you +can give to us. In this example, we'll assume I'm on a `bugfix` branch +and want to submit my patches: + +``` +$ git branch +* bugfix + master +$ git format-patch master -o patches +... +$ +``` + +Now create a trac ticket: + +<http://hackage.haskell.org/trac/ghc/newticket?type=bug> + +And attach the files in your `patches/` directory. Set the status from +*new* to *patch* and we'll review it as soon as we can! + +Useful links: +============= + +An overview of things like using git, the release process, filing bugs +and more can be located here: + +<http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions> + +You can find our coding conventions for the compiler and RTS here: + +<http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle> +<http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Conventions> + +A high level overview of the bug tracker: + +<http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions/BugTracker> + +If you're going to contribute regularly, **learning how to use the +build system is important** and will save you lots of time. You should +read over this page carefully: + +<http://hackage.haskell.org/trac/ghc/wiki/Building/Using> + +How to communicate with us +========================== + +GHC is a big project, so you'll surely need help. Luckily, we can +provide plenty through a variety of means! + +## IRC + +If you're an IRC user, be sure to drop by the official `#ghc` channel +on [freenode](http://freenode.org). Many (but not all) of the +developers and committers are actively there during a variety of +hours. + +## Mailing lists + +In the event IRC does not work or if you'd like a bigger audience, GHC +has several mailing lists for this purpose. The most important one is +[ghc-devs](http://www.haskell.org/pipermail/ghc-devs/), which is where +the developers actively hang out and discuss incoming changes and +problems. + +There is no strict standard about where you post patches - either in +`ghc-devs` or in the bug tracker. Ideally, please put it in the bug +tracker with test cases or relevant information in a ticket, and set +the ticket status to `patch`. By doing this, we'll see the patch +quickly and be able to review. This will also ensure it doesn't get +lost. But if the change is small and self contained, feel free to +attach it to your email, and send it to `ghc-devs`. + +Furthermore, if you're a developer (or want to become one!) you're +undoubtly also interested in the other mailing lists: + + * [glasgow-haskell-users](http://www.haskell.org/mailman/listinfo/glasgow-haskell-users) + is where developers/users meet. + * [ghc-tickets](http://www.haskell.org/mailman/listinfo/ghc-tickets) + for email from Trac. + * [ghc-builds](http://www.haskell.org/mailman/listinfo/ghc-builds) + for nightly build emails. + * [ghc-commits](http://www.haskell.org/mailman/listinfo/ghc-commits) + for commit messages when someone pushes to the repository. + +El fin +====== + +Happy Hacking! -- The GHC Team @@ -79,22 +79,51 @@ repos in sync with the [sync-all script] [7]. To get the latest changes: $ ./sync-all pull $ ./sync-all get - -Contributors -============ - -Please see the list of [GHC contributors](http://www.haskell.org/ghc/contributors.html "www.haskell.org/ghc/contributors.html"). - - - [1]: http://www.haskell.org/ghc/ "www.haskell.org/ghc/" - [2]: http://hackage.haskell.org/trac/ghc "hackage.haskell.org/trac/ghc" - [3]: http://hackage.haskell.org/trac/ghc/wiki/Building - "hackage.haskell.org/trac/ghc/wiki/Building" - [4]: http://www.haskell.org/happy/ "www.haskell.org/happy/" - [5]: http://www.haskell.org/alex/ "www.haskell.org/alex/" - [6]: http://www.haskell.org/haddock/ "www.haskell.org/haddock/" - [7]: http://hackage.haskell.org/trac/ghc/wiki/Building/SyncAll - "http://hackage.haskell.org/trac/ghc/wiki/Building/SyncAll" - [8]: http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation - "http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation" - [9]: http://www.haskell.org/cabal/ "http://www.haskell.org/cabal/" +Filing bugs and feature requests +================================ + +If you've encountered what you believe is a bug in GHC, or you'd like +to propose a feature request, please let us know! Submit a ticket in +our [bug tracker] [10] and we'll be sure to look into it. Remember: +**Filing a bug is the best way to make sure your issue isn't lost over +time**, so please feel free. + +If you're an active user of GHC, you may also be interested in joining +the [glasgow-haskell-users] [11] mailing list, where developers and +GHC users discuss various topics and hang out. + +Hacking & Developing GHC +======================== + +Once you've filed a bug, maybe you'd like to fix it yourself? That +would be great, and we'd surely love your company! If you're looking +to hack on GHC, check out the guidelines in the `HACKING.md` file in +this directory - they'll get you up to speed quickly. + +Contributors & Acknowledgements +=============================== + +GHC in its current form wouldn't exist without the hard work of +[its many contributors] [12]. Over time, it has grown to include the +efforts and research of many institutions, highly talented people, and +groups from around the world. We'd like to thank them all, and invite +you to join! + + [1]: http://www.haskell.org/ghc/ "www.haskell.org/ghc/" + [2]: http://hackage.haskell.org/trac/ghc "hackage.haskell.org/trac/ghc" + [3]: http://hackage.haskell.org/trac/ghc/wiki/Building + "hackage.haskell.org/trac/ghc/wiki/Building" + [4]: http://www.haskell.org/happy/ "www.haskell.org/happy/" + [5]: http://www.haskell.org/alex/ "www.haskell.org/alex/" + [6]: http://www.haskell.org/haddock/ "www.haskell.org/haddock/" + [7]: http://hackage.haskell.org/trac/ghc/wiki/Building/SyncAll + "http://hackage.haskell.org/trac/ghc/wiki/Building/SyncAll" + [8]: http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation + "http://hackage.haskell.org/trac/ghc/wiki/Building/Preparation" + [9]: http://www.haskell.org/cabal/ "http://www.haskell.org/cabal/" + [10]: http://hackage.haskell.org/trac/ghc/ + "http://hackage.haskell.org/trac/ghc/" + [11]: http://www.haskell.org/pipermail/glasgow-haskell-users/ + "http://www.haskell.org/pipermail/glasgow-haskell-users/" + [12]: http://hackage.haskell.org/trac/ghc/wiki/Contributors + "http://hackage.haskell.org/trac/ghc/wiki/Contributors" diff --git a/aclocal.m4 b/aclocal.m4 index 415388d827..69b40fccf1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1965,16 +1965,16 @@ AC_DEFUN([XCODE_VERSION],[ # AC_DEFUN([FIND_LLVM_PROG],[ FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([$1], [$2], [$3]) - if test "$$1" != ""; then + if test "$$1" == ""; then save_IFS=$IFS IFS=":;" for p in ${PATH}; do - if test -d "${p}"; then + if test -d "${p}"; then $1=`${FindCmd} "${p}" -type f -perm +111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' -or -type l -perm +111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' | ${SortCmd} -n | tail -1` if test -n "$1"; then break fi - fi + fi done IFS=$save_IFS fi diff --git a/bindisttest/ghc.mk b/bindisttest/ghc.mk index c911da5e8c..322b1978ed 100644 --- a/bindisttest/ghc.mk +++ b/bindisttest/ghc.mk @@ -35,7 +35,7 @@ test_bindist: mkdir bindisttest/a/b/c cd bindisttest/a/b/c/ && $(BZIP2_CMD) -cd ../../../../$(BIN_DIST_TEST_TAR_BZ2) | $(TAR_CMD) -xf - $(SHELL) bindisttest/checkBinaries.sh $(ProjectVersion) -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" mv bindisttest/a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR) else cd bindisttest/a/b/c/$(BIN_DIST_NAME) && ./configure --prefix=$(TOP)/$(BIN_DIST_INST_DIR) --with-gcc="$(WhatGccIsCalled)" @@ -131,8 +131,9 @@ sub boot_pkgs { or die "Opening $package/ghc.mk failed: $!"; print GHCMK "${package}_PACKAGE = ${pkg}\n"; print GHCMK "${package}_dist-install_GROUP = libraries\n"; - print GHCMK "\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n"; - print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE2)),2,1)))\n"; + print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n"; + print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE1)),\$(eval \$(call build-package,${package},dist-install,1)))\n"; + print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE2)),\$(eval \$(call build-package,${package},dist-install,2)))\n"; close GHCMK or die "Closing $package/ghc.mk failed: $!"; diff --git a/compiler/ghc.mk b/compiler/ghc.mk index fe6779bd01..181aba9086 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -101,22 +101,10 @@ endif @echo 'cLeadingUnderscore = "$(LeadingUnderscore)"' >> $@ @echo 'cRAWCPP_FLAGS :: String' >> $@ @echo 'cRAWCPP_FLAGS = "$(RAWCPP_FLAGS)"' >> $@ - @echo 'cGHC_DRIVER_DIR :: String' >> $@ - @echo 'cGHC_DRIVER_DIR = "$(GHC_DRIVER_DIR)"' >> $@ @echo 'cGHC_UNLIT_PGM :: String' >> $@ - @echo 'cGHC_UNLIT_PGM = "$(GHC_UNLIT_PGM)"' >> $@ - @echo 'cGHC_UNLIT_DIR :: String' >> $@ - @echo 'cGHC_UNLIT_DIR = "$(GHC_UNLIT_DIR)"' >> $@ + @echo 'cGHC_UNLIT_PGM = "$(utils/unlit_dist_PROG)"' >> $@ @echo 'cGHC_SPLIT_PGM :: String' >> $@ - @echo 'cGHC_SPLIT_PGM = "$(GHC_SPLIT_PGM)"' >> $@ - @echo 'cGHC_SPLIT_DIR :: String' >> $@ - @echo 'cGHC_SPLIT_DIR = "$(GHC_SPLIT_DIR)"' >> $@ - @echo 'cGHC_SYSMAN_PGM :: String' >> $@ - @echo 'cGHC_SYSMAN_PGM = "$(GHC_SYSMAN)"' >> $@ - @echo 'cGHC_SYSMAN_DIR :: String' >> $@ - @echo 'cGHC_SYSMAN_DIR = "$(GHC_SYSMAN_DIR)"' >> $@ - @echo 'cDEFAULT_TMPDIR :: String' >> $@ - @echo 'cDEFAULT_TMPDIR = "$(DEFAULT_TMPDIR)"' >> $@ + @echo 'cGHC_SPLIT_PGM = "$(driver/split_dist_PROG)"' >> $@ @echo 'cLibFFI :: Bool' >> $@ ifeq "$(UseLibFFIForAdjustors)" "YES" @echo 'cLibFFI = True' >> $@ @@ -258,33 +246,33 @@ compiler/stage$1/build/Parser.y: compiler/parser/Parser.y.pp compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H) $$(CPP) $$(RAWCPP_FLAGS) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@ -compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --data-decl < $$< > $$@ -compiler/stage$1/build/primop-tag.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --primop-tag < $$< > $$@ -compiler/stage$1/build/primop-list.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --primop-list < $$< > $$@ -compiler/stage$1/build/primop-has-side-effects.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --has-side-effects < $$< > $$@ -compiler/stage$1/build/primop-out-of-line.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --out-of-line < $$< > $$@ -compiler/stage$1/build/primop-commutable.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --commutable < $$< > $$@ -compiler/stage$1/build/primop-code-size.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --code-size < $$< > $$@ -compiler/stage$1/build/primop-can-fail.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --can-fail < $$< > $$@ -compiler/stage$1/build/primop-strictness.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --strictness < $$< > $$@ -compiler/stage$1/build/primop-fixity.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --fixity < $$< > $$@ -compiler/stage$1/build/primop-primop-info.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --primop-primop-info < $$< > $$@ +compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --data-decl < $$< > $$@ +compiler/stage$1/build/primop-tag.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --primop-tag < $$< > $$@ +compiler/stage$1/build/primop-list.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --primop-list < $$< > $$@ +compiler/stage$1/build/primop-has-side-effects.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --has-side-effects < $$< > $$@ +compiler/stage$1/build/primop-out-of-line.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --out-of-line < $$< > $$@ +compiler/stage$1/build/primop-commutable.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --commutable < $$< > $$@ +compiler/stage$1/build/primop-code-size.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --code-size < $$< > $$@ +compiler/stage$1/build/primop-can-fail.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --can-fail < $$< > $$@ +compiler/stage$1/build/primop-strictness.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --strictness < $$< > $$@ +compiler/stage$1/build/primop-fixity.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --fixity < $$< > $$@ +compiler/stage$1/build/primop-primop-info.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --primop-primop-info < $$< > $$@ # Usages aren't used any more; but the generator # can still generate them if we want them back -compiler/stage$1/build/primop-usage.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE) - "$$(GENPRIMOP_INPLACE)" --usage < $$< > $$@ +compiler/stage$1/build/primop-usage.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) + "$$(genprimopcode_INPLACE)" --usage < $$< > $$@ endef @@ -409,10 +397,6 @@ compiler_stage1_REGISTER_PACKAGE = NO endif -# haddocking only happens for stage2 -compiler_stage1_DO_HADDOCK = NO -compiler_stage3_DO_HADDOCK = NO - # Don't do splitting for the GHC package, it takes too long and # there's not much benefit. compiler_stage1_SplitObjs = NO diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 03189e7448..151c5cbcc3 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -303,12 +303,12 @@ reallyInitDynLinker dflags = -- (e) Link any MacOS frameworks ; let platform = targetPlatform dflags - ; let framework_paths = case platformOS platform of - OSDarwin -> frameworkPaths dflags - _ -> [] - ; let frameworks = case platformOS platform of - OSDarwin -> cmdlineFrameworks dflags - _ -> [] + ; let framework_paths = if platformUsesFrameworks platform + then frameworkPaths dflags + else [] + ; let frameworks = if platformUsesFrameworks platform + then cmdlineFrameworks dflags + else [] -- Finally do (c),(d),(e) ; let cmdline_lib_specs = [ l | Just l <- classified_ld_inputs ] ++ libspecs @@ -389,13 +389,12 @@ preloadLib dflags lib_paths framework_paths lib_spec Just mm -> preloadFailed mm lib_paths lib_spec Framework framework -> - case platformOS (targetPlatform dflags) of - OSDarwin -> - do maybe_errstr <- loadFramework framework_paths framework - case maybe_errstr of - Nothing -> maybePutStrLn dflags "done" - Just mm -> preloadFailed mm framework_paths lib_spec - _ -> panic "preloadLib Framework" + if platformUsesFrameworks (targetPlatform dflags) + then do maybe_errstr <- loadFramework framework_paths framework + case maybe_errstr of + Nothing -> maybePutStrLn dflags "done" + Just mm -> preloadFailed mm framework_paths lib_spec + else panic "preloadLib Framework" where platform = targetPlatform dflags @@ -1156,9 +1155,9 @@ load_dyn dll = do r <- loadDLL dll loadFrameworks :: Platform -> InstalledPackageInfo_ ModuleName -> IO () loadFrameworks platform pkg - = case platformOS platform of - OSDarwin -> mapM_ load frameworks - _ -> return () + = if platformUsesFrameworks platform + then mapM_ load frameworks + else return () where fw_dirs = Packages.frameworkDirs pkg frameworks = Packages.frameworks pkg diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs index d59c193ae8..ccbfc63a31 100644 --- a/compiler/hsSyn/HsExpr.lhs +++ b/compiler/hsSyn/HsExpr.lhs @@ -917,7 +917,7 @@ pprMatch ctxt (Match pats maybe_ty grhss) (herald, other_pats) = case ctxt of FunRhs fun is_infix - | not is_infix -> (ppr fun, pats) + | not is_infix -> (pprPrefixOcc fun, pats) -- f x y z = e -- Not pprBndr; the AbsBinds will -- have printed the signature @@ -928,7 +928,7 @@ pprMatch ctxt (Match pats maybe_ty grhss) | otherwise -> (parens pp_infix, pats2) -- (x &&& y) z = e where - pp_infix = pprParendLPat pat1 <+> ppr fun <+> pprParendLPat pat2 + pp_infix = pprParendLPat pat1 <+> pprInfixOcc fun <+> pprParendLPat pat2 LambdaExpr -> (char '\\', pats) diff --git a/compiler/llvmGen/LlvmCodeGen/Ppr.hs b/compiler/llvmGen/LlvmCodeGen/Ppr.hs index 5d9fb23fe9..c699631e9c 100644 --- a/compiler/llvmGen/LlvmCodeGen/Ppr.hs +++ b/compiler/llvmGen/LlvmCodeGen/Ppr.hs @@ -61,6 +61,9 @@ moduleLayout = sdocWithPlatform $ \platform -> Platform { platformArch = ArchARM {}, platformOS = OSAndroid } -> text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\"" $+$ text "target triple = \"arm-unknown-linux-androideabi\"" + Platform { platformArch = ArchARM {}, platformOS = OSiOS } -> + text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32\"" + $+$ text "target triple = \"arm-apple-darwin10\"" _ -> -- FIX: Other targets empty diff --git a/compiler/main/CodeOutput.lhs b/compiler/main/CodeOutput.lhs index 817d789a93..a180789d2b 100644 --- a/compiler/main/CodeOutput.lhs +++ b/compiler/main/CodeOutput.lhs @@ -49,7 +49,8 @@ codeOutput :: DynFlags -> ForeignStubs -> [PackageId] -> Stream IO RawCmmGroup () -- Compiled C-- - -> IO (Bool{-stub_h_exists-}, Maybe FilePath{-stub_c_exists-}) + -> IO (FilePath, + (Bool{-stub_h_exists-}, Maybe FilePath{-stub_c_exists-})) codeOutput dflags this_mod location foreign_stubs pkg_deps cmm_stream = @@ -74,13 +75,13 @@ codeOutput dflags this_mod location foreign_stubs pkg_deps cmm_stream ; let filenm = hscOutName dflags ; stubs_exist <- outputForeignStubs dflags this_mod location foreign_stubs ; case hscTarget dflags of { - HscInterpreted -> return (); HscAsm -> outputAsm dflags filenm linted_cmm_stream; HscC -> outputC dflags filenm linted_cmm_stream pkg_deps; HscLlvm -> outputLlvm dflags filenm linted_cmm_stream; + HscInterpreted -> panic "codeOutput: HscInterpreted"; HscNothing -> panic "codeOutput: HscNothing" } - ; return stubs_exist + ; return (filenm, stubs_exist) } doOutput :: String -> (Handle -> IO a) -> IO a diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 68957ca15f..240cbf43d8 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -108,7 +108,7 @@ compile = compile' (hscCompileNothing, hscCompileInteractive, hscCompileBatch) compile' :: (Compiler (HscStatus, ModIface, ModDetails), Compiler (InteractiveStatus, ModIface, ModDetails), - Compiler (HscStatus, ModIface, ModDetails)) + Compiler (FileOutputStatus, ModIface, ModDetails)) -> HscEnv -> ModSummary -- ^ summary for module being compiled -> Int -- ^ module N ... @@ -149,9 +149,8 @@ compile' (nothingCompiler, interactiveCompiler, batchCompiler) output_fn <- getOutputFilename next_phase Temporary basename dflags next_phase (Just location) - let dflags' = dflags { hscTarget = hsc_lang, - hscOutName = output_fn, - extCoreName = basename ++ ".hcr" } + let dflags' = dflags { hscOutName = output_fn, + extCoreName = basename ++ ".hcr" } let hsc_env' = hsc_env { hsc_dflags = dflags' } -- -fforce-recomp should also work with --make @@ -441,6 +440,10 @@ compileFile hsc_env stop_phase (src, mb_phase) = do -- When linking, the -o argument refers to the linker's output. -- otherwise, we use it as the name for the pipeline's output. output + -- If we are dong -fno-code, then act as if the output is + -- 'Temporary'. This stops GHC trying to copy files to their + -- final location. + | HscNothing <- hscTarget dflags = Temporary | StopLn <- stop_phase, not (isNoLink ghc_link) = Persistent -- -o foo applies to linker | Just o_file <- mb_o_file = SpecificFile o_file @@ -712,50 +715,47 @@ pipeLoop phase input_fn = do getOutputFilename :: Phase -> PipelineOutput -> String -> DynFlags -> Phase{-next phase-} -> Maybe ModLocation -> IO FilePath -getOutputFilename stop_phase output basename - = func - where - func dflags next_phase maybe_location - | is_last_phase, Persistent <- output = persistent_fn - | is_last_phase, SpecificFile f <- output = return f - | keep_this_output = persistent_fn - | otherwise = newTempName dflags suffix - where - hcsuf = hcSuf dflags - odir = objectDir dflags - osuf = objectSuf dflags - keep_hc = gopt Opt_KeepHcFiles dflags - keep_s = gopt Opt_KeepSFiles dflags - keep_bc = gopt Opt_KeepLlvmFiles dflags - - myPhaseInputExt HCc = hcsuf - myPhaseInputExt MergeStub = osuf - myPhaseInputExt StopLn = osuf - myPhaseInputExt other = phaseInputExt other - - is_last_phase = next_phase `eqPhase` stop_phase - - -- sometimes, we keep output from intermediate stages - keep_this_output = - case next_phase of - As | keep_s -> True - LlvmOpt | keep_bc -> True - HCc | keep_hc -> True - _other -> False - - suffix = myPhaseInputExt next_phase - - -- persistent object files get put in odir - persistent_fn - | StopLn <- next_phase = return odir_persistent - | otherwise = return persistent - - persistent = basename <.> suffix - - odir_persistent - | Just loc <- maybe_location = ml_obj_file loc - | Just d <- odir = d </> persistent - | otherwise = persistent +getOutputFilename stop_phase output basename dflags next_phase maybe_location + | is_last_phase, Persistent <- output = persistent_fn + | is_last_phase, SpecificFile f <- output = return f + | keep_this_output = persistent_fn + | otherwise = newTempName dflags suffix + where + hcsuf = hcSuf dflags + odir = objectDir dflags + osuf = objectSuf dflags + keep_hc = gopt Opt_KeepHcFiles dflags + keep_s = gopt Opt_KeepSFiles dflags + keep_bc = gopt Opt_KeepLlvmFiles dflags + + myPhaseInputExt HCc = hcsuf + myPhaseInputExt MergeStub = osuf + myPhaseInputExt StopLn = osuf + myPhaseInputExt other = phaseInputExt other + + is_last_phase = next_phase `eqPhase` stop_phase + + -- sometimes, we keep output from intermediate stages + keep_this_output = + case next_phase of + As | keep_s -> True + LlvmOpt | keep_bc -> True + HCc | keep_hc -> True + _other -> False + + suffix = myPhaseInputExt next_phase + + -- persistent object files get put in odir + persistent_fn + | StopLn <- next_phase = return odir_persistent + | otherwise = return persistent + + persistent = basename <.> suffix + + odir_persistent + | Just loc <- maybe_location = ml_obj_file loc + | Just d <- odir = d </> persistent + | otherwise = persistent -- ----------------------------------------------------------------------------- @@ -980,8 +980,7 @@ runPhase (Hsc src_flavour) input_fn dflags0 let next_phase = hscPostBackendPhase dflags src_flavour hsc_lang output_fn <- phaseOutputFilename next_phase - let dflags' = dflags { hscTarget = hsc_lang, - hscOutName = output_fn, + let dflags' = dflags { hscOutName = output_fn, extCoreName = basename ++ ".hcr" } setDynFlags dflags' @@ -1016,7 +1015,7 @@ runPhase (Hsc src_flavour) input_fn dflags0 -- than the source file (else we wouldn't be in HscNoRecomp) -- but we touch it anyway, to keep 'make' happy (we think). return (StopLn, o_file) - (HscRecomp hasStub _) + (HscRecomp hasStub mOutputFilename) -> do case hasStub of Nothing -> return () Just stub_c -> @@ -1024,12 +1023,19 @@ runPhase (Hsc src_flavour) input_fn dflags0 setStubO stub_o -- In the case of hs-boot files, generate a dummy .o-boot -- stamp file for the benefit of Make - when (isHsBoot src_flavour) $ do - liftIO $ touchObjectFile dflags' o_file - whenGeneratingDynamicToo dflags' $ do - let dyn_o_file = addBootSuffix (replaceExtension o_file (dynObjectSuf dflags')) - liftIO $ touchObjectFile dflags' dyn_o_file - return (next_phase, output_fn) + outputFilename <- + case mOutputFilename of + Just x -> return x + Nothing -> + if isHsBoot src_flavour + then do liftIO $ touchObjectFile dflags' o_file + whenGeneratingDynamicToo dflags' $ do + let dyn_o_file = addBootSuffix (replaceExtension o_file (dynObjectSuf dflags')) + liftIO $ touchObjectFile dflags' dyn_o_file + return o_file + else return $ panic "runPhase Hsc: No output filename" + + return (next_phase, outputFilename) ----------------------------------------------------------------------------- -- Cmm phase @@ -1050,8 +1056,7 @@ runPhase Cmm input_fn dflags output_fn <- phaseOutputFilename next_phase - let dflags' = dflags { hscTarget = hsc_lang, - hscOutName = output_fn, + let dflags' = dflags { hscOutName = output_fn, extCoreName = src_basename ++ ".hcr" } setDynFlags dflags' @@ -1100,14 +1105,12 @@ runPhase cc_phase input_fn dflags else getPackageExtraCcOpts dflags pkgs framework_paths <- - case platformOS platform of - OSDarwin -> - do pkgFrameworkPaths <- liftIO $ getPackageFrameworkPath dflags pkgs - let cmdlineFrameworkPaths = frameworkPaths dflags - return $ map ("-F"++) - (cmdlineFrameworkPaths ++ pkgFrameworkPaths) - _ -> - return [] + if platformUsesFrameworks platform + then do pkgFrameworkPaths <- liftIO $ getPackageFrameworkPath dflags pkgs + let cmdlineFrameworkPaths = frameworkPaths dflags + return $ map ("-F"++) + (cmdlineFrameworkPaths ++ pkgFrameworkPaths) + else return [] let split_objs = gopt Opt_SplitObjs dflags split_opt | hcc && split_objs = [ "-DUSE_SPLIT_MARKERS" ] @@ -1640,9 +1643,9 @@ mkNoteObjsToLinkIntoBinary dflags dep_packages = do getLinkInfo :: DynFlags -> [PackageId] -> IO String getLinkInfo dflags dep_packages = do package_link_opts <- getPackageLinkOpts dflags dep_packages - pkg_frameworks <- case platformOS (targetPlatform dflags) of - OSDarwin -> getPackageFrameworks dflags dep_packages - _ -> return [] + pkg_frameworks <- if platformUsesFrameworks (targetPlatform dflags) + then getPackageFrameworks dflags dep_packages + else return [] let extra_ld_inputs = ldInputs dflags let link_info = (package_link_opts, @@ -1787,38 +1790,31 @@ linkBinary dflags o_files dep_packages = do pkg_link_opts <- getPackageLinkOpts dflags dep_packages pkg_framework_path_opts <- - case platformOS platform of - OSDarwin -> - do pkg_framework_paths <- getPackageFrameworkPath dflags dep_packages - return $ map ("-F" ++) pkg_framework_paths - _ -> - return [] + if platformUsesFrameworks platform + then do pkg_framework_paths <- getPackageFrameworkPath dflags dep_packages + return $ map ("-F" ++) pkg_framework_paths + else return [] framework_path_opts <- - case platformOS platform of - OSDarwin -> - do let framework_paths = frameworkPaths dflags - return $ map ("-F" ++) framework_paths - _ -> - return [] + if platformUsesFrameworks platform + then do let framework_paths = frameworkPaths dflags + return $ map ("-F" ++) framework_paths + else return [] pkg_framework_opts <- - case platformOS platform of - OSDarwin -> - do pkg_frameworks <- getPackageFrameworks dflags dep_packages - return $ concat [ ["-framework", fw] | fw <- pkg_frameworks ] - _ -> - return [] + if platformUsesFrameworks platform + then do pkg_frameworks <- getPackageFrameworks dflags dep_packages + return $ concat [ ["-framework", fw] | fw <- pkg_frameworks ] + else return [] framework_opts <- - case platformOS platform of - OSDarwin -> - do let frameworks = cmdlineFrameworks dflags - -- reverse because they're added in reverse order from - -- the cmd line: - return $ concat [ ["-framework", fw] | fw <- reverse frameworks ] - _ -> - return [] + if platformUsesFrameworks platform + then do let frameworks = cmdlineFrameworks dflags + -- reverse because they're added in reverse order from + -- the cmd line: + return $ concat [ ["-framework", fw] + | fw <- reverse frameworks ] + else return [] -- probably _stub.o files let extra_ld_inputs = ldInputs dflags diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 3591a30d25..479516d50f 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -25,7 +25,7 @@ module DynFlags ( FatalMessager, LogAction, FlushOut(..), FlushErr(..), ProfAuto(..), glasgowExtsFlags, - dopt, + dopt, dopt_set, dopt_unset, gopt, gopt_set, gopt_unset, wopt, wopt_set, wopt_unset, xopt, xopt_set, xopt_unset, @@ -1477,6 +1477,10 @@ dopt f dflags = (fromEnum f `IntSet.member` dumpFlags dflags) dopt_set :: DynFlags -> DumpFlag -> DynFlags dopt_set dfs f = dfs{ dumpFlags = IntSet.insert (fromEnum f) (dumpFlags dfs) } +-- | Unset a 'DumpFlag' +dopt_unset :: DynFlags -> DumpFlag -> DynFlags +dopt_unset dfs f = dfs{ dumpFlags = IntSet.delete (fromEnum f) (dumpFlags dfs) } + -- | Test whether a 'GeneralFlag' is set gopt :: GeneralFlag -> DynFlags -> Bool gopt f dflags = fromEnum f `IntSet.member` generalFlags dflags diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 2f2b53efba..b7a37c3de2 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -34,6 +34,7 @@ module HscMain -- * Compiling complete source files , Compiler , HscStatus' (..) + , FileOutputStatus , InteractiveStatus, HscStatus , hscCompileOneShot , hscCompileBatch @@ -540,11 +541,12 @@ data HscStatus' a -- result type. Therefore we need to artificially distinguish some types. We do -- this by adding type tags which will simply be ignored by the caller. type HscStatus = HscStatus' () +type FileOutputStatus = HscStatus' (Maybe FilePath) type InteractiveStatus = HscStatus' (Maybe (CompiledByteCode, ModBreaks)) -- INVARIANT: result is @Nothing@ <=> input was a boot file -type OneShotResult = HscStatus -type BatchResult = (HscStatus, ModIface, ModDetails) +type OneShotResult = FileOutputStatus +type BatchResult = (FileOutputStatus, ModIface, ModDetails) type NothingResult = (HscStatus, ModIface, ModDetails) type InteractiveResult = (InteractiveStatus, ModIface, ModDetails) @@ -687,21 +689,21 @@ hscOneShotCompiler = HsCompiler { , hscBackend = \tc_result mod_summary mb_old_hash -> do dflags <- getDynFlags case hscTarget dflags of - HscNothing -> return (HscRecomp Nothing ()) + HscNothing -> return (HscRecomp Nothing Nothing) _otherw -> genericHscBackend hscOneShotCompiler tc_result mod_summary mb_old_hash , hscGenBootOutput = \tc_result mod_summary mb_old_iface -> do (iface, changed, _) <- hscSimpleIface tc_result mb_old_iface hscWriteIface iface changed mod_summary - return (HscRecomp Nothing ()) + return (HscRecomp Nothing Nothing) , hscGenOutput = \guts0 mod_summary mb_old_iface -> do guts <- hscSimplify' guts0 (iface, changed, _details, cgguts) <- hscNormalIface guts mb_old_iface hscWriteIface iface changed mod_summary - hasStub <- hscGenHardCode cgguts mod_summary - return (HscRecomp hasStub ()) + (outputFilename, hasStub) <- hscGenHardCode cgguts mod_summary + return (HscRecomp hasStub (Just outputFilename)) } -- Compile Haskell, boot and extCore in OneShot mode. @@ -737,18 +739,18 @@ hscBatchCompiler = HsCompiler { , hscGenBootOutput = \tc_result mod_summary mb_old_iface -> do (iface, changed, details) <- hscSimpleIface tc_result mb_old_iface hscWriteIface iface changed mod_summary - return (HscRecomp Nothing (), iface, details) + return (HscRecomp Nothing Nothing, iface, details) , hscGenOutput = \guts0 mod_summary mb_old_iface -> do guts <- hscSimplify' guts0 (iface, changed, details, cgguts) <- hscNormalIface guts mb_old_iface hscWriteIface iface changed mod_summary - hasStub <- hscGenHardCode cgguts mod_summary - return (HscRecomp hasStub (), iface, details) + (outputFilename, hasStub) <- hscGenHardCode cgguts mod_summary + return (HscRecomp hasStub (Just outputFilename), iface, details) } -- | Compile Haskell, boot and extCore in batch mode. -hscCompileBatch :: Compiler (HscStatus, ModIface, ModDetails) +hscCompileBatch :: Compiler (FileOutputStatus, ModIface, ModDetails) hscCompileBatch = genericHscCompile hscBatchCompiler batchMsg hscBatchBackendOnly :: TcGblEnv -> Compiler BatchResult @@ -1256,7 +1258,7 @@ hscWriteIface iface no_change mod_summary = do -- | Compile to hard-code. hscGenHardCode :: CgGuts -> ModSummary - -> Hsc (Maybe FilePath) -- ^ @Just f@ <=> _stub.c is f + -> Hsc (FilePath, Maybe FilePath) -- ^ @Just f@ <=> _stub.c is f hscGenHardCode cgguts mod_summary = do hsc_env <- getHscEnv liftIO $ do @@ -1303,11 +1305,11 @@ hscGenHardCode cgguts mod_summary = do return a rawcmms1 = Stream.mapM dump rawcmms0 - (_stub_h_exists, stub_c_exists) + (output_filename, (_stub_h_exists, stub_c_exists)) <- {-# SCC "codeOutput" #-} codeOutput dflags this_mod location foreign_stubs dependencies rawcmms1 - return stub_c_exists + return (output_filename, stub_c_exists) hscInteractive :: (ModIface, ModDetails, CgGuts) diff --git a/compiler/simplCore/CoreMonad.lhs b/compiler/simplCore/CoreMonad.lhs index 5726cf51fd..3afb8cdf5d 100644 --- a/compiler/simplCore/CoreMonad.lhs +++ b/compiler/simplCore/CoreMonad.lhs @@ -731,7 +731,9 @@ data CoreReader = CoreReader { } data CoreWriter = CoreWriter { - cw_simpl_count :: SimplCount + cw_simpl_count :: !SimplCount + -- Making this strict fixes a nasty space leak + -- See Trac #7702 } emptyWriter :: DynFlags -> CoreWriter diff --git a/compiler/typecheck/TcCanonical.lhs b/compiler/typecheck/TcCanonical.lhs index c300b62a22..230a1fef79 100644 --- a/compiler/typecheck/TcCanonical.lhs +++ b/compiler/typecheck/TcCanonical.lhs @@ -639,8 +639,9 @@ flattenTyVar loc f ctxt tv tv_eq_subst subst tv | Just ct <- lookupVarEnv subst tv , let ctev = cc_ev ct + rhs = cc_rhs ct , ctEvFlavour ctev `canRewrite` ctxt - = Just (evTermCoercion (ctEvTerm ctev), cc_rhs ct) + = Just (evTermCoercion (ctEvTerm ctev), rhs) -- NB: even if ct is Derived we are not going to -- touch the actual coercion so we are fine. | otherwise = Nothing @@ -705,13 +706,9 @@ emitWorkNC loc evs mk_nc ev = CNonCanonical { cc_ev = ev, cc_loc = loc } ------------------------- -canEqNC, canEq :: CtLoc -> CtEvidence -> Type -> Type -> TcS StopOrContinue +canEqNC :: CtLoc -> CtEvidence -> Type -> Type -> TcS StopOrContinue -canEqNC loc ev ty1 ty2 - = canEq loc ev ty1 ty2 - `andWhenContinue` emitKindConstraint - -canEq _loc ev ty1 ty2 +canEqNC _loc ev ty1 ty2 | eqType ty1 ty2 -- Dealing with equality here avoids -- later spurious occurs checks for a~a = if isWanted ev then @@ -722,30 +719,30 @@ canEq _loc ev ty1 ty2 -- If one side is a variable, orient and flatten, -- WITHOUT expanding type synonyms, so that we tend to -- substitute a ~ Age rather than a ~ Int when @type Age = Int@ -canEq loc ev ty1@(TyVarTy {}) ty2 +canEqNC loc ev ty1@(TyVarTy {}) ty2 = canEqLeaf loc ev ty1 ty2 -canEq loc ev ty1 ty2@(TyVarTy {}) +canEqNC loc ev ty1 ty2@(TyVarTy {}) = canEqLeaf loc ev ty1 ty2 -- See Note [Naked given applications] -canEq loc ev ty1 ty2 - | Just ty1' <- tcView ty1 = canEq loc ev ty1' ty2 - | Just ty2' <- tcView ty2 = canEq loc ev ty1 ty2' +canEqNC loc ev ty1 ty2 + | Just ty1' <- tcView ty1 = canEqNC loc ev ty1' ty2 + | Just ty2' <- tcView ty2 = canEqNC loc ev ty1 ty2' -canEq loc ev ty1@(TyConApp fn tys) ty2 +canEqNC loc ev ty1@(TyConApp fn tys) ty2 | isSynFamilyTyCon fn, length tys == tyConArity fn = canEqLeaf loc ev ty1 ty2 -canEq loc ev ty1 ty2@(TyConApp fn tys) +canEqNC loc ev ty1 ty2@(TyConApp fn tys) | isSynFamilyTyCon fn, length tys == tyConArity fn = canEqLeaf loc ev ty1 ty2 -canEq loc ev ty1 ty2 +canEqNC loc ev ty1 ty2 | Just (tc1,tys1) <- tcSplitTyConApp_maybe ty1 , Just (tc2,tys2) <- tcSplitTyConApp_maybe ty2 , isDecomposableTyCon tc1 && isDecomposableTyCon tc2 = canDecomposableTyConApp loc ev tc1 tys1 tc2 tys2 -canEq loc ev s1@(ForAllTy {}) s2@(ForAllTy {}) +canEqNC loc ev s1@(ForAllTy {}) s2@(ForAllTy {}) | tcIsForAllTy s1, tcIsForAllTy s2 , CtWanted { ctev_evar = orig_ev } <- ev = do { let (tvs1,body1) = tcSplitForAllTys s1 @@ -765,7 +762,7 @@ canEq loc ev s1@(ForAllTy {}) s2@(ForAllTy {}) -- e.g. F a b ~ Maybe c where F has arity 1 -- See Note [Equality between type applications] -- Note [Care with type applications] in TcUnify -canEq loc ev ty1 ty2 +canEqNC loc ev ty1 ty2 = do { let flav = ctEvFlavour ev ; (s1, co1) <- flatten loc FMSubstOnly flav ty1 ; (s2, co2) <- flatten loc FMSubstOnly flav ty2 @@ -821,43 +818,6 @@ canEqFailure loc ev ty1 ty2 Just new_ev -> emitInsoluble (CNonCanonical { cc_ev = new_ev, cc_loc = loc }) Nothing -> pprPanic "canEqFailure" (ppr ev $$ ppr ty1 $$ ppr ty2) ; return Stop } - ------------------------- -emitKindConstraint :: Ct -> TcS StopOrContinue -emitKindConstraint ct -- By now ct is canonical - = case ct of - CTyEqCan { cc_loc = loc - , cc_ev = ev, cc_tyvar = tv - , cc_rhs = ty } - -> emit_kind_constraint loc ev (mkTyVarTy tv) ty - - CFunEqCan { cc_loc = loc - , cc_ev = ev - , cc_fun = fn, cc_tyargs = xis1 - , cc_rhs = xi2 } - -> emit_kind_constraint loc ev (mkTyConApp fn xis1) xi2 - - _ -> continueWith ct - where - emit_kind_constraint loc _ev ty1 ty2 - | compatKind k1 k2 -- True when ty1,ty2 are themselves kinds, - = continueWith ct -- because then k1, k2 are BOX - - | otherwise - = ASSERT( isKind k1 && isKind k2 ) - do { mw <- newDerived (mkEqPred k1 k2) - ; case mw of - Nothing -> return () - Just kev -> emitWorkNC kind_co_loc [kev] - ; continueWith ct } - where - k1 = typeKind ty1 - k2 = typeKind ty2 - - -- Always create a Wanted kind equality even if - -- you are decomposing a given constraint. - -- NB: DV finds this reasonable for now. Maybe we have to revisit. - kind_co_loc = setCtLocOrigin loc (KindEqOrigin ty1 ty2 (ctLocOrigin loc)) \end{code} Note [Make sure that insolubles are fully rewritten] @@ -900,14 +860,14 @@ Consider: type T a = A a and the given equality: [G] A a ~ T Int -We will reach the case canEq where we do a tcSplitAppTy_maybe, but if +We will reach the case canEqNC where we do a tcSplitAppTy_maybe, but if we dont have the guards (Nothing <- tcView ty1) (Nothing <- tcView ty2) then the given equation is going to fall through and get completely forgotten! What we want instead is this clause to apply only when there is no immediate top-level synonym; if there is one it will be later on -unfolded by the later stages of canEq. +unfolded by the later stages of canEqNC. Test-case is in typecheck/should_compile/GivenTypeSynonym.hs @@ -1039,22 +999,22 @@ classify ty | Just ty' <- tcView ty = OtherCls ty -- See note [Canonical ordering for equality constraints]. -reOrient :: CtEvidence -> TypeClassifier -> TypeClassifier -> Bool +reOrient :: TypeClassifier -> TypeClassifier -> Bool -- (t1 `reOrient` t2) responds True -- iff we should flip to (t2~t1) -- We try to say False if possible, to minimise evidence generation -- -- Postcondition: After re-orienting, first arg is not OTherCls -reOrient _ev (OtherCls {}) cls2 = ASSERT( case cls2 of { OtherCls {} -> False; _ -> True } ) - True -- One must be Var/Fun +reOrient (OtherCls {}) cls2 = ASSERT( case cls2 of { OtherCls {} -> False; _ -> True } ) + True -- One must be Var/Fun -reOrient _ev (FunCls {}) _ = False -- Fun/Other on rhs +reOrient (FunCls {}) _ = False -- Fun/Other on rhs -- But consider the following variation: isGiven ev && isMetaTyVar tv -- See Note [No touchables as FunEq RHS] in TcSMonad -reOrient _ev (VarCls {}) (FunCls {}) = True -reOrient _ev (VarCls {}) (OtherCls {}) = False -reOrient _ev (VarCls tv1) (VarCls tv2) +reOrient (VarCls {}) (FunCls {}) = True +reOrient (VarCls {}) (OtherCls {}) = False +reOrient (VarCls tv1) (VarCls tv2) | isMetaTyVar tv2 && not (isMetaTyVar tv1) = True | otherwise = False -- Just for efficiency, see CTyEqCan invariants @@ -1072,8 +1032,35 @@ canEqLeaf :: CtLoc -> CtEvidence -- * one of the two arguments is variable -- or an exactly-saturated family application -- * the two types are not equal (looking through synonyms) + +-- NB: at this point we do NOT know that the kinds of s1 and s2 are +-- compatible. See Note [Equalities with incompatible kinds] + +-- Test for incompatible kinds +-- If so, emit an "irreducible" constraint CIrredEvCan (NOT CTyEqCan or CFunEqCan) +-- for the type equality; and continue with the kind equality constraint. +-- When the latter is solved, it'll kick out the irreducible equality for +-- a second attempt at solving canEqLeaf loc ev s1 s2 - | cls1 `re_orient` cls2 + | not (k1 `compatKind` k2) -- See Note [Equalities with incompatible kinds] + = ASSERT( isKind k1 && isKind k2 ) + do { updWorkListTcS $ extendWorkListNonEq $ + CIrredEvCan { cc_ev = ev, cc_loc = loc } + ; mw <- newDerived (mkEqPred k1 k2) + ; case mw of + Nothing -> return Stop + Just kev -> canEqNC kind_co_loc kev k1 k2 } + where + k1 = typeKind s1 + k2 = typeKind s2 + + -- Always create a Wanted kind equality even if + -- you are decomposing a given constraint. + -- NB: DV finds this reasonable for now. Maybe we have to revisit. + kind_co_loc = setCtLocOrigin loc (KindEqOrigin s1 s2 (ctLocOrigin loc)) + +canEqLeaf loc ev s1 s2 + | cls1 `reOrient` cls2 = do { traceTcS "canEqLeaf (reorienting)" $ ppr ev <+> dcolon <+> pprEq s1 s2 ; let xcomp [x] = EvCoercion (mkTcSymCo (evTermCoercion x)) xcomp _ = panic "canEqLeaf: can't happen" @@ -1089,19 +1076,22 @@ canEqLeaf loc ev s1 s2 = do { traceTcS "canEqLeaf" $ ppr (mkTcEqPred s1 s2) ; canEqLeafOriented loc ev cls1 s2 } where - re_orient = reOrient ev cls1 = classify s1 cls2 = classify s2 canEqLeafOriented :: CtLoc -> CtEvidence -> TypeClassifier -> TcType -> TcS StopOrContinue -- By now s1 will either be a variable or a type family application +-- Precondition: the LHS and RHS have `compatKind` kinds +-- so we can safely generate a CTyEqCan or CFunEqCan canEqLeafOriented loc ev (FunCls fn tys1) s2 = canEqLeafFunEq loc ev fn tys1 s2 canEqLeafOriented loc ev (VarCls tv) s2 = canEqLeafTyVarEq loc ev tv s2 canEqLeafOriented _ ev (OtherCls {}) _ = pprPanic "canEqLeafOriented" (ppr (ctEvPred ev)) canEqLeafFunEq :: CtLoc -> CtEvidence -> TyCon -> [TcType] -> TcType -> TcS StopOrContinue +-- Precondition: LHS and RHS have compatible kinds +-- (guaranteed by canEqLeaf0 canEqLeafFunEq loc ev fn tys1 ty2 -- ev :: F tys1 ~ ty2 = do { traceTcS "canEqLeafFunEq" $ pprEq (mkTyConApp fn tys1) ty2 ; let flav = ctEvFlavour ev @@ -1121,16 +1111,14 @@ canEqLeafFunEq loc ev fn tys1 ty2 -- ev :: F tys1 ~ ty2 ; mb <- rewriteCtFlavor ev (mkTcEqPred fam_head xi2) xco ; case mb of { Nothing -> return Stop ; - Just new_ev -> continueWith new_ct --- | isTcReflCo xco -> continueWith new_ct --- | otherwise -> do { updWorkListTcS (extendWorkListFunEq new_ct); return Stop } - where - new_ct = CFunEqCan { cc_ev = new_ev, cc_loc = loc - , cc_fun = fn, cc_tyargs = xis1, cc_rhs = xi2 } } } + Just new_ev -> continueWith (CFunEqCan { cc_ev = new_ev, cc_loc = loc + , cc_fun = fn, cc_tyargs = xis1, cc_rhs = xi2 }) } } canEqLeafTyVarEq :: CtLoc -> CtEvidence -> TcTyVar -> TcType -> TcS StopOrContinue +-- Precondition: LHS and RHS have compatible kinds +-- (guaranteed by canEqLeaf0 canEqLeafTyVarEq loc ev tv s2 -- ev :: tv ~ s2 = do { traceTcS "canEqLeafTyVarEq" $ pprEq (mkTyVarTy tv) s2 ; let flav = ctEvFlavour ev @@ -1146,7 +1134,7 @@ canEqLeafTyVarEq loc ev tv s2 -- ev :: tv ~ s2 do { mb <- rewriteCtFlavor ev (mkTcEqPred xi1 xi2) co ; case mb of Nothing -> return Stop - Just new_ev -> canEq loc new_ev xi1 xi2 } ; + Just new_ev -> canEqNC loc new_ev xi1 xi2 } ; (Just tv1', Just tv2') | tv1' == tv2' -> do { when (isWanted ev) $ @@ -1183,6 +1171,24 @@ mkHdEqPred t2 co1 co2 = mkTcTyConAppCo eqTyCon [mkTcReflCo (defaultKind (typeKin -- Why defaultKind? Same reason as the comment on TcType/mkTcEqPred. I truly hate this (DV) \end{code} +Note [Equalities with incompatible kinds] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +canEqLeaf is about to make a CTyEqCan or CFunEqCan; but both have the +invariant that LHS and RHS have `compatKind` kinds. What if we try +to unify two things with incompatible kinds? +eg a ~ b where a::*, b::*->* +or a ~ b where a::*, b::k, k is a kind variable + +The CTyEqCan compatKind invariant is important. If we make a CTyEqCan +for a~b, then we might well *substitute* 'b' for 'a', and that might make +a well-kinded type ill-kinded; and that is bad (eg typeKind can crash, see +Trac #7696). + +So instead for these ill-kinded equalities we generate a CIrredCan, +which keeps it out of the way until a subsequent substitution (on kind +variables, say) re-activates it. + + Note [Type synonyms and canonicalization] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We treat type synonym applications as xi types, that is, they do not diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs index fa3ba10333..0a68584483 100644 --- a/compiler/typecheck/TcInteract.lhs +++ b/compiler/typecheck/TcInteract.lhs @@ -238,6 +238,7 @@ thePipeline = [ ("canonicalization", TcCanonical.canonicalize) \begin{code} spontaneousSolveStage :: SimplifierStage +-- CTyEqCans are always consumed, returning Stop spontaneousSolveStage workItem = do { mb_solved <- trySpontaneousSolve workItem ; case mb_solved of diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs index e70f67422d..8331b62621 100644 --- a/compiler/typecheck/TcRnTypes.lhs +++ b/compiler/typecheck/TcRnTypes.lhs @@ -881,13 +881,12 @@ data Ct cc_loc :: CtLoc } - | CIrredEvCan { -- These stand for yet-unknown predicates + | CIrredEvCan { -- These stand for yet-unusable predicates cc_ev :: CtEvidence, -- See Note [Ct/evidence invariant] - -- In CIrredEvCan, the ctev_pred of the evidence is flat - -- and hence it may only be of the form (tv xi1 xi2 ... xin) - -- Since, if it were a type constructor application, that'd make the - -- whole constraint a CDictCan, or CTyEqCan. And it can't be - -- a type family application either because it's a Xi type. + -- The ctev_pred of the evidence is + -- of form (tv xi1 xi2 ... xin) + -- or (t1 ~ t2) where not (kind(t1) `compatKind` kind(t2) + -- See Note [CIrredEvCan constraints] cc_loc :: CtLoc } @@ -904,8 +903,8 @@ data Ct } | CFunEqCan { -- F xis ~ xi - -- Invariant: * isSynFamilyTyCon cc_fun - -- * typeKind (F xis) `compatKind` typeKind xi + -- Invariant: * isSynFamilyTyCon cc_fun + -- * typeKind (F xis) `compatKind` typeKind xi cc_ev :: CtEvidence, -- See Note [Ct/evidence invariant] cc_fun :: TyCon, -- A type function cc_tyargs :: [Xi], -- Either under-saturated or exactly saturated @@ -913,7 +912,6 @@ data Ct -- we should have decomposed) cc_loc :: CtLoc - } | CNonCanonical { -- See Note [NonCanonical Semantics] @@ -928,6 +926,23 @@ data Ct } \end{code} +Note [CIrredEvCan constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CIrredEvCan constraints are used for constraints that are "stuck" + - we can't solve them (yet) + - we can't use them to solve other constraints + - but they may become soluble if we substitute for some + of the type variables in the constraint + +Example 1: (c Int), where c :: * -> Constraint. We can't do anything + with this yet, but if later c := Num, *then* we can solve it + +Example 2: a ~ b, where a :: *, b :: k, where k is a kind variable + We don't want to use this to substitute 'b' for 'a', in case + 'k' is subequently unifed with (say) *->*, because then + we'd have ill-kinded types floating about. Rather we want + to defer using the equality altogether until 'k' get resolved. + Note [Ct/evidence invariant] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If ct :: Ct, then extra fields of 'ct' cache precisely the ctev_pred field diff --git a/compiler/typecheck/TcSMonad.lhs b/compiler/typecheck/TcSMonad.lhs index 2f3233af08..14ec1bad4d 100644 --- a/compiler/typecheck/TcSMonad.lhs +++ b/compiler/typecheck/TcSMonad.lhs @@ -849,10 +849,13 @@ extractRelevantInerts :: Ct -> TcS Cts -- NB: This function contains logic specific to the constraint solver, maybe move there? extractRelevantInerts wi = modifyInertTcS (extract_relevants wi) - where extract_relevants wi is + where + extract_relevants :: Ct -> InertSet -> (Cts,InertSet) + extract_relevants wi is = let (cts,ics') = extract_ics_relevants wi (inert_cans is) in (cts, is { inert_cans = ics' }) + extract_ics_relevants :: Ct -> InertCans -> (Cts, InertCans) extract_ics_relevants (CDictCan {cc_class = cl}) ics = let (cts,dict_map) = getRelevantCts cl (inert_dicts ics) in (cts, ics { inert_dicts = dict_map }) diff --git a/compiler/types/Kind.lhs b/compiler/types/Kind.lhs index aa99aacd29..0082a33377 100644 --- a/compiler/types/Kind.lhs +++ b/compiler/types/Kind.lhs @@ -239,30 +239,35 @@ isSubKindCon kc1 kc2 | isOpenTypeKindCon kc2 = isSubOpenTypeKindCon kc1 | isConstraintKindCon kc1 = isLiftedTypeKindCon kc2 | isLiftedTypeKindCon kc1 = isConstraintKindCon kc2 - | otherwise = False -- See Note [Kind Constraint and kind *] + | otherwise = False ------------------------- -- Hack alert: we need a tiny variant for the typechecker -- Reason: f :: Int -> (a~b) -- g :: forall (c::Constraint). Int -> c +-- h :: Int => Int -- We want to reject these, even though Constraint is -- a sub-kind of OpenTypeKind. It must be a sub-kind of OpenTypeKind -- *after* the typechecker -- a) So that (Ord a -> Eq a) is a legal type -- b) So that the simplifer can generate (error (Eq a) "urk") +-- Moreover, after the type checker, Constraint and * +-- are identical; see Note [Kind Constraint and kind *] -- --- Easiest way to reject is simply to make Constraint not +-- Easiest way to reject is simply to make Constraint a compliete -- below OpenTypeKind when type checking tcIsSubKind :: Kind -> Kind -> Bool tcIsSubKind k1 k2 | isConstraintKind k1 = isConstraintKind k2 + | isConstraintKind k2 = isConstraintKind k1 | otherwise = isSubKind k1 k2 tcIsSubKindCon :: TyCon -> TyCon -> Bool tcIsSubKindCon kc1 kc2 | isConstraintKindCon kc1 = isConstraintKindCon kc2 + | isConstraintKindCon kc2 = isConstraintKindCon kc1 | otherwise = isSubKindCon kc1 kc2 ------------------------- diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index 090ce41f30..9e21326369 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -10,7 +10,8 @@ module Platform ( ArmABI(..), target32Bit, - osElfTarget + osElfTarget, + platformUsesFrameworks, ) where @@ -60,6 +61,7 @@ data OS = OSUnknown | OSLinux | OSDarwin + | OSiOS | OSSolaris2 | OSMinGW32 | OSFreeBSD @@ -107,6 +109,7 @@ osElfTarget OSOpenBSD = True osElfTarget OSNetBSD = True osElfTarget OSSolaris2 = True osElfTarget OSDarwin = False +osElfTarget OSiOS = False osElfTarget OSMinGW32 = False osElfTarget OSKFreeBSD = True osElfTarget OSHaiku = True @@ -120,3 +123,11 @@ osElfTarget OSUnknown = False -- portability, otherwise we have to answer this question for every -- new platform we compile on (even unreg). +osUsesFrameworks :: OS -> Bool +osUsesFrameworks OSDarwin = True +osUsesFrameworks OSiOS = True +osUsesFrameworks _ = False + +platformUsesFrameworks :: Platform -> Bool +platformUsesFrameworks = osUsesFrameworks . platformOS + diff --git a/configure.ac b/configure.ac index 4ae2f44787..56732b4732 100644 --- a/configure.ac +++ b/configure.ac @@ -851,18 +851,6 @@ dnl ** check for eventfd which is needed by the I/O manager AC_CHECK_HEADERS([sys/eventfd.h]) AC_CHECK_FUNCS([eventfd]) -# test for GTK+ -AC_PATH_PROGS([GTK_CONFIG], [pkg-config]) -if test -n "$GTK_CONFIG"; then - if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then - GTK_CONFIG="$GTK_CONFIG gtk+-2.0" - else - AC_MSG_WARN([GTK+ not usable, need at least version 2.0]) - GTK_CONFIG= - fi -fi -AC_SUBST([GTK_CONFIG]) - # checking for PAPI AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO) AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO]) diff --git a/driver/ghc/ghc.mk b/driver/ghc/ghc.mk index 688a3f6a47..31df04a988 100644 --- a/driver/ghc/ghc.mk +++ b/driver/ghc/ghc.mk @@ -10,11 +10,11 @@ # # ----------------------------------------------------------------------------- -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" driver/ghc_dist_C_SRCS = ghc.c ../utils/cwrapper.c ../utils/getLocation.c driver/ghc_dist_CC_OPTS += -I driver/utils -driver/ghc_dist_PROG = ghc-$(ProjectVersion) +driver/ghc_dist_PROGNAME = ghc-$(ProjectVersion) driver/ghc_dist_INSTALL = YES driver/ghc_dist_INSTALL_INPLACE = NO diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk index 4b41849a21..736b7a927d 100644 --- a/driver/ghci/ghc.mk +++ b/driver/ghci/ghc.mk @@ -10,7 +10,8 @@ # # ----------------------------------------------------------------------------- -ifneq "$(Windows)" "YES" +ifeq "$(GhcWithInterpreter)" "YES" +ifneq "$(Windows_Host)" "YES" install: install_driver_ghci @@ -26,11 +27,11 @@ install_driver_ghci: $(call removeFiles,"$(DESTDIR)$(bindir)/ghci") $(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci" -else # Windows... +else # Windows_Host... 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_PROGNAME = ghci driver/ghci_dist_INSTALL = YES driver/ghci_dist_INSTALL_INPLACE = YES driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res @@ -62,4 +63,5 @@ install_driver_ghcii: $(EXECUTABLE_FILE) $(GHCII_SCRIPT_VERSIONED) endif +endif diff --git a/driver/haddock/ghc.mk b/driver/haddock/ghc.mk index f95559ce8f..3fe7174353 100644 --- a/driver/haddock/ghc.mk +++ b/driver/haddock/ghc.mk @@ -10,11 +10,11 @@ # # ----------------------------------------------------------------------------- -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" driver/haddock_dist_C_SRCS = haddock.c ../utils/cwrapper.c ../utils/getLocation.c driver/haddock_dist_CC_OPTS += -I driver/utils -driver/haddock_dist_PROG = haddock-$(ProjectVersion) +driver/haddock_dist_PROGNAME = haddock-$(ProjectVersion) driver/haddock_dist_INSTALL = YES driver/haddock_dist_INSTALL_INPLACE = NO diff --git a/driver/split/ghc.mk b/driver/split/ghc.mk index 0272652856..461dd5ac62 100644 --- a/driver/split/ghc.mk +++ b/driver/split/ghc.mk @@ -11,9 +11,10 @@ # ----------------------------------------------------------------------------- driver/split_PERL_SRC = ghc-split.lprl -driver/split_dist_PROG = $(GHC_SPLIT_PGM) +driver/split_dist_PROGNAME = ghc-split driver/split_dist_TOPDIR = YES -driver/split_dist_INSTALL_IN = $(DESTDIR)$(topdir) +driver/split_dist_INSTALL = YES +driver/split_dist_INSTALL_INPLACE = YES $(eval $(call build-perl,driver/split,dist)) @@ -271,7 +271,7 @@ include rules/build-package.mk include rules/build-package-way.mk include rules/haddock.mk include rules/tags-package.mk -include rules/extra-packages.mk +include rules/foreachLibrary.mk # ----------------------------------------------------------------------------- # Registering hand-written package descriptions (used in rts) @@ -322,138 +322,130 @@ endif @: # ----------------------------------------------------------------------------- -# Properties of packages +# Packages to build +# The lists of packages that we *actually* going to build in each stage: +# +# $(PACKAGES_STAGE0) +# $(PACKAGES_STAGE1) +# $(PACKAGES_STAGE2) +# +# Note that we need to add them to these variables in dependency +# order, as this is the order that they get configured in. -# These lists say "if this package is built, here's a property it has" -# They do not say "this package will be built"; see $(PACKAGES_STAGExx) for that +ifeq "$(CLEANING)" "YES" -# Packages that are built but not installed -PKGS_THAT_ARE_INTREE_ONLY := haskeline terminfo xhtml +define addLibraryForCleaning +# We just add all packages to both the stage 0 and stage 1 lists. +# Stage 2 gets cleaned in the same way as stage 1, so no need to +# add it there. +PACKAGES_STAGE0 += $1 +PACKAGES_STAGE1 += $1 +endef +$(eval $(call foreachLibrary,addLibraryForCleaning)) -PKGS_THAT_ARE_DPH := \ - dph/dph-base \ - dph/dph-prim-interface dph/dph-prim-seq dph/dph-prim-par \ - dph/dph-lifted-base \ - dph/dph-lifted-boxed dph/dph-lifted-copy dph/dph-lifted-vseg \ - vector primitive random +else -# Packages that, if present, must be built by the stage2 compiler, -# because they use TH and/or annotations, or depend on other stage2 -# packages: -PKGS_THAT_BUILD_WITH_STAGE2 := $(PKGS_THAT_ARE_DPH) -ifeq "$(CrossCompiling)" "NO" -# We cannot use the stage 2 compiler, it runs on $(TARGETPLATFORM) -PKGS_THAT_BUILD_WITH_STAGE2 += old-time haskell98 haskell2010 +# Packages that are built by stage0. These packages are dependencies of +# programs such as GHC and ghc-pkg, that we do not assume the stage0 +# compiler already has installed (or up-to-date enough). + +PACKAGES_STAGE0 = Cabal/Cabal hpc bin-package-db hoopl transformers +ifeq "$(Windows_Host)" "NO" +ifneq "$(HostOS_CPP)" "ios" +PACKAGES_STAGE0 += terminfo +endif endif -# Packages that we shouldn't build if we don't have TH (e.g. because -# we're building a profiled compiler): -PKGS_THAT_USE_TH := $(PKGS_THAT_ARE_DPH) +PACKAGES_STAGE1 += ghc-prim +PACKAGES_STAGE1 += $(INTEGER_LIBRARY) +PACKAGES_STAGE1 += base +PACKAGES_STAGE1 += filepath +PACKAGES_STAGE1 += array +PACKAGES_STAGE1 += deepseq +PACKAGES_STAGE1 += bytestring +PACKAGES_STAGE1 += containers +PACKAGES_STAGE1 += old-locale -# Packages that are built by stage0, in addition to stage1. These -# packages are dependencies of GHC, that we do not assume the stage0 -# compiler already has installed (or up-to-date enough). -# -# We assume that the stage0 compiler has a suitable bytestring package, -# so we don't have to include it below. -PKGS_THAT_BUILD_WITH_STAGE0 = Cabal/Cabal hpc bin-package-db hoopl transformers -ifeq "$(Windows)" "NO" -PKGS_THAT_BUILD_WITH_STAGE0 += terminfo +ifeq "$(Windows_Host)" "YES" +PACKAGES_STAGE1 += Win32 +endif +PACKAGES_STAGE1 += time +ifeq "$(Windows_Host)" "NO" +PACKAGES_STAGE1 += unix endif -# $(EXTRA_PACKAGES) is another classification, of packages built but -# not installed -# It is set in rules/extra-package.mk, -# by $(call extra-packages) a little further down -# this ghc.mk +PACKAGES_STAGE1 += directory +PACKAGES_STAGE1 += process +PACKAGES_STAGE1 += hpc +PACKAGES_STAGE1 += pretty +PACKAGES_STAGE1 += template-haskell +PACKAGES_STAGE1 += Cabal/Cabal +PACKAGES_STAGE1 += binary +PACKAGES_STAGE1 += bin-package-db +PACKAGES_STAGE1 += hoopl +PACKAGES_STAGE1 += transformers +ifneq "$(CrossCompiling)" "YES" +PACKAGES_STAGE2 += old-time +PACKAGES_STAGE2 += haskell98 +PACKAGES_STAGE2 += haskell2010 +endif +# We normally install only the packages down to this point +REGULAR_INSTALL_PACKAGES := $(addprefix libraries/,$(PACKAGES_STAGE1)) +ifeq "$(Stage1Only)" "NO" +REGULAR_INSTALL_PACKAGES += compiler +endif +REGULAR_INSTALL_PACKAGES += $(addprefix libraries/,$(PACKAGES_STAGE2)) -# ---------------------------------------------------------------------------- -# Packages to build -# The lists of packages that we *actually* going to build in each stage: -# -# $(PACKAGES_STAGE0) -# $(PACKAGES_STAGE1) -# $(PACKAGES_STAGE2) -# -# These are automatically derived from -# (a) the set of packages in this source tree -# (b) the predicates above, e.g. $(PKGS_THAT_BUILD_WITH_STAGE2) -# (c) which platform we're on, and a few other things - - -# no processing to do on this one: it really is the list of packages -# to build with stage 0. -PACKAGES_STAGE0 = $(PKGS_THAT_BUILD_WITH_STAGE0) - -define addPackageGeneral -# args: $1 = PACKAGES variable, $2 = package, $3 = condition - ifeq "$3" "" - $1 += $2 - else - ifeq "$$(CLEANING)" "YES" - $1 += $2 - else - ifeq $3 - $1 += $2 - endif - endif - endif -endef +PACKAGES_STAGE1 += xhtml +ifeq "$(Windows_Target)" "NO" +ifneq "$(TargetOS_CPP)" "ios" +PACKAGES_STAGE1 += terminfo +endif +endif +PACKAGES_STAGE1 += haskeline + +# If we have built the programs with dynamic libraries, then +# ghc will be dynamically linked against haskeline.so etc, so +# we need the dynamic libraries of everything down to here +REGULAR_INSTALL_DYNLIBS := $(addprefix libraries/,$(PACKAGES_STAGE1)) +REGULAR_INSTALL_DYNLIBS += $(addprefix libraries/,$(PACKAGES_STAGE2)) +REGULAR_INSTALL_DYNLIBS := $(filter-out $(REGULAR_INSTALL_PACKAGES),\ + $(REGULAR_INSTALL_DYNLIBS)) -define addPackage # args: $1 = package, $2 = condition -ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES" -ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1" ifneq "$(CrossCompiling)" "YES" -$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2) -endif +define addExtraPackage +ifeq "$2" "-" +# Do nothing; this package is already handled above +else ifeq "$2 $$(GhcProfiled)" "dph YES" +# Ignore the package: These packages need TH, which is incompatible +# with a profiled GHC else -$(call addPackageGeneral,PACKAGES_STAGE1,$1,$2) -endif +PACKAGES_STAGE2 += $1 endif endef +$(eval $(call foreachLibrary,addExtraPackage)) +endif -# Add all the packages. Note that we need to add them in dependency -# order, as this is the order that they get configured in. +# If we want to just install evreything, then we want all the packages +SUPERSIZE_INSTALL_PACKAGES := $(addprefix libraries/,$(PACKAGES_STAGE1)) +ifeq "$(Stage1Only)" "NO" +SUPERSIZE_INSTALL_PACKAGES += compiler +endif +SUPERSIZE_INSTALL_PACKAGES += $(addprefix libraries/,$(PACKAGES_STAGE2)) -$(eval $(call addPackage,ghc-prim)) -ifeq "$(CLEANING)" "YES" -$(eval $(call addPackage,integer-gmp)) -$(eval $(call addPackage,integer-simple)) +INSTALL_DYNLIBS := +ifeq "$(InstallExtraPackages)" "NO" +INSTALL_PACKAGES := $(REGULAR_INSTALL_PACKAGES) +ifeq "$(DYNAMIC_BY_DEFAULT)" "YES" +INSTALL_DYNLIBS := $(REGULAR_INSTALL_DYNLIBS) +endif else -$(eval $(call addPackage,$(INTEGER_LIBRARY))) -endif -$(eval $(call addPackage,base)) -$(eval $(call addPackage,filepath)) -$(eval $(call addPackage,array)) -$(eval $(call addPackage,deepseq)) -$(eval $(call addPackage,bytestring)) -$(eval $(call addPackage,containers)) -$(eval $(call addPackage,old-locale)) -$(eval $(call addPackage,old-time)) - -$(eval $(call addPackage,Win32,($$(Windows),YES))) -$(eval $(call addPackage,time)) -$(eval $(call addPackage,unix,($$(Windows),NO))) - -$(eval $(call addPackage,directory)) -$(eval $(call addPackage,process)) -$(eval $(call addPackage,haskell98)) -$(eval $(call addPackage,haskell2010)) -$(eval $(call addPackage,hpc)) -$(eval $(call addPackage,pretty)) -$(eval $(call addPackage,template-haskell)) -$(eval $(call addPackage,Cabal/Cabal)) -$(eval $(call addPackage,binary)) -$(eval $(call addPackage,bin-package-db)) -$(eval $(call addPackage,hoopl)) -$(eval $(call addPackage,transformers)) -$(eval $(call addPackage,xhtml)) -$(eval $(call addPackage,terminfo,($$(Windows),NO))) -$(eval $(call addPackage,haskeline)) - -$(eval $(call extra-packages)) +INSTALL_PACKAGES := $(SUPERSIZE_INSTALL_PACKAGES) +endif + +endif # ------------------------------------------- # Dependencies between package-data.mk files @@ -519,6 +511,24 @@ ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-inst endif BOOT_LIBS = $(foreach lib,$(PACKAGES_STAGE0),$(libraries/$(lib)_dist-boot_v_LIB)) +# ----------------------------------------------- +# Haddock-related bits + +# Run Haddock for the packages that will be installed. We need to handle +# compiler specially due to the different dist directory name. +$(foreach p,$(INSTALL_PACKAGES),$(eval $p_dist-install_DO_HADDOCK = YES)) +compiler_stage2_DO_HADDOCK = YES + +# Build the Haddock contents and index +ifeq "$(HADDOCK_DOCS)" "YES" +libraries/dist-haddock/index.html: inplace/bin/haddock$(exeext) $(ALL_HADDOCK_FILES) + cd libraries && sh gen_contents_index --intree +ifeq "$(phase)" "final" +$(eval $(call all-target,library_doc_index,libraries/dist-haddock/index.html)) +endif +INSTALL_LIBRARY_DOCS += libraries/dist-haddock/* +endif + # ---------------------------------------- # Special magic for the ghc-prim package @@ -539,8 +549,8 @@ endef PRIMOPS_TXT_STAGE1 = compiler/stage1/build/primops.txt -libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT_STAGE1) | $$(dir $$@)/. - "$(GENPRIMOP_INPLACE)" --make-haskell-wrappers < $(PRIMOPS_TXT_STAGE1) >$@ +libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $$(genprimopcode_INPLACE) $(PRIMOPS_TXT_STAGE1) | $$(dir $$@)/. + "$(genprimopcode_INPLACE)" --make-haskell-wrappers < $(PRIMOPS_TXT_STAGE1) >$@ # Required so that Haddock documents the primops. libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs @@ -574,57 +584,52 @@ endif # Include build instructions from all subdirs ifneq "$(BINDIST)" "YES" -BUILD_DIRS += \ - $(GHC_MKDIRHIER_DIR) +BUILD_DIRS += utils/mkdirhier endif -ifeq "$(Windows)" "YES" -BUILD_DIRS += \ - $(GHC_TOUCHY_DIR) +ifeq "$(Windows_Host)" "YES" +BUILD_DIRS += utils/touchy endif -BUILD_DIRS += \ - docs/users_guide \ - docs/man \ - $(GHC_UNLIT_DIR) \ - $(GHC_HP2PS_DIR) +BUILD_DIRS += docs/users_guide +BUILD_DIRS += docs/man +BUILD_DIRS += utils/unlit +BUILD_DIRS += utils/hp2ps ifneq "$(GhcUnregisterised)" "YES" -BUILD_DIRS += \ - $(GHC_SPLIT_DIR) +BUILD_DIRS += driver/split endif ifneq "$(BINDIST)" "YES" -BUILD_DIRS += \ - $(GHC_GENPRIMOP_DIR) -endif - -ifeq "$(Stage1Only)-$(phase)" "YES-final" -MAYBE_GHCI= -else -MAYBE_GHCI=driver/ghci +BUILD_DIRS += utils/genprimopcode endif -BUILD_DIRS += \ - driver \ - $(MAYBE_GHCI) \ - driver/ghc \ - driver/haddock \ - libffi \ - includes \ - rts +BUILD_DIRS += driver +BUILD_DIRS += driver/ghci +BUILD_DIRS += driver/ghc +BUILD_DIRS += driver/haddock +BUILD_DIRS += libffi +BUILD_DIRS += includes +BUILD_DIRS += rts ifneq "$(BINDIST)" "YES" -BUILD_DIRS += \ - bindisttest \ - $(GHC_GENAPPLY_DIR) +BUILD_DIRS += bindisttest +BUILD_DIRS += utils/genapply endif ifneq "$(CLEANING)" "YES" -BUILD_DIRS += \ - $(patsubst %, libraries/%, $(PACKAGES_STAGE1)) +# These are deliberately in reverse order, so as to ensure that +# there is no need to have them in dependency order. That's important +# because it's tricky to ensure that they are in dependency order when +# cross-compiling, as some packages may only be in PACKAGES_STAGE0 +# or PACKAGES_STAGE1. +BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) +BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE1)) +BUILD_DIRS += $(patsubst %, libraries/%, $(filter-out $(PACKAGES_STAGE1),$(PACKAGES_STAGE0))) +BUILD_DIRS += $(wildcard libraries/dph) endif + ifeq "$(INTEGER_LIBRARY)" "integer-gmp" BUILD_DIRS += libraries/integer-gmp/gmp else ifneq "$(findstring clean,$(MAKECMDGOALS))" "" @@ -641,47 +646,33 @@ MAYBE_HPC=utils/hpc MAYBE_RUNGHC=utils/runghc endif -BUILD_DIRS += \ - utils/haddock \ - utils/haddock/doc \ - compiler \ - $(GHC_HSC2HS_DIR) \ - $(GHC_PKG_DIR) \ - utils/deriveConstants \ - utils/testremove \ - $(MAYBE_GHCTAGS) \ - utils/ghc-pwd \ - $(GHC_CABAL_DIR) \ - $(MAYBE_HPC) \ - $(MAYBE_RUNGHC) \ - ghc +BUILD_DIRS += utils/haddock +BUILD_DIRS += utils/haddock/doc +BUILD_DIRS += compiler +BUILD_DIRS += utils/hsc2hs +BUILD_DIRS += utils/ghc-pkg +BUILD_DIRS += utils/deriveConstants +BUILD_DIRS += utils/testremove +BUILD_DIRS += $(MAYBE_GHCTAGS) +BUILD_DIRS += utils/ghc-pwd +BUILD_DIRS += utils/ghc-cabal +BUILD_DIRS += $(MAYBE_HPC) +BUILD_DIRS += $(MAYBE_RUNGHC) +BUILD_DIRS += ghc ifneq "$(BINDIST)" "YES" ifneq "$(CrossCompiling)-$(phase)" "YES-final" -BUILD_DIRS += \ - utils/mkUserGuidePart +BUILD_DIRS += utils/mkUserGuidePart endif endif BUILD_DIRS += utils/count_lines BUILD_DIRS += utils/compare_sizes -ifneq "$(CLEANING)" "YES" -# After compiler/, because these packages depend on it -BUILD_DIRS += \ - $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) -endif - # ---------------------------------------------- # Actually include all the sub-ghc.mk's -# BUILD_DIRS_EXTRA needs to come after BUILD_DIRS, because stuff in -# libraries/dph/ghc.mk refers to stuff defined earlier, in particular -# things like $(libraries/dph/dph-base_dist-install_GHCI_LIB) -ifeq "$(GhcProfiled)" "YES" -BUILD_DIRS_EXTRA := $(filter-out libraries/dph,$(BUILD_DIRS_EXTRA)) -endif -include $(patsubst %, %/ghc.mk, $(BUILD_DIRS) $(BUILD_DIRS_EXTRA)) +include $(patsubst %, %/ghc.mk, $(BUILD_DIRS)) # A useful pseudo-target (must be after the include above, because it needs # the value of things like $(libraries/base_dist-install_v_LIB). @@ -703,24 +694,6 @@ $(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist # Add $(GhcBootLibHcOpts) to all stage0 package builds $(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts))) -# ----------------------------------------------- -# Haddock-related bits - -# Don't run Haddock for the package that will not be installed -$(foreach p,$(PKGS_THAT_ARE_INTREE_ONLY),$(eval libraries/$p_dist-install_DO_HADDOCK = NO)) -# We don't haddock the bootstrapping libraries -$(foreach p,$(PACKAGES_STAGE0),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO)) - -# Build the Haddock contents and index -ifeq "$(HADDOCK_DOCS)" "YES" -libraries/dist-haddock/index.html: inplace/bin/haddock$(exeext) $(ALL_HADDOCK_FILES) - cd libraries && sh gen_contents_index --intree -ifeq "$(phase)" "final" -$(eval $(call all-target,library_doc_index,libraries/dist-haddock/index.html)) -endif -INSTALL_LIBRARY_DOCS += libraries/dist-haddock/* -endif - # ----------------------------------------------------------------------------- # Bootstrapping libraries @@ -774,7 +747,7 @@ endif # ----------------------------------------------------------------------------- # Creating a local mingw copy on Windows -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" install : install_mingw .PHONY: install_mingw @@ -786,7 +759,7 @@ install : install_perl install_perl : $(INPLACE_PERL) "$(CP)" -Rp $(INPLACE_PERL) $(prefix) -endif # Windows +endif # Windows_Host ifneq "$(BINDIST)" "YES" $(ghc-prim-$(libraries/ghc-prim_dist-install_VERSION)_HADDOCK_FILE): \ @@ -794,9 +767,9 @@ $(ghc-prim-$(libraries/ghc-prim_dist-install_VERSION)_HADDOCK_FILE): \ endif # BINDIST libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \ - $(PRIMOPS_TXT_STAGE1) $(GENPRIMOP_INPLACE) \ + $(PRIMOPS_TXT_STAGE1) $$(genprimopcode_INPLACE) \ | $$(dir $$@)/. - "$(GENPRIMOP_INPLACE)" --make-haskell-source < $< > $@ + "$(genprimopcode_INPLACE)" --make-haskell-source < $< > $@ .PHONY: tags tags: tags_compiler @@ -891,7 +864,7 @@ 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" +ifeq "$(Windows_Host)" "NO" INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg else @@ -899,20 +872,8 @@ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe endif -INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1)) -ifeq "$(Stage1Only)" "NO" -INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) compiler -endif -INSTALLED_PKG_DIRS := $(INSTALLED_PKG_DIRS) $(addprefix libraries/,$(PACKAGES_STAGE2)) -ifeq "$(InstallExtraPackages)" "NO" -INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(EXTRA_PACKAGES)),\ - $(INSTALLED_PKG_DIRS)) -endif -INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(PKGS_THAT_ARE_INTREE_ONLY)),\ - $(INSTALLED_PKG_DIRS)) - # Set the INSTALL_DISTDIR_p for each package; compiler is special -$(foreach p,$(filter-out compiler,$(INSTALLED_PKG_DIRS)),\ +$(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\ $(eval INSTALL_DISTDIR_$p = dist-install)) INSTALL_DISTDIR_compiler = stage2 @@ -924,13 +885,11 @@ install_packages: rts/package.conf.install $(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), \ + $(foreach p, $(INSTALL_DYNLIBS), \ $(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), \ + $(foreach p, $(INSTALL_PACKAGES), \ $(call make-command, \ - "$(GHC_CABAL_INPLACE)" copy \ + "$(ghc-cabal_INPLACE)" copy \ "$(STRIP_CMD)" \ $p $(INSTALL_DISTDIR_$p) \ '$(DESTDIR)' \ @@ -938,9 +897,9 @@ endif '$(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), \ + $(foreach p, $(INSTALL_PACKAGES), \ $(call make-command, \ - "$(GHC_CABAL_INPLACE)" register \ + "$(ghc-cabal_INPLACE)" register \ "$(INSTALLED_GHC_REAL)" \ "$(INSTALLED_GHC_PKG_REAL)" \ "$(DESTDIR)$(topdir)" \ @@ -1021,12 +980,11 @@ unix-binary-dist-prep: "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK) - echo "LATEX_DOCS = $(LATEX_DOCS)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_PS = $(BUILD_DOCBOOK_PS)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_PDF = $(BUILD_DOCBOOK_PDF)" >> $(BIN_DIST_MK) echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK) - echo "GHC_CABAL_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK) + echo "override ghc-cabal_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK) echo "UseSystemLibFFI = $(UseSystemLibFFI)" >> $(BIN_DIST_MK) cd $(BIN_DIST_PREP_DIR) && autoreconf $(call removeFiles,$(BIN_DIST_PREP_TAR)) diff --git a/ghc/ghc.mk b/ghc/ghc.mk index 5c37115886..44dd126d37 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -72,9 +72,9 @@ ifeq "$(GhcProfiled)" "YES" ghc_stage2_PROGRAM_WAY = p endif -ghc_stage1_PROG = ghc-stage1$(exeext) -ghc_stage2_PROG = ghc-stage2$(exeext) -ghc_stage3_PROG = ghc-stage3$(exeext) +ghc_stage1_PROGNAME = ghc-stage1 +ghc_stage2_PROGNAME = ghc-stage2 +ghc_stage3_PROGNAME = ghc-stage3 ghc_stage1_SHELL_WRAPPER = YES ghc_stage2_SHELL_WRAPPER = YES @@ -141,7 +141,7 @@ $(INPLACE_LIB)/platformConstants: $(includes_GHCCONSTANTS_HASKELL_VALUE) # The GHC programs need to depend on all the helper programs they might call, # and the settings files they use -GHC_DEPENDENCIES += $(UNLIT) +GHC_DEPENDENCIES += $$(unlit_INPLACE) GHC_DEPENDENCIES += $(INPLACE_LIB)/settings GHC_DEPENDENCIES += $(INPLACE_LIB)/platformConstants @@ -150,22 +150,22 @@ $(GHC_STAGE2) : | $(GHC_DEPENDENCIES) $(GHC_STAGE3) : | $(GHC_DEPENDENCIES) ifeq "$(GhcUnregisterised)" "NO" -$(GHC_STAGE1) : | $(SPLIT) -$(GHC_STAGE2) : | $(SPLIT) -$(GHC_STAGE3) : | $(SPLIT) +$(GHC_STAGE1) : | $$(ghc-split_INPLACE) +$(GHC_STAGE2) : | $$(ghc-split_INPLACE) +$(GHC_STAGE3) : | $$(ghc-split_INPLACE) endif -ifeq "$(Windows)" "YES" -$(GHC_STAGE1) : | $(TOUCHY) -$(GHC_STAGE2) : | $(TOUCHY) -$(GHC_STAGE3) : | $(TOUCHY) +ifeq "$(Windows_Host)" "YES" +$(GHC_STAGE1) : | $$(touchy_INPLACE) +$(GHC_STAGE2) : | $$(touchy_INPLACE) +$(GHC_STAGE3) : | $$(touchy_INPLACE) endif endif INSTALL_LIBS += settings -ifeq "$(Windows)" "NO" +ifeq "$(Windows_Host)" "NO" install: install_ghc_link .PHONY: install_ghc_link install_ghc_link: diff --git a/includes/rts/prof/CCS.h b/includes/rts/prof/CCS.h index 37285672b8..33bfc306f4 100644 --- a/includes/rts/prof/CCS.h +++ b/includes/rts/prof/CCS.h @@ -26,7 +26,7 @@ int rts_isProfiled(void); * putting the 8-byte fields on an 8-byte boundary. Padding can * vary between C compilers, and we don't take into account any * possible padding when generating CCS and CC decls in the code - * generator (compiler/codeGen/CgProf.hs). + * generator (compiler/codeGen/StgCmmProf.hs). */ typedef struct CostCentre_ { diff --git a/mk/config.mk.in b/mk/config.mk.in index 4831a7c34f..16faa95e68 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -39,9 +39,6 @@ V = 1 NO_INCLUDE_DEPS = NO NO_INCLUDE_PKGDATA = NO -# Should we build latex docs? -LATEX_DOCS = NO - ################################################################################ # # Variables that control how the compiler itself is built @@ -198,7 +195,7 @@ endif # On Windows we normally want to make a relocatable bindist, to we # ignore flags like libdir -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" RelocatableBuild = YES else RelocatableBuild = NO @@ -315,10 +312,7 @@ SplitObjs=$(SupportsSplitObjs) # ---------------------------------------------------------------------------- # Package-related things -# Extra packages to add to the build, in dependency order -EXTRA_PACKAGES = - -# Whether to install $(EXTRA_PACKAGES) +# Whether to install the extra packages InstallExtraPackages = NO # Run "ghc-pkg check" on each package @@ -351,9 +345,6 @@ LAX_DEPENDENCIES = NO GhcRtsHcOpts=-O2 GhcRtsCcOpts=-O2 -fomit-frame-pointer -# Include the front panel code? Needs GTK+. -GhcRtsWithFrontPanel = NO - # Include support for CPU performance counters via the PAPI library in the RTS? # (PAPI: http://icl.cs.utk.edu/papi/) GhcRtsWithPapi = NO @@ -436,9 +427,6 @@ SRC_HC_OPTS += -H32m -O # These flags make flex 8-bit SRC_FLEX_OPTS += -8 -# Flags for CPP when running GreenCard on .pgc files -GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__ - # ----------------------------------------------------------------------------- # Names of programs in the GHC tree @@ -446,44 +434,7 @@ GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__ # xxx_PGM the name of an executable, without the path # xxx the executable relative to the current dir -GHC_UNLIT_PGM = unlit$(exeext) -GHC_HP2PS_PGM = hp2ps$(exeext) -GHC_GHCTAGS_PGM = ghctags$(exeext) -GHC_HSC2HS_PGM = hsc2hs$(exeext) -GHC_TOUCHY_PGM = touchy$(exeext) -GHC_SPLIT_PGM = ghc-split -GHC_SYSMAN_PGM = SysMan -GHC_GENPRIMOP_PGM = genprimopcode$(exeext) -GHC_GENAPPLY_PGM = genapply$(exeext) -GHC_CABAL_PGM = ghc-cabal$(exeext) -GHC_PKG_PGM = ghc-pkg$(exeext) -GHC_LTX_PGM = ltx$(exeext) -GHC_MKDIRHIER_PGM = mkdirhier -GHC_LNDIR_PGM = lndir - -ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" -GHC_CP = "xcopy /y" -GHC_PERL = perl -else -GHC_CP = $(CP) -GHC_PERL = $(PERL) -endif - -HP2PS = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM) -SPLIT = $(INPLACE_LIB)/$(GHC_SPLIT_PGM) -SYSMAN = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM) -LTX = $(GHC_LTX_DIR)/$(GHC_LTX_PGM) -LNDIR = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM) - -UNLIT = $(INPLACE_LIB)/$(GHC_UNLIT_PGM) -TOUCHY = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM) -MKDIRHIER = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM) -GHC_CABAL_INPLACE = $(INPLACE_BIN)/$(GHC_CABAL_PGM) -GENAPPLY_INPLACE = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM) -GHC_PKG_INPLACE = $(INPLACE_BIN)/$(GHC_PKG_PGM) -GHCTAGS_INPLACE = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM) -HSC2HS_INPLACE = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM) -GENPRIMOP_INPLACE = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM) +MKDIRHIER = $(INPLACE_BIN)/mkdirhier GENERATED_FILE = chmod a-w EXECUTABLE_FILE = chmod +x @@ -510,11 +461,6 @@ endif GHC_INPLACE = $(GHC_STAGE1) -GHC_STAGE0_ABS = $(GHC) -GHC_STAGE1_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage1$(exeext) -GHC_STAGE2_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage2$(exeext) -GHC_STAGE3_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage3$(exeext) - GHC_STAGE0 = $(GHC) GHC_STAGE1 = $(INPLACE_BIN)/ghc-stage1$(exeext) GHC_STAGE2 = $(INPLACE_BIN)/ghc-stage2$(exeext) @@ -614,13 +560,23 @@ endif # The .hsc files aren't currently safe for cross-compilation on Windows: # libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160 # directive "let" is not safe for cross-compilation -ifneq "$(Windows)" "YES" +ifneq "$(Windows_Host)" "YES" SRC_HSC2HS_OPTS += --cross-safe endif -SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0))) SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d)) + +define set_stage_HSC2HS_OPTS +# $1 = stage +SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(filter-out -O,$$(SRC_CC_OPTS) $$(CONF_CC_OPTS_STAGE$1))) +SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(CONF_CPP_OPTS_STAGE$1)) +SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --lflag=,$$(CONF_GCC_LINKER_OPTS_STAGE$1)) +endef +$(eval $(call set_stage_HSC2HS_OPTS,0)) +$(eval $(call set_stage_HSC2HS_OPTS,1)) +$(eval $(call set_stage_HSC2HS_OPTS,2)) ifeq "$(CrossCompiling)" "YES" -SRC_HSC2HS_OPTS += --cross-compile +SRC_HSC2HS_OPTS_STAGE1 += --cross-compile +SRC_HSC2HS_OPTS_STAGE2 += --cross-compile endif ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" @@ -692,17 +648,12 @@ FIND = @FindCmd@ INSTALL = @INSTALL@ INSTALL := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL)) -LATEX = latex -PDFLATEX = pdflatex -BIBTEX = bibtex LN_S = @LN_S@ MV = mv -NROFF = nroff PERL = @PerlCmd@ PIC = pic RANLIB = @RANLIB@ SED = @SedCmd@ -TR = tr SHELL = /bin/sh HaveDtrace = @HaveDtrace@ @@ -735,34 +686,10 @@ LdHasNoCompactUnwind = @LdHasNoCompactUnwind@ # xargs: value for -s option should be < 28153 # so we now use 20000 to be comfortably below this bound XARGS = xargs -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" XARGS_OPTS = -s 20000 endif -# -# In emergency situations, REAL_SHELL is used to perform shell commands -# from within the ghc driver script, by scribbling the command line to -# a temp file and then having $(REAL_SHELL) execute it. -# -# The reason for having to do this is that overly long command lines -# cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris -# 2.5.1), which is why this backdoor is provided. The situation of overly -# long command lines is either encountered while doing `make boot' in compiler/, -# or when linking the compiler binary (`hsc'). -# -# We do not use SHELL to execute long commands, as `make' will more than likely -# override whatever setting you have in your environment while executing. - -# By default, REAL_SHELL is set equal to SHELL, which is not really a smart move -# as it is SHELL that will show up the bogosity in the first place, but setting -# it to anything else isn't really portable. -# -# ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise) -# with REAL_SHELL set to something else than /bin/sh, for instance, your favourite -# command shell. -# -REAL_SHELL = $(SHELL) - ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32" STRIP_CMD = $(TOP)/inplace/mingw/bin/strip.exe else @@ -773,7 +700,7 @@ TAR_CMD = @TarCmd@ BZIP2_CMD = bzip2 GZIP_CMD = gzip -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" TOUCH_CMD = $(utils/touchy_dist_INPLACE) TOUCH_DEP = $(TOUCH_CMD) else @@ -785,9 +712,6 @@ HSCOLOUR_CMD = @HSCOLOUR@ TIME_CMD = @TimeCmd@ -# GTK+ -GTK_CONFIG_CMD = @GTK_CONFIG@ - # Set this if you want to use Inno Setup to build a Windows installer # when you make a bindist ISCC_CMD = diff --git a/mk/project.mk.in b/mk/project.mk.in index 3625124f75..e47663fcdb 100644 --- a/mk/project.mk.in +++ b/mk/project.mk.in @@ -128,11 +128,18 @@ LeadingUnderscore=@LeadingUnderscore@ exeext=@exeext@ soext=@soext@ -# Windows=YES if on a Windows platform +# Windows_Host=YES if on a Windows platform ifneq "$(findstring $(HostOS_CPP), mingw32 cygwin32)" "" -Windows=YES +Windows_Host=YES else -Windows=NO +Windows_Host=NO +endif + +# Windows_Target=YES if we are targetting a Windows platform +ifneq "$(findstring $(TargetOS_CPP), mingw32 cygwin32)" "" +Windows_Target=YES +else +Windows_Target=NO endif # Tell the build system what the host operating system is diff --git a/mk/tree.mk b/mk/tree.mk index db14cf4127..9c2e3daa4e 100644 --- a/mk/tree.mk +++ b/mk/tree.mk @@ -17,27 +17,8 @@ endif GHC_UTILS_DIR = utils GHC_INCLUDE_DIRS = includes includes/dist includes/dist-derivedconstants/header includes/dist-ghcconstants/header -GHC_COMPILER_DIR = compiler -GHC_PROG_DIR = ghc GHC_RTS_DIR = rts GHC_DRIVER_DIR = driver -GHC_COMPAT_DIR = compat - -GHC_LTX_DIR = $(GHC_UTILS_DIR)/ltx -GHC_LNDIR_DIR = $(GHC_UTILS_DIR)/lndir -GHC_MKDIRHIER_DIR = $(GHC_UTILS_DIR)/mkdirhier -GHC_DOCBOOK_DIR = $(GHC_UTILS_DIR)/docbook -GHC_UNLIT_DIR = $(GHC_UTILS_DIR)/unlit -GHC_HP2PS_DIR = $(GHC_UTILS_DIR)/hp2ps -GHC_GHCTAGS_DIR = $(GHC_UTILS_DIR)/ghctags -GHC_HSC2HS_DIR = $(GHC_UTILS_DIR)/hsc2hs -GHC_TOUCHY_DIR = $(GHC_UTILS_DIR)/touchy -GHC_PKG_DIR = $(GHC_UTILS_DIR)/ghc-pkg -GHC_GENPRIMOP_DIR = $(GHC_UTILS_DIR)/genprimopcode -GHC_GENAPPLY_DIR = $(GHC_UTILS_DIR)/genapply -GHC_CABAL_DIR = $(GHC_UTILS_DIR)/ghc-cabal -GHC_SPLIT_DIR = $(GHC_DRIVER_DIR)/split -GHC_SYSMAN_DIR = $(GHC_RTS_DIR)/parallel INPLACE = inplace INPLACE_BIN = $(INPLACE)/bin diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 06558ae103..f570a54c25 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -97,7 +97,7 @@ static void dumpCensus( Census *census ); static rtsBool closureSatisfiesConstraints( StgClosure* p ); /* ---------------------------------------------------------------------------- - * Find the "closure identity", which is a unique pointer reresenting + * Find the "closure identity", which is a unique pointer representing * the band to which this closure's heap space is attributed in the * heap profile. * ------------------------------------------------------------------------- */ diff --git a/rts/StgCRun.c b/rts/StgCRun.c index 5789c82f8f..f0fa6c7c5e 100644 --- a/rts/StgCRun.c +++ b/rts/StgCRun.c @@ -665,7 +665,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) { /* * save callee-saves registers on behalf of the STG code. */ - "stmfd sp!, {r4-r10, fp, ip, lr}\n\t" + "stmfd sp!, {r4-r11, ip, lr}\n\t" #if !defined(arm_HOST_ARCH_PRE_ARMv6) "vstmdb sp!, {d8-d11}\n\t" #endif @@ -684,9 +684,11 @@ StgRun(StgFunPtr f, StgRegTable *basereg) { */ "bx %1\n\t" - ".global " STG_RETURN "\n\t" + ".globl " STG_RETURN "\n\t" THUMB_FUNC +#if !defined(ios_HOST_OS) ".type " STG_RETURN ", %%function\n" +#endif STG_RETURN ":\n\t" /* * Free the space we allocated @@ -702,7 +704,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) { #if !defined(arm_HOST_ARCH_PRE_ARMv6) "vldmia sp!, {d8-d11}\n\t" #endif - "ldmfd sp!, {r4-r10, fp, ip, lr}\n\t" + "ldmfd sp!, {r4-r11, ip, lr}\n\t" : "=r" (r) : "r" (f), "r" (basereg), "i" (RESERVED_C_STACK_BYTES) #if !defined(__thumb__) @@ -718,7 +720,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) { includes/stg/MachRegs.h Please note that Haskell code is compiled by GHC/LLVM into ARM code (not Thumb!), at least as of February 2012 */ - : "%r4", "%r5", "%r6", "%r8", "%r9", "%r10", "%fp", "%ip", "%lr" + : "%r4", "%r5", "%r6", "%r8", "%r9", "%r10", "%11", "%ip", "%lr" #endif ); return r; diff --git a/rts/ghc.mk b/rts/ghc.mk index a4c7acb8b7..3dc3990dcc 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -57,8 +57,8 @@ endif rts_AUTO_APPLY_CMM = rts/dist/build/AutoApply.cmm -$(rts_AUTO_APPLY_CMM): $(GENAPPLY_INPLACE) - "$(GENAPPLY_INPLACE)" >$@ +$(rts_AUTO_APPLY_CMM): $$(genapply_INPLACE) + "$(genapply_INPLACE)" >$@ rts/dist/build/sm/Evac_thr.c : rts/sm/Evac.c | $$(dir $$@)/. cp $< $@ @@ -73,8 +73,8 @@ rts_H_FILES += $(DTRACEPROBES_H) endif # collect the -l flags that we need to link the rts dyn lib. -rts/libs.depend : $(GHC_PKG_INPLACE) - "$(GHC_PKG_INPLACE)" field rts extra-libraries \ +rts/libs.depend : $$(ghc-pkg_INPLACE) + "$(ghc-pkg_INPLACE)" field rts extra-libraries \ | sed -e 's/^extra-libraries: //' -e 's/\([a-z0-9]*\)[ ]*/-l\1 /g' > $@ diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk index 7b66dcd266..7bbb8c5f36 100644 --- a/rules/build-dependencies.mk +++ b/rules/build-dependencies.mk @@ -141,7 +141,7 @@ define addCFileDeps $(foreach w,$5,sed -e 's|\\|/|g' -e 's| /$$| \\|' -e "1s|\.o|\.$($w_osuf)|" -e "1s|^|$(dir $4)|" -e "1s|$1/|$1/$2/build/|" -e "1s|$2/build/$2/build|$2/build|g" -e "s|$(TOP)/||g$(CASE_INSENSITIVE_SED)" $3.bit >> $3.tmp &&) true endef -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" CASE_INSENSITIVE_SED = i else CASE_INSENSITIVE_SED = diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index 41f7a02be1..0380f7c5e5 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -99,16 +99,16 @@ $1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk # This rule configures the package, generates the package-data.mk file # for our build system, and registers the package for use in-place in # the build tree. -$1/$2/package-data.mk : $$(GHC_CABAL_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_CONFIG_DEP) +$1/$2/package-data.mk : $$$$(ghc-cabal_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_CONFIG_DEP) # Checking packages built with the bootstrapping compiler would # generally be a waste of time. Either we will rebuild them with # stage1/stage2, or we don't really care about them. ifneq "$3" "0" ifneq "$$($1_NO_CHECK)" "YES" - "$$(GHC_CABAL_INPLACE)" check $1 + "$$(ghc-cabal_INPLACE)" check $1 endif endif - "$$(GHC_CABAL_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1 + "$$(ghc-cabal_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1 ifeq "$$($1_$2_PROG)" "" ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO" $$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config diff --git a/rules/build-perl.mk b/rules/build-perl.mk index b39134f05f..157ed2b831 100644 --- a/rules/build-perl.mk +++ b/rules/build-perl.mk @@ -14,7 +14,7 @@ # Build a perl script. Invoke like this: # # driver/mangler_PERL_SRC = ghc-asm.lprl -# driver/mangler_dist_PROG = ghc-asm +# driver/mangler_dist_PROGNAME = ghc-asm # # $(eval $(call build-perl,driver/mangler,dist)) @@ -24,12 +24,27 @@ $(call profStart, build-perl($1,$2)) # $1 = dir # $2 = distdir +ifneq "$$(CLEANING)" "YES" +ifeq "$$($1_$2_PROGNAME)" "" +$$(error $1_$2_PROGNAME is not set) +endif +ifneq "$$($1_$2_PROG)" "" +$$(error $1_$2_PROG is set) +endif +$1_$2_PROG = $$($1_$2_PROGNAME) + +ifneq "$$($$($1_$2_PROG)_INPLACE)" "" +$$(error $$($1_$2_PROG)_INPLACE defined twice) +endif ifeq "$$($1_$2_TOPDIR)" "YES" -$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG) +$$($1_$2_PROG)_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG) else -$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) +$$($1_$2_PROG)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) +endif endif +$1_$2_INPLACE = $$($$($1_$2_PROG)_INPLACE) + $(call all-target,$1_$2,$$($1_$2_INPLACE)) $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE)) @@ -39,8 +54,8 @@ clean_$1 : clean_$1_$2 # INPLACE_BIN etc. might be empty if we're cleaning ifeq "$(findstring clean,$(MAKECMDGOALS))" "" ifneq "$$(BINDIST)" "YES" -$1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$(UNLIT) | $$$$(dir $$$$@)/. - "$$(UNLIT)" $$(UNLIT_OPTS) $$< $$@ +$1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/. + "$$(unlit_INPLACE)" $$(UNLIT_OPTS) $$< $$@ endif $1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl @@ -54,16 +69,6 @@ $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/. "$$(CP)" $$< $$@ $$(EXECUTABLE_FILE) $$@ -ifneq "$$($1_$2_INSTALL_IN)" "" -BINDIST_PERL_SOURCES += $1/$2/$$($1_$2_PROG).prl - -install: install_$1_$2 - -.PHONY: install_$1_$2 -install_$1_$2: $1/$2/$$($1_$2_PROG) - $$(call INSTALL_DIR,"$$($1_$2_INSTALL_IN)") - $$(call INSTALL_SCRIPT,$$(INSTALL_OPTS),$$<,"$$($1_$2_INSTALL_IN)") -endif endif $(call profEnd, build-perl($1,$2)) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 3cea0e4839..597315983d 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -15,7 +15,7 @@ # # utils/genapply_MODULES = Main # utils/genapply_HC_OPTS = -package Cabal -# utils/genapply_dist_PROG = genapply +# utils/genapply_dist_PROGNAME = genapply # # $(eval $(call build-prog,utils/genapply,dist-install,1)) @@ -27,9 +27,13 @@ $(call profStart, build-prog($1,$2,$3)) # $3 = GHC stage to use (0 == bootstrapping compiler) ifneq "$$(CLEANING)" "YES" -ifeq "$$($1_$2_PROG)" "" -$$(error $1_$2_PROG is not set) +ifeq "$$($1_$2_PROGNAME)" "" +$$(error $1_$2_PROGNAME is not set) endif +ifneq "$$($1_$2_PROG)" "" +$$(error $1_$2_PROG is set) +endif +$1_$2_PROG = $$($1_$2_PROGNAME)$$(exeext) endif ifeq "$$(findstring $3,0 1 2)" "" @@ -54,7 +58,7 @@ ifeq "$$($1_USES_CABAL)" "YES" $1_$2_USES_CABAL = YES endif -ifeq "$$(Windows)" "YES" +ifeq "$$(Windows_Host)" "YES" $1_$2_WANT_INPLACE_WRAPPER = NO else ifneq "$$($1_$2_INSTALL_INPLACE)" "YES" $1_$2_WANT_INPLACE_WRAPPER = NO @@ -66,7 +70,7 @@ else $1_$2_WANT_INPLACE_WRAPPER = NO endif -ifeq "$$(Windows)" "YES" +ifeq "$$(Windows_Host)" "YES" $1_$2_WANT_INSTALLED_WRAPPER = NO else ifneq "$$($1_$2_INSTALL)" "YES" $1_$2_WANT_INSTALLED_WRAPPER = NO @@ -87,15 +91,21 @@ else $1_$2_INPLACE = endif else +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" +ifneq "$$($$($1_$2_PROGNAME)_INPLACE)" "" +$$(error $$($1_$2_PROGNAME)_INPLACE defined twice) +endif +endif +ifeq "$$($1_$2_TOPDIR)" "YES" +$$($1_$2_PROGNAME)_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG) +else +$$($1_$2_PROGNAME)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) +endif # Where do we install the inplace version? 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) -else -$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) -endif +$1_$2_INPLACE = $$($$($1_$2_PROGNAME)_INPLACE) endif endif diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index 748e27e52d..50cc05edf3 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -79,10 +79,11 @@ $1_$2_HSC2HS_LD_OPTS:=$$(shell for i in $$($1_$2_DIST_LD_OPTS); do echo \'--lfla endif $1_$2_ALL_HSC2HS_OPTS = \ - --cc=$$(WhatGccIsCalled) \ - --ld=$$(WhatGccIsCalled) \ + --cc=$$(CC_STAGE$3) \ + --ld=$$(CC_STAGE$3) \ $$(CONF_HSC2HS_OPTS) \ $$(SRC_HSC2HS_OPTS) \ + $$(SRC_HSC2HS_OPTS_STAGE$3) \ --cflag=-D__GLASGOW_HASKELL__=$$(if $$(filter 0,$3),$$(GhcCanonVersion),$$(ProjectVersionInt)) \ --cflag=-D$$(HostArch_CPP)_HOST_ARCH=1 \ --cflag=-D$$(HostOS_CPP)_HOST_OS=1 \ diff --git a/rules/extra-packages.mk b/rules/extra-packages.mk deleted file mode 100644 index 98868b45db..0000000000 --- a/rules/extra-packages.mk +++ /dev/null @@ -1,48 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture -# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying -# -# ----------------------------------------------------------------------------- - -# For each package P marked as "dph" or "extra" in $(TOP)/packages: -# if $(TOP)/libraries/P exists, then -# if $(TOP)/libraries/P/ghc-packages exists, then -# * add each package from $(TOP)/libraries/P/ghc-packages2 to the list of -# packages. -# Note: ghc-packages2 might have a different list from -# ghc-packages, this is to support dph which has some -# packages that are automatically derived from a single -# source by the build system). -# * add $(TOP)/libraries/P to $(BUILD_DIRS) -# This step is necessary in the case of dph, which has some -# build system code in libraries/dph/ghc.mk, but -# libraries/dph is not itself a package. -# else -# add P to the list of packages - -define extra-packages - -# Collects some dirs containing ghc.mk files that we need to include: -BUILD_DIRS_EXTRA= - -$$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ #][^ ]* \+\(dph\|extra\) \+[^ ]\+ \+[^ ]\+$$$$' packages | sed 's/ .*//'))),\ - $$(if $$(wildcard libraries/$$p/ghc-packages),\ - $$(eval BUILD_DIRS_EXTRA += libraries/$$p) \ - $$(foreach q,$$(shell cat libraries/$$p/ghc-packages2),$$(eval $$(call extra-package,$$p,$$p/$$q))),\ - $$(eval $$(call extra-package,$$p,$$p)))\ -) -endef - -define extra-package # $1 = package root, $2 = package -$(call trace, extra-package($1,$2)) - -EXTRA_PACKAGES += $2 -$$(eval $$(call addPackage,$2)) - -endef diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk new file mode 100644 index 0000000000..6bf7673336 --- /dev/null +++ b/rules/foreachLibrary.mk @@ -0,0 +1,43 @@ +# ----------------------------------------------------------------------------- +# +# (c) 2010 The University of Glasgow +# +# This file is part of the GHC build system. +# +# To understand how the build system works and how to modify it, see +# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture +# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying +# +# ----------------------------------------------------------------------------- + +# For each line in $(TOP)/packages: +# libraries/foo tag ... +# this calls +# $(call $1,foo,tag) +# +# Except! If there's a libraries/foo/ghc-packages then it calls +# $(call $1,foo/bar,tag) +# for each word 'bar' in libraries/foo/ghc-packages. +# + +# We use an FEL_ prefix for the variable names, to avoid trampling on +# other variables, as make has no concept of local variables. + +# We need to handle bin-package-db specially, as it doesn't have an +# entry in the packages file, as it isn't in its own repository. + +define foreachLibrary +# $1 = function to call for each library +# We will give it the package path and the tag as arguments +$$(foreach hashline,libraries/bin-package-db#-#no-remote-repo#no-vcs \ + $$(shell grep '^libraries/' packages | sed 's/ */#/g'),\ + $$(eval FEL_line := $$(subst #,$$(space),$$(hashline))) \ + $$(eval FEL_libdir := $$(word 1,$$(FEL_line))) \ + $$(eval FEL_tag := $$(word 2,$$(FEL_line))) \ + $$(eval FEL_libroot := $$(patsubst libraries/%,%,$$(FEL_libdir))) \ + $$(if $$(wildcard $$(FEL_libdir)/ghc-packages), \ + $$(foreach lib,$$(shell cat $$(FEL_libdir)/ghc-packages), \ + $$(eval $$(call $1,$$(FEL_libroot)/$$(lib),$$(FEL_tag)))), \ + $$(if $$(wildcard $$(FEL_libdir)/), \ + $$(eval $$(call $1,$$(FEL_libroot),$$(FEL_tag)))))) +endef diff --git a/rules/haddock.mk b/rules/haddock.mk index 3a3fed4503..7efb29aa7d 100644 --- a/rules/haddock.mk +++ b/rules/haddock.mk @@ -15,7 +15,7 @@ define haddock # args: $1 = dir, $2 = distdir $(call trace, haddock($1,$2)) $(call profStart, haddock($1,$2)) -ifneq "$$($1_$2_DO_HADDOCK)" "NO" +ifeq "$$($1_$2_DO_HADDOCK)" "YES" ifeq "$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE)" "" $$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock @@ -40,9 +40,12 @@ $1_$2_HADDOCK_FLAGS += --source-module=src/%{MODULE/./-}.html --source-entity=sr endif ifneq "$$(BINDIST)" "YES" -$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/. +# We need the quadruple dollars for the dependencies, as it isn't +# guaranteed that we are processing the packages in dependency order, +# so we don't want to expand it yet. +$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$(INPLACE_BIN)/haddock$$(exeext) $$$$(ghc-cabal_INPLACE) $$($1_$2_HS_SRCS) $$$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/. ifeq "$$(HSCOLOUR_SRCS)" "YES" - "$$(GHC_CABAL_INPLACE)" hscolour $2 $1 + "$$(ghc-cabal_INPLACE)" hscolour $2 $1 endif "$$(TOP)/$$(INPLACE_BIN)/haddock" \ --odir="$1/$2/doc/html/$$($1_PACKAGE)" \ diff --git a/rules/hs-suffix-rules-srcdir.mk b/rules/hs-suffix-rules-srcdir.mk index 8ed72af3be..d3c932f241 100644 --- a/rules/hs-suffix-rules-srcdir.mk +++ b/rules/hs-suffix-rules-srcdir.mk @@ -33,8 +33,8 @@ $1/$2/build/%.hs : $1/$2/build/%.y | $$$$(dir $$$$@)/. $1/$2/build/%.hs : $1/$3/%.x | $$$$(dir $$$$@)/. $$(call cmd,ALEX) $$($1_$2_ALL_ALEX_OPTS) $$< -o $$@ -$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$3/%.hsc $$(HSC2HS_INPLACE) | $$$$(dir $$$$@)/. - $$(call cmd,HSC2HS_INPLACE) $$($1_$2_ALL_HSC2HS_OPTS) $$< -o $$@ +$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$3/%.hsc $$$$(hsc2hs_INPLACE) | $$$$(dir $$$$@)/. + $$(call cmd,hsc2hs_INPLACE) $$($1_$2_ALL_HSC2HS_OPTS) $$< -o $$@ # Now the rules for hs-boot files. diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk index 568d70887b..da6b3b61d9 100644 --- a/rules/manual-package-config.mk +++ b/rules/manual-package-config.mk @@ -15,7 +15,7 @@ define manual-package-config # args: $1 = dir $(call trace, manual-package-config($1)) $(call profStart, manual-package-config($1)) -$1/package.conf.inplace : $1/package.conf.in $$(GHC_PKG_INPLACE) +$1/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) $$(CPP) $$(RAWCPP_FLAGS) -P \ -DTOP='"$$(TOP)"' \ $$($1_PACKAGE_CPP_OPTS) \ @@ -23,7 +23,7 @@ $1/package.conf.inplace : $1/package.conf.in $$(GHC_PKG_INPLACE) grep -v '^#pragma GCC' $$@.raw | \ sed -e 's/""//g' -e 's/:[ ]*,/: /g' > $$@ - "$$(GHC_PKG_INPLACE)" update --force $$@ + "$$(ghc-pkg_INPLACE)" update --force $$@ # This is actually a real file, but we need to recreate it on every # "make install", so we declare it as phony diff --git a/rules/package-config.mk b/rules/package-config.mk index a49ab9862a..664769409c 100644 --- a/rules/package-config.mk +++ b/rules/package-config.mk @@ -43,8 +43,8 @@ else $1_$2_HC_PKGCONF = $1_$2_HC_CONFIG = $$(TOP)/$$(GHC_STAGE1) $1_$2_HC_CONFIG_DEP = $$(GHC_STAGE1) -$1_$2_GHC_PKG = $$(TOP)/$$(GHC_PKG_INPLACE) -$1_$2_GHC_PKG_DEP = $$(GHC_PKG_INPLACE) +$1_$2_GHC_PKG = $$(TOP)/$$(ghc-pkg_INPLACE) +$1_$2_GHC_PKG_DEP = $$$$(ghc-pkg_INPLACE) $1_$2_GHC_PKG_OPTS = # If stage is not 0 then we always use stage1 for making .depend, as later # stages aren't available early enough diff --git a/rules/pretty_commands.mk b/rules/pretty_commands.mk index cfd7fac2b6..f7576e171f 100644 --- a/rules/pretty_commands.mk +++ b/rules/pretty_commands.mk @@ -6,7 +6,7 @@ endif label_ALEX=ALEX label_HAPPY=HAPPY -label_HSC2HS_INPLACE=HSC2HS +label_hsc2hs_INPLACE=HSC2HS diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk index 450c989e87..687c408348 100644 --- a/rules/shell-wrapper.mk +++ b/rules/shell-wrapper.mk @@ -17,7 +17,7 @@ $(call profStart, shell-wrapper($1,$2)) # $2 = distdir ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" "" -$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper +$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROGNAME).wrapper endif ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" @@ -90,7 +90,7 @@ endif ifeq "$$($1_$2_WANT_BINDIST_WRAPPER)" "YES" -$1_$2_BINDIST_WRAPPER = $1/$2/build/tmp/$$($1_$2_PROG)-bindist +$1_$2_BINDIST_WRAPPER = $1/$2/build/tmp/$$($1_$2_PROGNAME)-bindist all_$1_$2 : $$($1_$2_BINDIST_WRAPPER) diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk index 7a7142c19b..d659a5e6d8 100644 --- a/utils/compare_sizes/ghc.mk +++ b/utils/compare_sizes/ghc.mk @@ -2,7 +2,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_PROGNAME = compareSizes utils/compare_sizes_dist-install_INSTALL_INPLACE = NO $(eval $(call build-prog,utils/compare_sizes,dist-install,1)) diff --git a/utils/count_lines/ghc.mk b/utils/count_lines/ghc.mk index c467413381..4f3f43e77a 100644 --- a/utils/count_lines/ghc.mk +++ b/utils/count_lines/ghc.mk @@ -1,5 +1,5 @@ utils/count_lines_PERL_SRC = count_lines.lprl -utils/count_lines_dist_PROG = count_lines +utils/count_lines_dist_PROGNAME = count_lines $(eval $(call build-perl,utils/count_lines,dist)) diff --git a/utils/deriveConstants/ghc.mk b/utils/deriveConstants/ghc.mk index f181077080..525a936960 100644 --- a/utils/deriveConstants/ghc.mk +++ b/utils/deriveConstants/ghc.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- utils/deriveConstants_dist_MODULES = DeriveConstants -utils/deriveConstants_dist_PROG = deriveConstants$(exeext) +utils/deriveConstants_dist_PROGNAME = deriveConstants utils/deriveConstants_dist_INSTALL_INPLACE = YES utils/deriveConstants_HC_OPTS += -package process -package containers diff --git a/utils/genapply/ghc.mk b/utils/genapply/ghc.mk index 805fd6f697..14b003c042 100644 --- a/utils/genapply/ghc.mk +++ b/utils/genapply/ghc.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- utils/genapply_dist_MODULES = GenApply -utils/genapply_dist_PROG = $(GHC_GENAPPLY_PGM) +utils/genapply_dist_PROGNAME = genapply 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 d119d8dfb3..01229ce0dd 100644 --- a/utils/genprimopcode/ghc.mk +++ b/utils/genprimopcode/ghc.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax -utils/genprimopcode_dist_PROG = $(GHC_GENPRIMOP_PGM) +utils/genprimopcode_dist_PROGNAME = genprimopcode utils/genprimopcode_dist_HC_OPTS = -package array utils/genprimopcode_dist_INSTALL_INPLACE = YES diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index e95fa62f07..c80c4ef7ef 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -18,15 +18,18 @@ CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/Cabal/Cabal.cab CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION)) CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)" -$(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/. +ghc-cabal_INPLACE = inplace/bin/ghc-cabal$(exeext) + +ifneq "$(BINDIST)" "YES" +$(ghc-cabal_INPLACE) : utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/. "$(CP)" $< $@ -$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*/*.hs) -$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*.hs) -$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs) +utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*/*.hs) +utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*.hs) +utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs) -$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/. - "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \ +utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/. + "$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-cabal/Main.hs -o $@ \ -no-user-$(GHC_PACKAGE_DB_FLAG) \ -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \ -DCABAL_VERSION=$(CABAL_VERSION) \ @@ -38,25 +41,26 @@ $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs $(T -ilibraries/hpc \ $(utils/ghc-cabal_dist_EXTRA_HC_OPTS) "$(TOUCH_CMD)" $@ +endif # touch is required, because otherwise if mkdirhier is newer, we # repeatedly rebuild ghc-cabal. -$(eval $(call clean-target,$(GHC_CABAL_DIR),dist,\ - $(GHC_CABAL_DIR)/dist bootstrapping)) +$(eval $(call clean-target,utils/ghc-cabal,dist,\ + utils/ghc-cabal/dist bootstrapping)) -$(eval $(call all-target,$(GHC_CABAL_DIR),$(GHC_CABAL_INPLACE))) +$(eval $(call all-target,utils/ghc-cabal,$(ghc-cabal_INPLACE))) # ----------------------------------------------------------------------------- # Now make another copy that goes in bindists. This needs to be built # with the in-tree compiler. -$(GHC_CABAL_DIR)_USES_CABAL = YES -$(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_WANT_BINDIST_WRAPPER = YES -$(GHC_CABAL_DIR)_dist-install_MODULES = Main +utils/ghc-cabal_USES_CABAL = YES +utils/ghc-cabal_PACKAGE = ghc-cabal +utils/ghc-cabal_dist-install_PROGNAME = ghc-cabal +utils/ghc-cabal_dist-install_INSTALL_INPLACE = NO +utils/ghc-cabal_dist-install_WANT_BINDIST_WRAPPER = YES +utils/ghc-cabal_dist-install_MODULES = Main $(eval $(call build-prog,utils/ghc-cabal,dist-install,1)) diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk index a179ae7940..51c3cb4c36 100644 --- a/utils/ghc-pkg/ghc.mk +++ b/utils/ghc-pkg/ghc.mk @@ -34,20 +34,18 @@ utils/ghc-pkg_dist_SHELL_WRAPPER = YES utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion) utils/ghc-pkg_dist_WANT_INSTALLED_WRAPPER = YES -INSTALL_LIBEXECS += utils/ghc-pkg/dist/build/tmp/$(utils/ghc-pkg_dist_PROG) - $(eval $(call shell-wrapper,utils/ghc-pkg,dist)) endif utils/ghc-pkg_dist_USES_CABAL = YES -utils/ghc-pkg_dist_PROG = ghc-pkg$(exeext) +utils/ghc-pkg_dist_PROGNAME = ghc-pkg utils/ghc-pkg_dist_SHELL_WRAPPER = YES utils/ghc-pkg_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/ghc-pkg,dist,0)) -$(GHC_PKG_INPLACE) : | $(INPLACE_PACKAGE_CONF)/. +$(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/. utils/ghc-pkg/dist/package-data.mk: \ utils/ghc-pkg/dist/build/Version.hs @@ -59,7 +57,7 @@ ifneq "$(Stage1Only)" "YES" utils/ghc-pkg_dist-install_USES_CABAL = YES -utils/ghc-pkg_dist-install_PROG = ghc-pkg +utils/ghc-pkg_dist-install_PROGNAME = ghc-pkg utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES utils/ghc-pkg_dist-install_INSTALL = YES utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion) @@ -75,7 +73,7 @@ endif # ----------------------------------------------------------------------------- # Link ghc-pkg to ghc-pkg-$(ProjectVersion) when installing -ifeq "$(Windows)" "NO" +ifeq "$(Windows_Host)" "NO" install: install_utils/ghc-pkg_link .PHONY: install_utils/ghc-pkg_link diff --git a/utils/ghc-pwd/ghc.mk b/utils/ghc-pwd/ghc.mk index e9c0d4aff4..ac6bc768f6 100644 --- a/utils/ghc-pwd/ghc.mk +++ b/utils/ghc-pwd/ghc.mk @@ -3,7 +3,7 @@ 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_WANT_BINDIST_WRAPPER = YES -utils/ghc-pwd_dist-install_PROG = ghc-pwd$(exeext) +utils/ghc-pwd_dist-install_PROGNAME = ghc-pwd $(eval $(call build-prog,utils/ghc-pwd,dist-install,1)) diff --git a/utils/ghctags/ghc.mk b/utils/ghctags/ghc.mk index 949a05174b..07ab41e9f5 100644 --- a/utils/ghctags/ghc.mk +++ b/utils/ghctags/ghc.mk @@ -12,7 +12,7 @@ utils/ghctags_USES_CABAL = YES utils/ghctags_PACKAGE = ghctags -utils/ghctags_dist-install_PROG = ghctags$(exeext) +utils/ghctags_dist-install_PROGNAME = ghctags utils/ghctags_dist-install_INSTALL = NO utils/ghctags_dist-install_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/ghctags,dist-install,2)) diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk index 097f912dcb..00923d3d78 100644 --- a/utils/hp2ps/ghc.mk +++ b/utils/hp2ps/ghc.mk @@ -16,7 +16,7 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ Axes.c Dimensions.c Key.c PsFile.c Shade.c \ Utilities.c utils/hp2ps_dist_EXTRA_LIBRARIES = m -utils/hp2ps_dist_PROG = $(CrossCompilePrefix)hp2ps$(exeext) +utils/hp2ps_dist_PROGNAME = $(CrossCompilePrefix)hp2ps utils/hp2ps_dist_INSTALL = YES utils/hp2ps_dist_INSTALL_INPLACE = YES diff --git a/utils/hpc/ghc.mk b/utils/hpc/ghc.mk index 917e099ef8..60c13d411e 100644 --- a/utils/hpc/ghc.mk +++ b/utils/hpc/ghc.mk @@ -14,5 +14,5 @@ utils/hpc_USES_CABAL = YES utils/hpc_PACKAGE = hpc-bin utils/hpc_dist-install_INSTALL = YES utils/hpc_dist-install_INSTALL_INPLACE = YES -utils/hpc_dist-install_PROG = hpc$(exeext) +utils/hpc_dist-install_PROGNAME = hpc $(eval $(call build-prog,utils/hpc,dist-install,1)) diff --git a/utils/mkUserGuidePart/ghc.mk b/utils/mkUserGuidePart/ghc.mk index ae305f9139..aabe69ae4e 100644 --- a/utils/mkUserGuidePart/ghc.mk +++ b/utils/mkUserGuidePart/ghc.mk @@ -12,7 +12,7 @@ utils/mkUserGuidePart_USES_CABAL = YES utils/mkUserGuidePart_PACKAGE = mkUserGuidePart -utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext) +utils/mkUserGuidePart_dist_PROGNAME = mkUserGuidePart utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/mkUserGuidePart,dist,1)) diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk index 0c045b4e2b..cde8102312 100644 --- a/utils/runghc/ghc.mk +++ b/utils/runghc/ghc.mk @@ -12,7 +12,7 @@ utils/runghc_PACKAGE = runghc utils/runghc_dist-install_USES_CABAL = YES -utils/runghc_dist-install_PROG = runghc$(exeext) +utils/runghc_dist-install_PROGNAME = runghc utils/runghc_dist-install_SHELL_WRAPPER = YES utils/runghc_dist-install_INSTALL = YES utils/runghc_dist-install_INSTALL_INPLACE = YES @@ -30,7 +30,7 @@ $(eval $(call build-prog,utils/runghc,dist-install,1)) install: install_runhaskell .PHONY: install_runhaskell -ifeq "$(Windows)" "YES" +ifeq "$(Windows_Host)" "YES" install_runhaskell: install_bins "$(CP)" $(DESTDIR)$(bindir)/runghc$(exeext) $(DESTDIR)$(bindir)/runhaskell$(exeext) else diff --git a/utils/touchy/ghc.mk b/utils/touchy/ghc.mk index 458f80e5ed..b2911aaaa6 100644 --- a/utils/touchy/ghc.mk +++ b/utils/touchy/ghc.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- utils/touchy_dist_C_SRCS = touchy.c -utils/touchy_dist_PROG = $(GHC_TOUCHY_PGM) +utils/touchy_dist_PROGNAME = touchy utils/touchy_dist_TOPDIR = YES utils/touchy_dist_INSTALL = YES utils/touchy_dist_INSTALL_INPLACE = YES diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk index 1bdf4a07b6..765c96969b 100644 --- a/utils/unlit/ghc.mk +++ b/utils/unlit/ghc.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- utils/unlit_dist_C_SRCS = unlit.c -utils/unlit_dist_PROG = $(GHC_UNLIT_PGM) +utils/unlit_dist_PROGNAME = unlit utils/unlit_dist_TOPDIR = YES utils/unlit_dist_INSTALL = YES utils/unlit_dist_INSTALL_INPLACE = YES |