1 /* This is the Jmakefile for the library stuff.
2 This stuff is all written in (Glasgow-extended) Haskell.
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]).
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.
13 /****************************************************************
15 * Jmakefile preamble-y things *
17 ****************************************************************/
21 #if IncludeTestDirsInBuild == YES
22 #define __ghc_lib_tests_dir tests
24 #define __ghc_lib_tests_dir /* nothing */
27 SUBDIRS = cbits __ghc_lib_tests_dir
29 #define NoDocsTargetForSubdirs
30 #define NoInstallDocsTargetForSubdirs
31 #define NoDependTargetForSubdirs
33 GhcDriverNeededHere(depend all)
36 /****************************************************************
38 * options used for compiling/etc. things *
40 ****************************************************************/
42 /* The driver will give warnings if -split-objs, but that's cool... */
43 GHC_OPTS=-short -cpp \
46 -fusing-ghc-internals \
47 HcMaxHeapFlag $(EXTRA_HC_OPTS)
49 PREL_OPTS=/*???-fcompiling-ghc-internals -fno-implicit-prelude*/
51 /* per-build options: shared with RTS */
52 #define rts_or_lib(r,l) l
53 #include "../mkworld/GHC_OPTS"
55 /* this is just friendliness to "hstags" */
56 HSTAGS_OPTS=-fglasgow-exts
58 /***************************************************************/
60 /****************************************************************
62 * what it is we are compiling; *
63 * these are long and tedious lists, but c'est la guerre *
65 ****************************************************************/
73 prelude/PreludeGlaST.hs \
78 required/Directory.hs \
87 concurrent/Channel.hs \
88 concurrent/ChannelVar.hs \
90 concurrent/Parallel.hs \
91 concurrent/SampleVar.hs \
92 concurrent/Semaphore.hs \
93 concurrent/Concurrent.hs
95 BASIC_OBJS_DIRS = $(BASIC_HS:.hs=)
97 /* easy way to make many many Make variables: */
100 /************************************************************************
102 * Macros for creating and installing libHS<x>.a (in its many flavors). *
104 *************************************************************************/
106 #ifndef SpecialGhcLibraryTarget
107 #define SpecialGhcLibraryTarget(lib,tag,objs_DEP,objs_DIR,find_pat) @@\
108 AllTarget(CAT3(lib,tag,.a)) @@\
109 CAT3(lib,tag,.a):: objs_DEP @@\
111 TMPDIR=$(TMPDIR); export TMPDIR; \
112 find objs_DIR -name find_pat -print | xargs ar q $@ @@\
113 $(RANLIB) CAT3(lib,tag,.a) @@\
115 $(RM) CAT3(lib,tag,.a)
116 #endif /* SpecialGhcLibraryTarget */
118 #ifndef SpecialGhcLibInstallTarget
119 #if DoInstallGHCSystem == YES
120 #define SpecialGhcLibInstallTarget(lib,tag) @@\
121 install :: CAT3(lib,tag,.a) @@\
122 $(INSTALL) $(INSTLIBFLAGS) CAT3(lib,tag,.a) \
123 $(INSTLIBDIR_GHC)/CAT3(lib,tag,.a) @@\
124 $(RANLIB) $(INSTLIBDIR_GHC)/CAT3(lib,tag,.a)
125 #else /* ! DoInstallGhc... */
126 #define SpecialGhcLibInstallTarget(lib,tag) /*nothing*/
127 #endif /* ! DoInstallGhc... */
128 #endif /* SpecialGhcLibInstallTarget */
130 /* build/install all the diff libs for a particular build */
132 #define BigHisTarget(targeti,basei) @@\
134 InstallTarget(targeti) @@\
135 InstallMultNonExecTargets(targeti,basei,$(INSTDATADIR_GHC)/imports)
137 #define BigLibsTarget(tag,glob,base) @@\
138 SpecialGhcLibraryTarget(libHS,tag,base,$(BASIC_OBJS_DIRS),glob) @@\
139 SpecialGhcLibInstallTarget(libHS,tag)
141 /* build *everything* -- monster macro from hell */
142 #define BigBuildTarget(tag,glob,targeti,base,basei) \
143 BigLibsTarget(tag,glob,base) @@\
144 BigHisTarget(targeti,basei)
146 /****************************************************************
148 * Creating and installing... *
149 * libHS_<tag>.a standard Prelude library *
151 ****************************************************************/
153 /* make sure install's target dir is there */
154 #if DoInstallGHCSystem == YES
155 MakeDirectories(install, $(INSTLIBDIR_GHC) \
156 $(INSTDATADIR_GHC)/imports)
158 basic_his :: /* nothing */
159 InstallTarget(basic_his)
160 InstallMultNonExecTargets(basic_his, $(BASIC_HIs), $(INSTDATADIR_GHC)/imports)
161 #endif /* installing */
163 IfBuild_normal(BigBuildTarget(,'*.o',basic_his, $(BASIC_DEP_norm), $(BASIC_HIs)))
164 IfBuild_p(BigBuildTarget(_p,'*.p_o',his_p, $(BASIC_DEP_p), $(BASIC_HIs_p)))
165 IfBuild_t(BigBuildTarget(_t,'*.t_o',his_t, $(BASIC_DEP_t), $(BASIC_HIs_t)))
166 IfBuild_u(BigBuildTarget(,'*.u_o',his_u, $(BASIC_DEP_u), $(BASIC_HIs_u)))
167 IfBuild_mc(BigBuildTarget(_mc,'*.mc_o',his_mc, $(BASIC_DEP_mc), $(BASIC_HIs_mc)))
168 IfBuild_mr(BigBuildTarget(_mr,'*.mr_o',his_mr, $(BASIC_DEP_mr), $(BASIC_HIs_mr)))
169 IfBuild_mt(BigBuildTarget(_mr,'*.mt_o',his_mt, $(BASIC_DEP_mt), $(BASIC_HIs_mt)))
170 IfBuild_mp(BigBuildTarget(_mp,'*.mp_o',his_mp, $(BASIC_DEP_mp), $(BASIC_HIs_mp)))
171 IfBuild_mg(BigBuildTarget(_mg,'*.mg_o',his_mg, $(BASIC_DEP_mg), $(BASIC_HIs_mg)))
173 /* these GC ones do not *really* need separate .hi files,
174 but it really makes life easier to do it this way
176 IfBuild_2s(BigBuildTarget(_2s,'*.2s_o',his_2s, $(BASIC_DEP_2s), $(BASIC_HIs_2s)))
177 IfBuild_1s(BigBuildTarget(_1s,'*.1s_o',his_1s, $(BASIC_DEP_1s), $(BASIC_HIs_1s)))
178 IfBuild_du(BigBuildTarget(_du,'*.du_o',his_du, $(BASIC_DEP_du), $(BASIC_HIs_du)))
180 /* user ways -- yeeps! */
182 IfBuild_a(BigBuildTarget(_a,'*.a_o',his_a, $(BASIC_DEP_a), $(BASIC_HIs_a)))
183 IfBuild_b(BigBuildTarget(_b,'*.b_o',his_b, $(BASIC_DEP_b), $(BASIC_HIs_b)))
184 IfBuild_c(BigBuildTarget(_c,'*.c_o',his_c, $(BASIC_DEP_c), $(BASIC_HIs_c)))
185 IfBuild_d(BigBuildTarget(_d,'*.d_o',his_d, $(BASIC_DEP_d), $(BASIC_HIs_d)))
186 IfBuild_e(BigBuildTarget(_e,'*.e_o',his_e, $(BASIC_DEP_e), $(BASIC_HIs_e)))
187 IfBuild_f(BigBuildTarget(_f,'*.f_o',his_f, $(BASIC_DEP_f), $(BASIC_HIs_f)))
188 IfBuild_g(BigBuildTarget(_g,'*.g_o',his_g, $(BASIC_DEP_g), $(BASIC_HIs_g)))
189 IfBuild_h(BigBuildTarget(_h,'*.h_o',his_h, $(BASIC_DEP_h), $(BASIC_HIs_h)))
190 IfBuild_i(BigBuildTarget(_i,'*.i_o',his_i, $(BASIC_DEP_i), $(BASIC_HIs_i)))
191 IfBuild_j(BigBuildTarget(_j,'*.j_o',his_j, $(BASIC_DEP_j), $(BASIC_HIs_j)))
192 IfBuild_k(BigBuildTarget(_k,'*.k_o',his_k, $(BASIC_DEP_k), $(BASIC_HIs_k)))
193 IfBuild_l(BigBuildTarget(_l,'*.l_o',his_l, $(BASIC_DEP_l), $(BASIC_HIs_l)))
194 IfBuild_m(BigBuildTarget(_m,'*.m_o',his_m, $(BASIC_DEP_m), $(BASIC_HIs_m)))
195 IfBuild_n(BigBuildTarget(_n,'*.n_o',his_n, $(BASIC_DEP_n), $(BASIC_HIs_n)))
196 IfBuild_o(BigBuildTarget(_o,'*.o_o',his_o, $(BASIC_DEP_o), $(BASIC_HIs_o)))
197 IfBuild_A(BigBuildTarget(_A,'*.A_o',his_A, $(BASIC_DEP_A), $(BASIC_HIs_A)))
198 IfBuild_B(BigBuildTarget(_B,'*.B_o',his_B, $(BASIC_DEP_B), $(BASIC_HIs_B)))
200 /****************************************************************
202 * Creating the individual .hc files: *
204 * For the just-vary-the-GC-thanks flavors, we only need to *
205 * compile .hs->.hc once; then re-use the .hc file each time. *
207 * For the profiling one (_p) and all the user-specified *
208 * ones, we recompile the Haskell each time. *
210 * NB: old (WDP 95/06) *
211 ****************************************************************/
213 /* some "helpful" internal macros first... */
215 #if GhcWithHscBuiltViaC == YES && HaskellCompilerType == HC_USE_HC_FILES
216 #define CompileWayishly__(hc,file,isuf,way,flags) @@\
218 $(RM) CAT3(file,way,.hc)
221 /* now use the macro: */
223 CompileWayishly(GHC,prelude/Prelude,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals Prelude -fno-implicit-prelude)
224 CompileWayishly(GHC,prelude/GHCbase,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase)
225 CompileWayishly(GHC,prelude/GHCps,hs, -iprelude -fglasgow-exts)
226 CompileWayishly(GHC,prelude/GHCio,hs, -iprelude -fglasgow-exts)
227 CompileWayishly(GHC,prelude/GHCmain,hs,-iprelude -fglasgow-exts)
228 CompileWayishly(GHC,prelude/PreludeGlaST,hs,-iprelude -fglasgow-exts)
230 CompileWayishly(GHC,required/Array,hs,-fglasgow-exts -iprelude)
231 CompileWayishly(GHC,required/Char,hs,)
232 CompileWayishly(GHC,required/Complex,hs,)
233 CompileWayishly(GHC,required/Directory,hs,-fglasgow-exts)
234 CompileWayishly(GHC,required/IO,hs,-fglasgow-exts)
235 CompileWayishly(GHC,required/Ix,hs,-fglasgow-exts)
236 CompileWayishly(GHC,required/List,hs,)
237 CompileWayishly(GHC,required/Maybe,hs,)
238 CompileWayishly(GHC,required/Monad,hs,)
239 CompileWayishly(GHC,required/Ratio,hs,)
240 CompileWayishly(GHC,required/System,hs,-fglasgow-exts)
242 CompileWayishly(GHC,concurrent/Channel,hs,)
243 CompileWayishly(GHC,concurrent/ChannelVar,hs,)
244 CompileWayishly(GHC,concurrent/Merge,hs,-iconcurrent)
245 CompileWayishly(GHC,concurrent/Parallel,hs,)
246 CompileWayishly(GHC,concurrent/SampleVar,hs,)
247 CompileWayishly(GHC,concurrent/Semaphore,hs,)
248 CompileWayishly(GHC,concurrent/Concurrent,hs,-iconcurrent)
250 /****************************************************************
252 * misc "make" targets -- depend, clean, tags *
254 ****************************************************************/
256 /* this is a BAD idea!
257 ExtraStuffToClean( $(SRCS_C) )
258 without the .hc files, the distrib cannot boot itself
260 ExtraStuffToBeVeryClean( $(SRCS_C) )
261 ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )
264 /* Ugly but OK? [WDP 94/09] */
265 HsTagsTarget( */[A-Z]*.*hs )
266 HSTAGS_OPTS=-cpp -fglasgow-exts
268 /* should be *LAST* */
269 #if HaskellCompilerType != HC_USE_HC_FILES
270 /* otherwise, the dependencies jeopardize our .hc files --
271 which are all we have! */
272 MAIN_INCLUDE_DIR = $(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES)
273 MKDEPENDHS_OPTS= -o .hc -I$(MAIN_INCLUDE_DIR)
275 HaskellDependTarget( $(BASIC_HS_PREL) )