2 include $(TOP)/mk/boilerplate.mk
18 LIBRARY = libghccompat.a
20 # We don't want this installed
21 NO_INSTALL_LIBRARY = YES
23 # Avoid building the GHCi lib, since we don't need it
24 GhcWithInterpreter = NO
26 # Needed so that the libraries can #include relative to this directory.
27 INCLUDE_DIRS=-I. -Iinclude
29 SRC_HC_OPTS += $(INCLUDE_DIRS)
30 SRC_CC_OPTS += $(INCLUDE_DIRS)
31 MKDEPENDC_OPTS += $(INCLUDE_DIRS)
33 # Just to silence warnings
34 MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
38 # This library is linked to the compiler, at least in stage1, so we
39 # better make sure it is built the same "way".
41 # BUT, if GhcHcOpts includes -DDEBUG we *don't* want to compile
42 # lib/compat with -DDEBUG, because the preprocessor symbols used
43 # by the compiler may be understood differently by library code.
44 # In this particular case, it turned out that -DDEBUG made Cabal
45 # import HUnit, which might not be installed for the compiler we are
46 # compiling with (e.g. 6.2.1). Hence the filter-out.
47 SRC_HC_OPTS += $(filter-out -D%, $(GhcHcOpts) $(GhcStage1HcOpts))
49 # GHC 6.4 didn't have WCsubst.c, but 6.4.1 did, and we need to know
50 # this in cbits/unicode.c The patchlevel isn't normally exposed as a
51 # CPP symbol, so we have to do it by hand:
52 SRC_CC_OPTS += -D__GHC_PATCHLEVEL__=$(GhcPatchLevel)
54 # This module shouldn't be compiled itself, only #included into other files
55 EXCLUDED_SRCS += System/FilePath/Internal.hs
57 ifeq "$(ghc_ge_603)" "YES"
58 ifneq "$(ghc_ge_607)" "YES"
59 # GHC 6.3+ has Cabal, but we're replacing it:
60 SRC_HC_OPTS += -ignore-package Cabal
62 # only GHC 6.3+ has -ignore-package
63 SRC_HC_OPTS += -ignore-package filepath
67 ifeq "$(ghc_ge_607)" "YES"
68 SRC_HC_OPTS += -package directory
69 SRC_HC_OPTS += -package pretty
72 # Some explicit dependencies, needed because ghc -M can't discover the
73 # true dependencies of these stub files.
74 System/Directory/Internals.$(way_)o : $(FPTOOLS_TOP)/libraries/directory/System/Directory/Internals.hs
75 Distribution/Compat/ReadP.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/ReadP.hs
76 Distribution/GetOpt.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/GetOpt.hs
77 Distribution/InstalledPackageInfo.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/InstalledPackageInfo.hs
78 Distribution/License.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/License.hs
79 Distribution/Package.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Package.hs
80 Distribution/ParseUtils.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/ParseUtils.hs
81 Distribution/Compiler.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compiler.hs
82 Distribution/Version.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Version.hs
83 Language/Haskell/Extension.$(way_)o : $(FPTOOLS_TOP)/libraries/Cabal/Language/Haskell/Extension.hs
84 Trace/Hpc/Mix.$(way_)o : $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Mix.hs
85 Trace/Hpc/Util.$(way_)o : $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Util.hs
86 Trace/Hpc/Tix.$(way_)o : $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Tix.hs
88 cbits/unicode.o : $(FPTOOLS_TOP)/libraries/base/cbits/WCsubst.c $(FPTOOLS_TOP)/libraries/base/include/WCsubst.h
90 SRC_CC_OPTS += -I$(FPTOOLS_TOP)/libraries/base/cbits -I$(FPTOOLS_TOP)/libraries/base/include
92 # Make the #includes in the stubs independent of the current location
93 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
95 SRC_HC_OPTS += -fglasgow-exts -no-recomp
97 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
98 Compat/Directory_HC_OPTS += -\#include shlobj.h
101 # libghccompat is needed to build ghc-pkg, which is built during 'make boot',
102 # so we must build this library during 'make boot' too.
103 # Do a recursive 'make all' after generating dependencies, because this
104 # will work with 'make -j'.
105 ifneq "$(BootingFromHc)" "YES"
110 # We don't ever want to build libghccompat as a shared library.
113 include $(TOP)/mk/target.mk