Build GHC/Prim.hs and GHC/PrimopWrappers.hs from Cabal
[packages/random.git] / Makefile
1 TOP=..
2 include $(TOP)/mk/boilerplate.mk
3
4 # -----------------------------------------------------------------------------
5
6 SUBDIRS = cbits include
7
8 ALL_DIRS = \
9 Control \
10 Control/Concurrent \
11 Control/Parallel \
12 Control/Monad \
13 Control/Monad/ST \
14 Data \
15 Data/ByteString \
16 Data/ByteString/Lazy \
17 Data/Generics \
18 Data/Array \
19 Data/Array/IO \
20 Data/STRef \
21 Debug \
22 Foreign \
23 Foreign/C \
24 Foreign/Marshal \
25 GHC \
26 System \
27 System/Console \
28 System/Mem \
29 System/IO \
30 System/Posix \
31 System/Process \
32 System/Directory \
33 Text \
34 Text/PrettyPrint \
35 Text/ParserCombinators \
36 Text/Show \
37 Text/Read \
38 Unsafe
39
40 PACKAGE = base
41 VERSION = 2.0
42
43 SRC_HC_OPTS += -fglasgow-exts -cpp -Iinclude -"\#include" HsBase.h
44 SRC_HSC2HS_OPTS += -Iinclude -I$(GHC_INCLUDE_DIR)
45
46 # -----------------------------------------------------------------------------
47 # Per-module flags
48
49 # ESSENTIAL, for getting reasonable performance from the I/O library:
50 SRC_HC_OPTS += -funbox-strict-fields
51
52 # -----------------------------------------------------------------------------
53 # PrimOpWrappers
54
55 # These two lines are required for pre-processing compiler/prelude/primops.txt
56 SRC_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
57 SRC_CPP_OPTS += ${GhcCppOpts}
58
59 ifeq "$(BootingFromHc)" "YES"
60 GHC/PrimopWrappers.hs:
61 touch GHC/PrimopWrappers.hs
62 else
63 GHC/PrimopWrappers.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt GHC/Prim.hs
64 @$(RM) $@
65 $(GENPRIMOP) --make-haskell-wrappers < $< > $@
66 endif
67
68 GHC/Prim.hs: $(GHC_COMPILER_DIR)/prelude/primops.txt
69 @$(RM) $@
70 $(GENPRIMOP) --make-haskell-source < $< > $@
71
72 EXCLUDED_SRCS = GHC/Prim.hs
73 EXTRA_HADDOCK_SRCS = GHC/Prim.hs
74
75 boot :: GHC/PrimopWrappers.hs
76
77 EXTRA_SRCS += GHC/PrimopWrappers.hs
78 CLEAN_FILES += GHC/PrimopWrappers.hs
79
80 # -----------------------------------------------------------------------------
81 ifneq "$(BootingFromHc)" "YES"
82 STUBOBJS += \
83 Control/Concurrent_stub.$(way_)o
84
85 CLEAN_FILES += $(STUBOBJS) \
86 Control/Concurrent_stub.[ch]
87 endif
88
89 #-----------------------------------------------------------------------------
90 # Building the library for GHCi
91 #
92 # The procedure differs from that in fptools/mk/target.mk in one way:
93 # (*) on Win32 we must split it into two, because a single .o file can't
94 # have more than 65536 relocations in it [due to a bug in the GNU
95 # linker.]
96
97 OBJECT_FILEFORMAT=unknown
98 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
99 OBJECT_FILEFORMAT=PEi
100 endif
101 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
102 OBJECT_FILEFORMAT=PEi
103 endif
104
105 ifeq "$(OBJECT_FILEFORMAT)" "PEi"
106
107 # Turn off standard rule which creates HSbase.o from LIBOBJS.
108 #DONT_WANT_STD_GHCI_LIB_RULE=YES
109
110 GHCI_LIBOBJS = $(HS_OBJS)
111
112 INSTALL_LIBS += HSbase.o
113
114 endif # OBJECT_FILEFORMAT = PEi
115
116
117 # -----------------------------------------------------------------------------
118 # Doc building with Haddock
119
120 EXCLUDED_HADDOCK_SRCS = \
121 GHC/PrimopWrappers.hs \
122 GHC/PArr.hs
123
124 SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" \
125 --no-implicit-prelude
126
127 # -----------------------------------------------------------------------------
128
129 GHC/ForeignPtr.o Data/Array/IO/Internals.o Data/Array/Base.o \
130 Data/Generics/Instances.o Data/Complex.o Data/Array.o Data/STRef.o \
131 Data/Dynamic.o Data/Typeable.o Data/PackedString.o System/Mem/Weak.o \
132 System/Mem/StableName.o System/Posix/Types.o Control/Monad/ST.o \
133 Control/Exception.o Foreign/C/Types.o Foreign/ForeignPtr.o: include/Typeable.h
134
135 System/Posix/Types.o Foreign/C/Types.o: include/CTypes.h
136
137 # -----------------------------------------------------------------------------
138
139 DIST_CLEAN_FILES += base.buildinfo config.cache config.status
140
141 include $(TOP)/mk/target.mk