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