76566a80a793a233263237d50b16d2b68f81bfd6
[ghc-hetmet.git] / 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/FilePath \
12         System/Directory \
13         Trace/Hpc \
14         cbits
15
16 SplitObjs=NO
17 LIBRARY = libghccompat.a
18
19 # We don't want this installed
20 NO_INSTALL_LIBRARY = YES
21
22 # Avoid building the GHCi lib, since we don't need it
23 GhcWithInterpreter = NO
24
25 # Needed so that the libraries can #include relative to this directory.
26 INCLUDE_DIRS=-I. -Iinclude
27
28 SRC_HC_OPTS    += $(INCLUDE_DIRS)
29 SRC_CC_OPTS    += $(INCLUDE_DIRS)
30 MKDEPENDC_OPTS += $(INCLUDE_DIRS)
31
32 # Just to silence warnings
33 MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
34
35 UseGhcForCc = YES
36
37 # This library is linked to the compiler, at least in stage1, so we
38 # better make sure it is built the same "way".
39 #
40 # BUT, if GhcHcOpts includes -DDEBUG we *don't* want to compile
41 # lib/compat with -DDEBUG, because the preprocessor symbols used
42 # by the compiler may be understood differently by library code.
43 # In this particular case, it turned out that -DDEBUG made Cabal 
44 # import HUnit, which might not be installed for the compiler we are
45 # compiling with (e.g. 6.2.1). Hence the filter-out.
46 SRC_HC_OPTS += $(filter-out -D%, $(GhcHcOpts) $(GhcStage1HcOpts)) 
47
48 # GHC 6.4 didn't have WCsubst.c, but 6.4.1 did, and we need to know
49 # this in cbits/unicode.c The patchlevel isn't normally exposed as a
50 # CPP symbol, so we have to do it by hand:
51 SRC_CC_OPTS += -D__GHC_PATCHLEVEL__=$(GhcPatchLevel)
52
53 # This module shouldn't be compiled itself, only #included into other files
54 EXCLUDED_SRCS += System/FilePath/Internal.hs
55
56 ifeq "$(ghc_ge_603)" "YES"
57 ifneq "$(ghc_ge_607)" "YES"
58 # GHC 6.3+ has Cabal, but we're replacing it:
59 SRC_HC_OPTS += -ignore-package Cabal
60
61 # only GHC 6.3+ has -ignore-package
62 SRC_HC_OPTS += -ignore-package filepath
63 endif
64 endif
65
66 ifeq "$(ghc_ge_607)" "YES"
67 SRC_HC_OPTS += -package directory
68 SRC_HC_OPTS += -package pretty
69 endif
70
71 # Some explicit dependencies, needed because ghc -M can't discover the
72 # true dependencies of these stub files.
73 System/Directory/Internals.$(way_)o : $(FPTOOLS_TOP)/libraries/directory/System/Directory/Internals.hs
74 Distribution/Compat/ReadP.$(way_) : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compat/ReadP.hs
75 Distribution/GetOpt.$(way_)o    : $(FPTOOLS_TOP)/libraries/Cabal/Distribution/GetOpt.hs
76 Distribution/InstalledPackageInfo.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/InstalledPackageInfo.hs
77 Distribution/License.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/License.hs
78 Distribution/Package.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Package.hs
79 Distribution/ParseUtils.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/ParseUtils.hs
80 Distribution/Compiler.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Compiler.hs
81 Distribution/Version.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Distribution/Version.hs
82 Language/Haskell/Extension.$(way_)o :  $(FPTOOLS_TOP)/libraries/Cabal/Language/Haskell/Extension.hs
83 Trace/Hpc/Mix.$(way_)o :  $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Mix.hs
84 Trace/Hpc/Util.$(way_)o :  $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Util.hs
85 Trace/Hpc/Tix.$(way_)o :  $(FPTOOLS_TOP)/libraries/hpc/Trace/Hpc/Tix.hs
86
87 cbits/unicode.o : $(FPTOOLS_TOP)/libraries/base/cbits/WCsubst.c $(FPTOOLS_TOP)/libraries/base/include/WCsubst.h
88
89 SRC_CC_OPTS += -I$(FPTOOLS_TOP)/libraries/base/cbits -I$(FPTOOLS_TOP)/libraries/base/include
90
91 # Make the #includes in the stubs independent of the current location
92 SRC_HC_OPTS += -I$(FPTOOLS_TOP)/libraries
93
94 SRC_HC_OPTS +=  -fglasgow-exts -no-recomp
95
96 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
97 Compat/Directory_HC_OPTS += -\#include shlobj.h
98 endif
99
100 # libghccompat is needed to build ghc-pkg, which is built during 'make boot',
101 # so we must build this library during 'make boot' too.
102 # Do a recursive 'make all' after generating dependencies, because this
103 # will work with 'make -j'.
104 ifneq "$(BootingFromHc)" "YES"
105 boot :: depend
106         $(MAKE) all
107 endif
108
109 # We don't ever want to build libghccompat as a shared library.
110 GhcBuildDylibs=NO
111
112 include $(TOP)/mk/target.mk