[project @ 2005-09-13 12:50:59 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         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 provided in GHC 6.3+
45 EXCLUDED_SRCS += \
46         System/Directory/Internals.hs
47
48 SRC_MKDEPENDHS_OPTS += \
49         -optdep--exclude-module=System.Directory.Internals
50
51 # GHC 6.3+ has Cabal, but we're replacing it:
52 SRC_HC_OPTS += -ignore-package Cabal
53 endif
54
55 # Some explicit dependencies, needed because ghc -M can't discover the
56 # true dependencies of these stub files.
57 System/Directory/Internals.$(way_)o : $(FPTOOLS_TOP)/libraries/base/System/Directory/Internals.hs
58 Distribution/Compat/FilePath.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/FilePath.hs
59 Distribution/Compat/ReadP.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/ReadP.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/Compiler.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compiler.hs
66 Distribution/Version.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Version.hs
67 Language/Haskell/Extension.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Language/Haskell/Extension.hs
68
69 # Make the #includes in the stubs independent of the current location
70 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
71
72 SRC_HC_OPTS +=  -fglasgow-exts -no-recomp
73
74 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
75 Compat/Directory_HC_OPTS += -\#include shlobj.h
76 endif
77
78 # libghccompat is needed to build ghc-pkg, which is built during 'make boot',
79 # so we must build this library during 'make boot' too.
80 # Do a recursive 'make all' after generating dependencies, because this
81 # will work with 'make -j'.
82 ifneq "$(BootingFromHc)" "YES"
83 boot :: depend
84         $(MAKE) all
85 endif
86
87 # We don't ever want to build libghccompat as a shared library.
88 GhcBuildDylibs=NO
89
90 include $(TOP)/mk/target.mk