[project @ 1996-11-15 17:29:21 by sof]
[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             \
46          -fusing-ghc-internals  \
47          HcMaxHeapFlag $(EXTRA_HC_OPTS)
48
49 EXTRA_MKDEPENDHS_OPTS = -irequired:prelude:ghc:hbc:glaExts:concurrent
50
51
52 PREL_OPTS=/*???-fcompiling-ghc-internals -fno-implicit-prelude*/
53
54 /* per-build options: shared with RTS */
55 #define rts_or_lib(r,l) l
56 #include "../mkworld/GHC_OPTS"
57
58 /* this is just friendliness to "hstags" */
59 HSTAGS_OPTS=-fglasgow-exts
60
61 /***************************************************************/
62
63 /****************************************************************
64 *                                                               *
65 * what it is we are compiling;                                  *
66 *   these are long and tedious lists, but c'est la guerre       *
67 *                                                               *
68 ****************************************************************/
69
70 BASIC_HS =                      \
71 prelude/Prelude.hs              \
72 prelude/GHCbase.hs              \
73 prelude/GHCerr.hs               \
74 prelude/GHCps.hs                \
75 prelude/GHCio.hs                \
76 prelude/GHCmain.hs              \
77 prelude/PreludeGlaST.hs         \
78                                 \
79 required/Array.hs               \
80 required/Char.hs                \
81 required/Complex.hs             \
82 required/Directory.hs           \
83 required/IO.hs                  \
84 required/Ix.hs                  \
85 required/List.hs                \
86 required/Maybe.hs               \
87 required/Monad.hs               \
88 required/Ratio.hs               \
89 required/System.hs              \
90 \
91 concurrent/Channel.hs           \
92 concurrent/ChannelVar.hs        \
93 concurrent/Merge.hs             \
94 concurrent/Parallel.hs          \
95 concurrent/SampleVar.hs         \
96 concurrent/Semaphore.hs         \
97 concurrent/Concurrent.hs
98
99 BASIC_HIs = $(BASIC_HS:.hs=.hi)
100
101 BASIC_OBJS_DIRS = $(BASIC_HS:.hs=)
102
103 /* easy way to make many many Make variables: */
104 WayThingVars(BASIC)
105
106 /************************************************************************
107 *                                                                       *
108 * Macros for creating and installing libHS<x>.a (in its many flavors).  *
109 *                                                                       *
110 *************************************************************************/
111
112 /****************************************************************
113 *                                                               *
114 * Creating and installing...                                    *
115 *       libHS_<tag>.a           standard Prelude library        *
116 *                                                               *
117 ****************************************************************/
118
119 /* make sure install's target dir is there */
120 #if DoInstallGHCSystem == YES
121 MakeDirectories(install, $(INSTLIBDIR_GHC) $(INSTDATADIR_GHC)/imports)
122
123 InstallDataTarget(MODULES,$(INSTDATADIR_GHC)/imports)
124 #endif /* installing */
125
126 BasicEverything(libHS, $(INSTLIBDIR_GHC), $(INSTDATADIR_GHC))
127
128 /****************************************************************
129 *                                                               *
130 * Creating the individual .hc files:                            *
131 *                                                               *
132 *   For the just-vary-the-GC-thanks flavors, we only need to    *
133 *   compile .hs->.hc once; then re-use the .hc file each time.  *
134 *                                                               *
135 *   For the profiling one (_p) and all the user-specified       *
136 *   ones, we recompile the Haskell each time.                   *
137 *                                                               *
138 *  NB: old (WDP 95/06)                                          *
139 ****************************************************************/
140
141 /* some "helpful" internal macros first... */
142
143 #if GhcWithHscBuiltViaC == YES && HaskellCompilerType == HC_USE_HC_FILES
144 #define CompileWayishly__(hc,file,isuf,way,flags)       @@\
145 clean  ::                                               @@\
146         $(RM) CAT3(file,way,.hc)
147 #endif
148
149 /* now use the macro: */
150
151 /* NB: the -Onots are only because -O would not go through on
152    a reasonably-sized machine (i.e., one I have)
153 */
154 CompileWayishly(GHC,prelude/Prelude,hs,/*-split-objs Prelude*/ -iprelude -fglasgow-exts -fcompiling-ghc-internals Prelude -fno-implicit-prelude '-#include"cbits/stgio.h"' -H18m -Onot)
155 CompileWayishly(GHC,prelude/GHCbase,hs,/*-split-objs GHCbase*/ -iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase '-#include"cbits/stgio.h"' -H12m -monly-2-regs -Onot)
156 CompileWayishly(GHC,prelude/GHCerr,hs, /*-split-objs GHCerr*/ -iprelude -fglasgow-exts -fcompiling-ghc-internals GHCerr -H12m -Onot)
157 CompileWayishly(GHC,prelude/GHCps,hs,  /*-split-objs GHCps*/ -iprelude -fglasgow-exts '-#include"cbits/stgio.h"' -monly-3-regs -Onot)
158 CompileWayishly(GHC,prelude/GHCio,hs,  /*-split-objs GHCio*/ -iprelude -fglasgow-exts '-#include"cbits/stgio.h"' -Onot)
159 CompileWayishly(GHC,prelude/GHCmain,hs,-iprelude -fglasgow-exts)
160 CompileWayishly(GHC,prelude/PreludeGlaST,hs,-iprelude -fglasgow-exts)
161
162 CompileWayishly(GHC,required/Array,hs, /*-split-objs Array*/ -fglasgow-exts -iprelude -Onot)
163 CompileWayishly(GHC,required/Char,hs,  /*-split-objs Char*/)
164 CompileWayishly(GHC,required/Complex,hs,/*-split-objs Complex*/)
165 CompileWayishly(GHC,required/Directory,hs,/*-split-objs Directory*/ -fglasgow-exts '-#include"cbits/stgio.h"' -monly-3-regs)
166 CompileWayishly(GHC,required/IO,hs,/*-split-objs IO*/ -fglasgow-exts '-#include"cbits/stgio.h"')
167 CompileWayishly(GHC,required/Ix,hs,    /*-split-objs Ix*/ -fglasgow-exts)
168 CompileWayishly(GHC,required/List,hs,  /*-split-objs List*/)
169 CompileWayishly(GHC,required/Maybe,hs, /*-split-objs Maybe*/)
170 CompileWayishly(GHC,required/Monad,hs, /*-split-objs Monad*/)
171 CompileWayishly(GHC,required/Ratio,hs, /*-split-objs Ratio*/)
172 CompileWayishly(GHC,required/System,hs,/*-split-objs System*/ -fglasgow-exts '-#include"cbits/stgio.h"')
173
174 CompileWayishly(GHC,concurrent/Channel,hs,)
175 CompileWayishly(GHC,concurrent/ChannelVar,hs,)
176 CompileWayishly(GHC,concurrent/Merge,hs,-iconcurrent)
177 CompileWayishly(GHC,concurrent/Parallel,hs,-fglasgow-exts)
178 CompileWayishly(GHC,concurrent/SampleVar,hs,)
179 CompileWayishly(GHC,concurrent/Semaphore,hs,)
180 CompileWayishly(GHC,concurrent/Concurrent,hs,-iconcurrent)
181
182 /****************************************************************
183 *                                                               *
184 * misc "make" targets -- depend, clean, tags                    *
185 *                                                               *
186 ****************************************************************/
187
188 /* this is a BAD idea!
189 ExtraStuffToClean( $(SRCS_C) )
190    without the .hc files, the distrib cannot boot itself
191 */
192 ExtraStuffToBeVeryClean( $(SRCS_C) )
193 ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )
194
195 ClearTagsFile()
196 /* Ugly but OK? [WDP 94/09] */
197 HsTagsTarget( */[A-Z]*.*hs )
198 HSTAGS_OPTS=-cpp -fglasgow-exts
199
200 /* should be *LAST* */
201 #if HaskellCompilerType != HC_USE_HC_FILES
202     /* otherwise, the dependencies jeopardize our .hc files --
203         which are all we have! */
204 MAIN_INCLUDE_DIR = $(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES)
205 MKDEPENDHS_OPTS= \
206 IfBuild_mc(-s mc) \
207 IfBuild_mr(-s mr) \
208 IfBuild_mt(-s mt) \
209 IfBuild_mp(-s mp) \
210 IfBuild_mg(-s mg) \
211 IfBuild_2s(-s 2s) \
212 IfBuild_1s(-s 1s) \
213 IfBuild_du(-s du) \
214 IfBuild_p(-s p) \
215 IfBuild_t(-s t) \
216 IfBuild_a(-s a) \
217 IfBuild_b(-s b) \
218 IfBuild_c(-s c) \
219 IfBuild_d(-s d) \
220 IfBuild_e(-s e) \
221 IfBuild_f(-s f) \
222 IfBuild_g(-s g) \
223 IfBuild_h(-s h) \
224 IfBuild_i(-s i) \
225 IfBuild_j(-s j) \
226 IfBuild_k(-s k) \
227 IfBuild_l(-s l) \
228 IfBuild_m(-s m) \
229 IfBuild_n(-s n) \
230 IfBuild_o(-s o) \
231 IfBuild_A(-s A) \
232 IfBuild_B(-s B) \
233 -o hc -I$(MAIN_INCLUDE_DIR) 
234
235 HaskellDependTarget( $(BASIC_HS) )
236 #endif