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