95277c4809e2232d39f70e7efafac9460fee0fcc
[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 # Needed so that the libraries can #include relative to this directory.
21 INCLUDE_DIRS=-I. -Iinclude
22
23 SRC_HC_OPTS    += $(INCLUDE_DIRS)
24 SRC_CC_OPTS    += $(INCLUDE_DIRS)
25 MKDEPENDC_OPTS += $(INCLUDE_DIRS)
26
27 # Just to silence warnings
28 MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
29
30 UseGhcForCc = YES
31
32 # This library is linked to the compiler, at least in stage1, so we
33 # better make sure it is built the same "way".
34 #
35 # BUT, if GhcHcOpts includes -DDEBUG we *don't* want to compile
36 # lib/compat with -DDEBUG, because the preprocessor symbols used
37 # by the compiler may be understood differently by library code.
38 # In this particular case, it turned out that -DDEBUG made Cabal 
39 # import HUnit, which might not be installed for the compiler we are
40 # compiling with (e.g. 6.2.1). Hence the filter-out.
41 SRC_HC_OPTS += $(filter-out -D%, $(GhcHcOpts)) 
42
43 ifeq "$(ghc_ge_603)" "YES"
44 # These modules are all provided in GHC 6.3+
45 EXCLUDED_SRCS += \
46         System/Directory/Internals.hs \
47         Distribution/Compat/FilePath.hs \
48         Distribution/Compat/ReadP.hs \
49         Distribution/GetOpt.hs \
50         Distribution/InstalledPackageInfo.hs \
51         Distribution/License.hs \
52         Distribution/Package.hs \
53         Distribution/ParseUtils.hs \
54         Distribution/Compiler.hs \
55         Distribution/Version.hs \
56         Language/Haskell/Extension.hs
57
58 SRC_MKDEPENDHS_OPTS += \
59         -optdep--exclude-module=System.Directory.Internals \
60         -optdep--exclude-module=Distribution.Compat.FilePath \
61         -optdep--exclude-module=Distribution.Compat.ReadP \
62         -optdep--exclude-module=Distribution.GetOpt \
63         -optdep--exclude-module=Distribution.InstalledPackageInfo \
64         -optdep--exclude-module=Distribution.License \
65         -optdep--exclude-module=Distribution.Package \
66         -optdep--exclude-module=Distribution.ParseUtils \
67         -optdep--exclude-module=Distribution.Compiler \
68         -optdep--exclude-module=Distribution.Version \
69         -optdep--exclude-module=Language.Haskell.Extension
70 endif
71
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/base/System/Directory/Internals.hs
75 Distribution/Compat/FilePath.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/FilePath.hs
76 Distribution/Compat/ReadP.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/ReadP.hs
77 Distribution/GetOpt.$(way_)o    : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/GetOpt.hs
78 Distribution/InstalledPackageInfo.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/InstalledPackageInfo.hs
79 Distribution/License.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/License.hs
80 Distribution/Package.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Package.hs
81 Distribution/ParseUtils.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/ParseUtils.hs
82 Distribution/Compiler.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compiler.hs
83 Distribution/Version.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Version.hs
84 Language/Haskell/Extension.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Language/Haskell/Extension.hs
85
86 # Make the #includes in the stubs independent of the current location
87 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
88
89 SRC_HC_OPTS +=  -fglasgow-exts -no-recomp
90
91 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
92 Compat/Directory_HC_OPTS += -\#include shlobj.h
93 endif
94
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"
100 boot :: depend
101         $(MAKE) all
102 endif
103
104 # We don't ever want to build libghccompat as a shared library.
105 GhcBuildDylibs=NO
106
107 include $(TOP)/mk/target.mk