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