diff options
-rw-r--r-- | compiler/main/DynFlags.hs | 1 | ||||
-rw-r--r-- | docs/users_guide/ghc.mk | 14 | ||||
-rw-r--r-- | docs/users_guide/glasgow_exts.xml | 33 | ||||
-rw-r--r-- | docs/users_guide/ug-ent.xml.in | 1 | ||||
-rw-r--r-- | ghc.mk | 6 | ||||
-rw-r--r-- | utils/mkUserGuidePart/Main.hs | 39 | ||||
-rw-r--r-- | utils/mkUserGuidePart/Makefile | 15 | ||||
-rw-r--r-- | utils/mkUserGuidePart/ghc.mk | 19 |
8 files changed, 93 insertions, 35 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index b00424c8c7..2e7e1feda6 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -17,6 +17,7 @@ module DynFlags ( DOpt(..), DynFlag(..), ExtensionFlag(..), + glasgowExtsFlags, flattenExtensionFlags, ensureFlattenedExtensionFlags, lopt_set_flattened, diff --git a/docs/users_guide/ghc.mk b/docs/users_guide/ghc.mk index f78ebca2f3..9334784c6d 100644 --- a/docs/users_guide/ghc.mk +++ b/docs/users_guide/ghc.mk @@ -10,9 +10,17 @@ # # ----------------------------------------------------------------------------- -docs/users_guide_DOCBOOK_SOURCES := \ - $(wildcard docs/users_guide/*.xml) \ - $(basename $(wildcard docs/users_guide/*.xml.in)) +docs/users_guide_GENERATED_DOCBOOK_SOURCES := \ + docs/users_guide/what_glasgow_exts_does.gen.xml + +# sort remove duplicates +docs/users_guide_DOCBOOK_SOURCES := \ + $(sort $(docs/users_guide_GENERATED_DOCBOOK_SOURCES) \ + $(wildcard docs/users_guide/*.xml) \ + $(basename $(wildcard docs/users_guide/*.xml.in))) + +$(docs/users_guide_GENERATED_DOCBOOK_SOURCES): %.gen.xml: inplace/bin/mkUserGuidePart + inplace/bin/mkUserGuidePart $@ $(eval $(call docbook,docs/users_guide,users_guide)) diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index d156de8b48..aeb9314363 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -56,38 +56,7 @@ documentation</ulink> describes all the libraries that come with GHC. <para>The flag <option>-fglasgow-exts</option> <indexterm><primary><option>-fglasgow-exts</option></primary></indexterm> is equivalent to enabling the following extensions: - <option>-XPrintExplicitForalls</option>, - <option>-XForeignFunctionInterface</option>, - <option>-XUnliftedFFITypes</option>, - <option>-XGADTs</option>, - <option>-XImplicitParams</option>, - <option>-XScopedTypeVariables</option>, - <option>-XUnboxedTuples</option>, - <option>-XTypeSynonymInstances</option>, - <option>-XStandaloneDeriving</option>, - <option>-XDeriveDataTypeable</option>, - <option>-XFlexibleContexts</option>, - <option>-XFlexibleInstances</option>, - <option>-XConstrainedClassMethods</option>, - <option>-XMultiParamTypeClasses</option>, - <option>-XFunctionalDependencies</option>, - <option>-XMagicHash</option>, - <option>-XPolymorphicComponents</option>, - <option>-XExistentialQuantification</option>, - <option>-XUnicodeSyntax</option>, - <option>-XPostfixOperators</option>, - <option>-XPatternGuards</option>, - <option>-XLiberalTypeSynonyms</option>, - <option>-XExplicitForAll</option>, - <option>-XRankNTypes</option>, - <option>-XImpredicativeTypes</option>, - <option>-XTypeOperators</option>, - <option>-XDoRec</option>, - <option>-XParallelListComp</option>, - <option>-XEmptyDataDecls</option>, - <option>-XKindSignatures</option>, - <option>-XGeneralizedNewtypeDeriving</option>, - <option>-XTypeFamilies</option>. + &what_glasgow_exts_does; Enabling these options is the <emphasis>only</emphasis> effect of <option>-fglasgow-exts</option>. We are trying to move away from this portmanteau flag, diff --git a/docs/users_guide/ug-ent.xml.in b/docs/users_guide/ug-ent.xml.in index cbfc89125a..47d2f7742f 100644 --- a/docs/users_guide/ug-ent.xml.in +++ b/docs/users_guide/ug-ent.xml.in @@ -21,6 +21,7 @@ <!ENTITY win32-dll SYSTEM "win32-dlls.xml"> <!ENTITY ffi-chap SYSTEM "ffi-chap.xml"> <!ENTITY shared_libs SYSTEM "shared_libs.xml"> +<!ENTITY what_glasgow_exts_does SYSTEM "what_glasgow_exts_does.gen.xml"> <!ENTITY libraryBaseLocation "../libraries/base-@LIBRARY_base_VERSION@"> <!ENTITY libraryCabalLocation "../libraries/Cabal-@LIBRARY_Cabal_VERSION@"> <!ENTITY libraryGhcPrimLocation "../libraries/ghc-prim-@LIBRARY_ghc_prim_VERSION@"> @@ -574,6 +574,11 @@ BUILD_DIRS += \ $(GHC_TOUCHY_DIR) endif +ifneq "$(BINDIST)" "YES" +BUILD_DIRS += \ + utils/mkUserGuidePart +endif + BUILD_DIRS += utils/count_lines BUILD_DIRS += utils/compare_sizes @@ -608,6 +613,7 @@ utils/ghctags_dist_DISABLE = YES utils/hpc_dist_DISABLE = YES utils/hsc2hs_dist-install_DISABLE = YES utils/ghc-pkg_dist-install_DISABLE = YES +utils/mkUserGuidePart_dist_DISABLE = YES utils/compare_sizes_dist_DISABLE = YES compiler_stage2_DISABLE = YES compiler_stage3_DISABLE = YES diff --git a/utils/mkUserGuidePart/Main.hs b/utils/mkUserGuidePart/Main.hs new file mode 100644 index 0000000000..114114ca1c --- /dev/null +++ b/utils/mkUserGuidePart/Main.hs @@ -0,0 +1,39 @@ + +module Main (main) where + +import DynFlags + +import Data.List +import System.Environment + +main :: IO () +main = do args <- getArgs + case args of + [] -> error "Need to give filename to generate as an argument" + [f] -> + case f of + "docs/users_guide/what_glasgow_exts_does.gen.xml" -> + writeFile f whatGlasgowExtsDoes + _ -> + error ("Don't know what to do for " ++ show f) + _ -> error "Bad args" + +whatGlasgowExtsDoes :: String +whatGlasgowExtsDoes = case maybeInitLast glasgowExtsFlags of + Just (xs, x) -> + let xs' = map mkInitLine xs + x' = mkLastLine x + in unlines (xs' ++ [x']) + Nothing -> + error "glasgowExtsFlags is empty?" + where mkInitLine = mkLine ',' + mkLastLine = mkLine '.' + mkLine c f = case stripPrefix "Opt_" (show f) of + Just ext -> "<option>-X" ++ ext ++ "</option>" ++ [c] + Nothing -> error ("Can't parse extension: " ++ show f) + +maybeInitLast :: [a] -> Maybe ([a], a) +maybeInitLast xs = case reverse xs of + (y : ys) -> Just (reverse ys, y) + _ -> Nothing + diff --git a/utils/mkUserGuidePart/Makefile b/utils/mkUserGuidePart/Makefile new file mode 100644 index 0000000000..1af00bf9da --- /dev/null +++ b/utils/mkUserGuidePart/Makefile @@ -0,0 +1,15 @@ +# ----------------------------------------------------------------------------- +# +# (c) 2009 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 +# +# ----------------------------------------------------------------------------- + +dir = utils/mkUserGuidePart +TOP = ../.. +include $(TOP)/mk/sub-makefile.mk diff --git a/utils/mkUserGuidePart/ghc.mk b/utils/mkUserGuidePart/ghc.mk new file mode 100644 index 0000000000..ef91767183 --- /dev/null +++ b/utils/mkUserGuidePart/ghc.mk @@ -0,0 +1,19 @@ +# ----------------------------------------------------------------------------- +# +# (c) 2009 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 +# +# ----------------------------------------------------------------------------- + +utils/mkUserGuidePart_dist_MODULES = Main +utils/mkUserGuidePart_dist_PROG = mkUserGuidePart +utils/mkUserGuidePart_HC_OPTS = -package ghc + +utils/mkUserGuidePart/dist/build/Main.o: $(compiler_stage2_v_LIB) + +$(eval $(call build-prog,utils/mkUserGuidePart,dist,1)) |