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