126e79416d0f0204b94735ad02048beeed209c59
[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         System \
10         System/Directory \
11         cbits
12
13 SplitObjs=NO
14 LIBRARY = libghccompat.a
15
16 # We don't want this installed
17 NO_INSTALL_LIBRARY = YES
18
19 # Needed so that the libraries can #include relative to this directory.
20 INCLUDE_DIRS=-I. -Iinclude
21
22 SRC_HC_OPTS    += $(INCLUDE_DIRS) 
23 MKDEPENDC_OPTS += $(INCLUDE_DIRS)
24
25 # Just to silence warnings
26 MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
27
28 UseGhcForCc = YES
29
30 # This library is linked to the compiler, at least in stage1, so we
31 # better make sure it is built the same "way".
32 #
33 # BUT, if GhcHcOpts includes -DDEBUG we *don't* want to compile
34 # lib/compat with -DDEBUG, because the preprocessor symbols used
35 # by the compiler may be understood differently by library code.
36 # In this particular case, it turned out that -DDEBUG made Cabal 
37 # import HUnit, which might not be installed for the compiler we are
38 # compiling with (e.g. 6.2.1). Hence the filter-out.
39 SRC_HC_OPTS += $(filter-out -D%, $(GhcHcOpts)) 
40
41 ifeq "$(ghc_ge_603)" "YES"
42 # These modules are all provided in GHC 6.3+
43 EXCLUDED_SRCS += \
44         System/Directory/Internals.hs \
45         Distribution/Compat/ReadP.hs \
46         Distribution/Extension.hs \
47         Distribution/GetOpt.hs \
48         Distribution/InstalledPackageInfo.hs \
49         Distribution/License.hs \
50         Distribution/Package.hs \
51         Distribution/ParseUtils.hs \
52         Distribution/Setup.hs \
53         Distribution/Version.hs
54 endif
55
56 # Some explicit dependencies
57 System/Directory/Internals.$(way_)o : $(FPTOOLS_TOP)/libraries/base/System/Directory/Internals.hs
58 Distribution/Compat/ReadP.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/ReadP.hs
59 Distribution/Extension.$(way_)o    : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Extension.hs
60 Distribution/GetOpt.$(way_)o    : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/GetOpt.hs
61 Distribution/InstalledPackageInfo.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/InstalledPackageInfo.hs
62 Distribution/License.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/License.hs
63 Distribution/Package.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Package.hs
64 Distribution/ParseUtils.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/ParseUtils.hs
65 Distribution/Setup.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Setup.hs
66 Distribution/Version.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Version.hs
67
68 # Make the #includes in the stubs independent of the current location
69 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
70
71 SRC_HC_OPTS +=  -fglasgow-exts -no-recomp
72
73 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
74 Compat/Directory_HC_OPTS += -\#include shlobj.h
75 endif
76
77 # libghccompat is needed to build ghc-pkg, which is built during 'make boot',
78 # so we must build this library during 'make boot' too.
79 # Do a recursive 'make all' after generating dependencies, because this
80 # will work with 'make -j'.
81 ifneq "$(BootingFromHc)" "YES"
82 boot :: depend
83         $(MAKE) all
84 endif
85
86 # We don't ever want to build libghccompat as a shared library.
87 GhcBuildDylibs=NO
88
89 include $(TOP)/mk/target.mk