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