[project @ 1997-03-17 20:34:25 by simonpj]
[ghc-hetmet.git] / ghc / lib / Jmakefile
1 /* This is the Jmakefile for the library stuff.
2    This stuff is all written in (Glasgow-extended) Haskell.
3
4 Everything here *must* be compiled w/ the Glasgow Haskell compiler.
5 (Hence the use of $(GHC), rather than $(HC) [the latter is your "standard"
6 Haskell compiler -- whatever you've configured]).
7
8 If you use EXTRA_HC_OPTS on the command line (which you shouldn't,
9 strictly speaking), it will probably work -- it is pinned onto
10 GHC_OPTS, just for fun.
11 */
12
13 /****************************************************************
14 *                                                               *
15 * Jmakefile preamble-y things                                   *
16 *                                                               *
17 ****************************************************************/
18
19 #define IHaveSubdirs
20
21 #if IncludeTestDirsInBuild == YES
22 #define __ghc_lib_tests_dir tests
23 #else
24 #define __ghc_lib_tests_dir /* nothing */
25 #endif
26
27 SUBDIRS = cbits __ghc_lib_tests_dir
28
29 #define NoDocsTargetForSubdirs
30 #define NoInstallDocsTargetForSubdirs
31 #define NoDependTargetForSubdirs
32
33 GhcDriverNeededHere(depend all)
34 EtagsNeededHere(tags)
35
36 /****************************************************************
37 *                                                               *
38 * options used for compiling/etc. things                        *
39 *                                                               *
40 ****************************************************************/
41
42 /* The driver will give warnings if -split-objs, but that's cool... */
43 GHC_OPTS=-recomp -cpp           \
44          -dcore-lint            \
45          -irequired:glaExts:ghc \
46          HcMaxHeapFlag $(EXTRA_HC_OPTS)
47
48 EXTRA_MKDEPENDHS_OPTS = -irequired:prelude:ghc:hbc:glaExts:concurrent
49
50 PREL_OPTS=
51
52 /* per-build options: shared with RTS */
53 #define rts_or_lib(r,l) l
54 #include "../mkworld/GHC_OPTS"
55
56 /* this is just friendliness to "hstags" */
57 HSTAGS_OPTS=-fglasgow-exts
58
59 /***************************************************************/
60
61 /****************************************************************
62 *                                                               *
63 * what it is we are compiling;                                  *
64 *   these are long and tedious lists, but c'est la guerre       *
65 *                                                               *
66 ****************************************************************/
67
68 BASIC_HS =              \
69 required/Prelude.lhs    \
70 required/Array.lhs              \
71 required/Char.lhs               \
72 required/Complex.lhs            \
73 required/Directory.lhs          \
74 required/IO.lhs                 \
75 required/Ix.lhs                 \
76 required/List.lhs               \
77 required/Maybe.lhs              \
78 required/Monad.lhs              \
79 required/Ratio.lhs              \
80 required/System.lhs             \
81 \
82 ghc/PrelBase.lhs        \
83 ghc/GHCerr.lhs          \
84 ghc/PrelIO.lhs          \
85 ghc/IOHandle.lhs        \
86 ghc/IOBase.lhs          \
87 ghc/STBase.lhs          \
88 ghc/ArrBase.lhs         \
89 ghc/PrelRead.lhs        \
90 ghc/GHCmain.lhs         \
91 ghc/PrelList.lhs        \
92 ghc/PrelNum.lhs         \
93 ghc/PrelTup.lhs         \
94 \
95 glaExts/ST.lhs          \
96 glaExts/Foreign.lhs     \
97 glaExts/PackedString.lhs        \
98
99 # Leave out concurrency for now
100 # \
101 ghc/ConcBase.lhs        \
102 # concurrent/Channel.lhs                \
103 # concurrent/ChannelVar.lhs     \
104 # concurrent/Merge.lhs          \
105 # concurrent/Parallel.lhs               \
106 # concurrent/SampleVar.lhs      \
107 # concurrent/Semaphore.lhs      \
108 # concurrent/Concurrent.lhs
109
110 BASIC_HIs = $(BASIC_HS:.lhs=.hi)
111
112 BASIC_OBJS_DIRS = $(BASIC_HS:.lhs=)
113
114 /* easy way to make many many Make variables: */
115 WayThingVars(BASIC)
116
117 /************************************************************************
118 *                                                                       *
119 * Macros for creating and installing libHS<x>.a (in its many flavors).  *
120 *                                                                       *
121 *************************************************************************/
122
123 /****************************************************************
124 *                                                               *
125 * Creating and installing...                                    *
126 *       libHS_<tag>.a           standard Prelude library        *
127 *                                                               *
128 ****************************************************************/
129
130 /* make sure install's target dir is there */
131 #if DoInstallGHCSystem == YES
132 MakeDirectories(install, $(INSTLIBDIR_GHC) $(INSTDATADIR_GHC)/imports)
133
134 InstallDataTarget(MODULES,$(INSTDATADIR_GHC)/imports)
135 #endif /* installing */
136
137 BasicEverything(libHS, $(INSTLIBDIR_GHC), $(INSTDATADIR_GHC))
138
139 /****************************************************************
140 *                                                               *
141 * Creating the individual .hc files:                            *
142 *                                                               *
143 *   For the just-vary-the-GC-thanks flavors, we only need to    *
144 *   compile .hs->.hc once; then re-use the .hc file each time.  *
145 *                                                               *
146 *   For the profiling one (_p) and all the user-specified       *
147 *   ones, we recompile the Haskell each time.                   *
148 *                                                               *
149 *  NB: old (WDP 95/06)                                          *
150 ****************************************************************/
151
152 /* some "helpful" internal macros first... */
153
154 #if GhcWithHscBuiltViaC == YES && HaskellCompilerType == HC_USE_HC_FILES
155 #define CompileWayishly__(hc,file,isuf,way,flags)       @@\
156 clean  ::                                               @@\
157         $(RM) CAT3(file,way,.hc)
158 #endif
159
160 /* now use the macro: */
161
162 /* NB: the -Onots are only because -O would not go through on
163    a reasonably-sized machine (i.e., one I have)
164 */
165
166
167 CompileWayishly(GHC,required/Prelude,lhs,       /*-split-objs Prelude*/         -fglasgow-exts)
168 CompileWayishly(GHC,required/Array,lhs,         /*-split-objs Array*/           -fglasgow-exts)
169 CompileWayishly(GHC,required/Char,lhs,          /*-split-objs Char*/)
170 CompileWayishly(GHC,required/Complex,lhs,       /*-split-objs Complex*/)
171 CompileWayishly(GHC,required/Ix,lhs,            /*-split-objs Ix*/              -fglasgow-exts)
172 CompileWayishly(GHC,required/List,lhs,          /*-split-objs List*/)
173 CompileWayishly(GHC,required/Maybe,lhs,         /*-split-objs Maybe*/)
174 CompileWayishly(GHC,required/Monad,lhs,         /*-split-objs Monad*/)
175 CompileWayishly(GHC,required/Ratio,lhs,         /*-split-objs Ratio*/)
176
177 CompileWayishly(GHC,required/Directory,lhs,     /*-split-objs Directory*/       -fglasgow-exts \
178                                                 '-#include"cbits/stgio.h"' -monly-3-regs)
179 CompileWayishly(GHC,required/IO,lhs,            /*-split-objs IO*/              -fglasgow-exts \
180                                                 '-#include"cbits/stgio.h"')
181 CompileWayishly(GHC,required/System,lhs,        /*-split-objs System*/          -fglasgow-exts \
182                                                  '-#include"cbits/stgio.h"')
183
184
185 CompileWayishly(GHC,ghc/ConcBase,lhs,           /*-split-objs ConcBase*/        -fglasgow-exts)
186 CompileWayishly(GHC,ghc/PrelBase,lhs,           /*-split-objs PrelBase*/        -fglasgow-exts)
187 CompileWayishly(GHC,ghc/STBase,lhs,             /*-split-objs STBase*/          -fglasgow-exts)
188 CompileWayishly(GHC,ghc/IOBase,lhs,             /*-split-objs IOBase*/          -fglasgow-exts)
189 CompileWayishly(GHC,ghc/ArrBase,lhs,            /*-split-objs ArrBase*/         -fglasgow-exts)
190 CompileWayishly(GHC,ghc/PrelRead,lhs,           /*-split-objs PrelRead*/        -fglasgow-exts)
191 CompileWayishly(GHC,ghc/PrelList,lhs,           /*-split-objs PrelList*/)
192 CompileWayishly(GHC,ghc/PrelNum,lhs,            /*-split-objs PrelNum*/         -fglasgow-exts)
193 CompileWayishly(GHC,ghc/PrelTup,lhs,            /*-split-objs PrelTup*/)
194 CompileWayishly(GHC,ghc/PrelIO,lhs,             /*-split-objs PrelIO*/          -fglasgow-exts)
195 CompileWayishly(GHC,ghc/IOHandle,lhs,           /*-split-objs IOHandle*/        -fglasgow-exts)
196 CompileWayishly(GHC,ghc/GHCerr,lhs,             /*-split-objs GHCerr*/          -fglasgow-exts)
197 CompileWayishly(GHC,ghc/GHCmain,lhs,            /*-split-objs GHCmain*/         -fglasgow-exts)
198
199 CompileWayishly(GHC,glaExts/Foreign,lhs,        /*-split-objs Foreign*/         -fglasgow-exts)
200 CompileWayishly(GHC,glaExts/ST,lhs,             /*-split-objs ST*/              -fglasgow-exts)
201 CompileWayishly(GHC,glaExts/PackedString,lhs,   /*-split-objs PackedString*/    -fglasgow-exts)
202
203
204 CompileWayishly(GHC,concurrent/Channel,lhs,)
205 CompileWayishly(GHC,concurrent/ChannelVar,lhs,)
206 CompileWayishly(GHC,concurrent/Merge,lhs,-iconcurrent)
207 CompileWayishly(GHC,concurrent/Parallel,lhs,-fglasgow-exts)
208 CompileWayishly(GHC,concurrent/SampleVar,lhs,)
209 CompileWayishly(GHC,concurrent/Semaphore,lhs,)
210 CompileWayishly(GHC,concurrent/Concurrent,lhs,-iconcurrent)
211
212 /****************************************************************
213 *                                                               *
214 * misc "make" targets -- depend, clean, tags                    *
215 *                                                               *
216 ****************************************************************/
217
218 hc-files : $(BASIC_HS:.lhs=.hc)
219
220 /* this is a BAD idea!
221 ExtraStuffToClean( $(SRCS_C) )
222    without the .hc files, the distrib cannot boot itself
223 */
224 ExtraStuffToBeVeryClean( $(SRCS_C) )
225 ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )
226
227 ClearTagsFile()
228 /* Ugly but OK? [WDP 94/09] */
229 HsTagsTarget( */[A-Z]*.*hs )
230 HSTAGS_OPTS=-cpp -fglasgow-exts
231
232 /* should be *LAST* */
233 #if HaskellCompilerType != HC_USE_HC_FILES
234     /* otherwise, the dependencies jeopardize our .hc files --
235         which are all we have! */
236 MAIN_INCLUDE_DIR = $(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES)
237
238 MKDEPENDHS_OPTS= \
239 IfBuild_mc(-s mc) \
240 IfBuild_mr(-s mr) \
241 IfBuild_mt(-s mt) \
242 IfBuild_mp(-s mp) \
243 IfBuild_mg(-s mg) \
244 IfBuild_2s(-s 2s) \
245 IfBuild_1s(-s 1s) \
246 IfBuild_du(-s du) \
247 IfBuild_p(-s p) \
248 IfBuild_t(-s t) \
249 IfBuild_a(-s a) \
250 IfBuild_b(-s b) \
251 IfBuild_c(-s c) \
252 IfBuild_d(-s d) \
253 IfBuild_e(-s e) \
254 IfBuild_f(-s f) \
255 IfBuild_g(-s g) \
256 IfBuild_h(-s h) \
257 IfBuild_i(-s i) \
258 IfBuild_j(-s j) \
259 IfBuild_k(-s k) \
260 IfBuild_l(-s l) \
261 IfBuild_m(-s m) \
262 IfBuild_n(-s n) \
263 IfBuild_o(-s o) \
264 IfBuild_A(-s A) \
265 IfBuild_B(-s B) \
266 -o hc -I$(MAIN_INCLUDE_DIR) 
267
268 HaskellDependTarget( $(BASIC_HS) )
269 #endif