ae2f4ed34037a617d01d7d92edf12aa99c795fae
[ghc-hetmet.git] / ghc / lib / compat / Makefile
1 TOP=../..
2 include $(TOP)/mk/boilerplate.mk
3
4 ALL_DIRS = \
5         Data \
6         Compat \
7         Distribution \
8         Distribution/Compat \
9         Language/Haskell \
10         System \
11         System/Directory \
12         cbits
13
14 SplitObjs=NO
15 LIBRARY = libghccompat.a
16
17 # We don't want this installed
18 NO_INSTALL_LIBRARY = YES
19
20 # Avoid building the GHCi lib, since we don't need it
21 GhcWithInterpreter = NO
22
23 # Needed so that the libraries can #include relative to this directory.
24 INCLUDE_DIRS=-I. -Iinclude
25
26 SRC_HC_OPTS    += $(INCLUDE_DIRS)
27 SRC_CC_OPTS    += $(INCLUDE_DIRS)
28 MKDEPENDC_OPTS += $(INCLUDE_DIRS)
29
30 # Just to silence warnings
31 MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
32
33 UseGhcForCc = YES
34
35 # This library is linked to the compiler, at least in stage1, so we
36 # better make sure it is built the same "way".
37 #
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)) 
45
46 ifeq "$(ghc_ge_603)" "YES"
47 # These modules are provided in GHC 6.3+
48 EXCLUDED_SRCS += \
49         System/Directory/Internals.hs
50
51 SRC_MKDEPENDHS_OPTS += \
52         -optdep--exclude-module=System.Directory.Internals
53
54 # GHC 6.3+ has Cabal, but we're replacing it:
55 SRC_HC_OPTS += -ignore-package Cabal
56 endif
57
58 # Some explicit dependencies, needed because ghc -M can't discover the
59 # true dependencies of these stub files.
60 System/Directory/Internals.$(way_)o : $(FPTOOLS_TOP)/libraries/base/System/Directory/Internals.hs
61 Distribution/Compat/FilePath.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/FilePath.hs
62 Distribution/Compat/ReadP.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/ReadP.hs
63 Distribution/GetOpt.$(way_)o    : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/GetOpt.hs
64 Distribution/InstalledPackageInfo.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/InstalledPackageInfo.hs
65 Distribution/License.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/License.hs
66 Distribution/Package.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Package.hs
67 Distribution/ParseUtils.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/ParseUtils.hs
68 Distribution/Compiler.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compiler.hs
69 Distribution/Version.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Version.hs
70 Language/Haskell/Extension.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Language/Haskell/Extension.hs
71 cbits/unicode.o : $(FPTOOLS_TOP)/libraries/base/cbits/WCsubst.c $(FPTOOLS_TOP)/libraries/base/include/WCsubst.h
72
73 SRC_CC_OPTS += -I$(FPTOOLS_TOP)/libraries/base/cbits -I$(FPTOOLS_TOP)/libraries/base/include
74
75 # Make the #includes in the stubs independent of the current location
76 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
77
78 SRC_HC_OPTS +=  -fglasgow-exts -no-recomp
79
80 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
81 Compat/Directory_HC_OPTS += -\#include shlobj.h
82 endif
83
84 # libghccompat is needed to build ghc-pkg, which is built during 'make boot',
85 # so we must build this library during 'make boot' too.
86 # Do a recursive 'make all' after generating dependencies, because this
87 # will work with 'make -j'.
88 ifneq "$(BootingFromHc)" "YES"
89 boot :: depend
90         $(MAKE) all
91 endif
92
93 # We don't ever want to build libghccompat as a shared library.
94 GhcBuildDylibs=NO
95
96 include $(TOP)/mk/target.mk