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