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