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