/* This is the Jmakefile for the library stuff. This stuff is all written in (Glasgow-extended) Haskell. Everything here *must* be compiled w/ the Glasgow Haskell compiler. (Hence the use of $(GHC), rather than $(HC) [the latter is your "standard" Haskell compiler -- whatever you've configured]). If you use EXTRA_HC_OPTS on the command line (which you shouldn't, strictly speaking), it will probably work -- it is pinned onto GHC_OPTS, just for fun. */ /**************************************************************** * * * Jmakefile preamble-y things * * * ****************************************************************/ #define IHaveSubdirs #if IncludeTestDirsInBuild == YES #define __ghc_lib_tests_dir tests #else #define __ghc_lib_tests_dir /* nothing */ #endif SUBDIRS = cbits __ghc_lib_tests_dir #define NoDocsTargetForSubdirs #define NoInstallDocsTargetForSubdirs #define NoDependTargetForSubdirs GhcDriverNeededHere(depend all) EtagsNeededHere(tags) /**************************************************************** * * * options used for compiling/etc. things * * * ****************************************************************/ /* The driver will give warnings if -split-objs, but that's cool... */ GHC_OPTS=-short -cpp \ -dcore-lint \ -irequired \ -fusing-ghc-internals \ HcMaxHeapFlag $(EXTRA_HC_OPTS) PREL_OPTS=/*???-fcompiling-ghc-internals -fno-implicit-prelude*/ /* per-build options: shared with RTS */ #define rts_or_lib(r,l) l #include "../mkworld/GHC_OPTS" /* this is just friendliness to "hstags" */ HSTAGS_OPTS=-fglasgow-exts /***************************************************************/ /**************************************************************** * * * what it is we are compiling; * * these are long and tedious lists, but c'est la guerre * * * ****************************************************************/ BASIC_HS = \ prelude/Prelude.hs \ prelude/GHCbase.hs \ prelude/GHCps.hs \ prelude/GHCio.hs \ prelude/GHCmain.hs \ prelude/PreludeGlaST.hs \ \ required/Array.hs \ required/Char.hs \ required/Complex.hs \ required/Directory.hs \ required/IO.hs \ required/Ix.hs \ required/List.hs \ required/Maybe.hs \ required/Monad.hs \ required/Ratio.hs \ required/System.hs \ \ concurrent/Channel.hs \ concurrent/ChannelVar.hs \ concurrent/Merge.hs \ concurrent/Parallel.hs \ concurrent/SampleVar.hs \ concurrent/Semaphore.hs \ concurrent/Concurrent.hs BASIC_OBJS_DIRS = $(BASIC_HS:.hs=) /* easy way to make many many Make variables: */ WayThingVars(BASIC) /************************************************************************ * * * Macros for creating and installing libHS.a (in its many flavors). * * * *************************************************************************/ #ifndef SpecialGhcLibraryTarget #define SpecialGhcLibraryTarget(lib,tag,objs_DEP,objs_DIR,find_pat) @@\ AllTarget(CAT3(lib,tag,.a)) @@\ CAT3(lib,tag,.a):: objs_DEP @@\ $(RM) $@ @@\ TMPDIR=$(TMPDIR); export TMPDIR; \ find objs_DIR -name find_pat -print | xargs ar q $@ @@\ $(RANLIB) CAT3(lib,tag,.a) @@\ clean :: @@\ $(RM) CAT3(lib,tag,.a) #endif /* SpecialGhcLibraryTarget */ #ifndef SpecialGhcLibInstallTarget #if DoInstallGHCSystem == YES #define SpecialGhcLibInstallTarget(lib,tag) @@\ install :: CAT3(lib,tag,.a) @@\ $(INSTALL) $(INSTLIBFLAGS) CAT3(lib,tag,.a) \ $(INSTLIBDIR_GHC)/CAT3(lib,tag,.a) @@\ $(RANLIB) $(INSTLIBDIR_GHC)/CAT3(lib,tag,.a) #else /* ! DoInstallGhc... */ #define SpecialGhcLibInstallTarget(lib,tag) /*nothing*/ #endif /* ! DoInstallGhc... */ #endif /* SpecialGhcLibInstallTarget */ /* build/install all the diff libs for a particular build */ #define BigHisTarget(targeti,basei) @@\ targeti :: @@\ InstallTarget(targeti) @@\ InstallMultNonExecTargets(targeti,basei,$(INSTDATADIR_GHC)/imports) #define BigLibsTarget(tag,glob,base) @@\ SpecialGhcLibraryTarget(libHS,tag,base,$(BASIC_OBJS_DIRS),glob) @@\ SpecialGhcLibInstallTarget(libHS,tag) /* build *everything* -- monster macro from hell */ #define BigBuildTarget(tag,glob,targeti,base,basei) \ BigLibsTarget(tag,glob,base) @@\ BigHisTarget(targeti,basei) /**************************************************************** * * * Creating and installing... * * libHS_.a standard Prelude library * * * ****************************************************************/ /* make sure install's target dir is there */ #if DoInstallGHCSystem == YES MakeDirectories(install, $(INSTLIBDIR_GHC) \ $(INSTDATADIR_GHC)/imports) basic_his :: /* nothing */ InstallTarget(basic_his) InstallMultNonExecTargets(basic_his, $(BASIC_HIs), $(INSTDATADIR_GHC)/imports) #endif /* installing */ IfBuild_normal(BigBuildTarget(,'*.o',basic_his, $(BASIC_DEP_norm), $(BASIC_HIs))) IfBuild_p(BigBuildTarget(_p,'*.p_o',his_p, $(BASIC_DEP_p), $(BASIC_HIs_p))) IfBuild_t(BigBuildTarget(_t,'*.t_o',his_t, $(BASIC_DEP_t), $(BASIC_HIs_t))) IfBuild_u(BigBuildTarget(,'*.u_o',his_u, $(BASIC_DEP_u), $(BASIC_HIs_u))) IfBuild_mc(BigBuildTarget(_mc,'*.mc_o',his_mc, $(BASIC_DEP_mc), $(BASIC_HIs_mc))) IfBuild_mr(BigBuildTarget(_mr,'*.mr_o',his_mr, $(BASIC_DEP_mr), $(BASIC_HIs_mr))) IfBuild_mt(BigBuildTarget(_mr,'*.mt_o',his_mt, $(BASIC_DEP_mt), $(BASIC_HIs_mt))) IfBuild_mp(BigBuildTarget(_mp,'*.mp_o',his_mp, $(BASIC_DEP_mp), $(BASIC_HIs_mp))) IfBuild_mg(BigBuildTarget(_mg,'*.mg_o',his_mg, $(BASIC_DEP_mg), $(BASIC_HIs_mg))) /* these GC ones do not *really* need separate .hi files, but it really makes life easier to do it this way */ IfBuild_2s(BigBuildTarget(_2s,'*.2s_o',his_2s, $(BASIC_DEP_2s), $(BASIC_HIs_2s))) IfBuild_1s(BigBuildTarget(_1s,'*.1s_o',his_1s, $(BASIC_DEP_1s), $(BASIC_HIs_1s))) IfBuild_du(BigBuildTarget(_du,'*.du_o',his_du, $(BASIC_DEP_du), $(BASIC_HIs_du))) /* user ways -- yeeps! */ IfBuild_a(BigBuildTarget(_a,'*.a_o',his_a, $(BASIC_DEP_a), $(BASIC_HIs_a))) IfBuild_b(BigBuildTarget(_b,'*.b_o',his_b, $(BASIC_DEP_b), $(BASIC_HIs_b))) IfBuild_c(BigBuildTarget(_c,'*.c_o',his_c, $(BASIC_DEP_c), $(BASIC_HIs_c))) IfBuild_d(BigBuildTarget(_d,'*.d_o',his_d, $(BASIC_DEP_d), $(BASIC_HIs_d))) IfBuild_e(BigBuildTarget(_e,'*.e_o',his_e, $(BASIC_DEP_e), $(BASIC_HIs_e))) IfBuild_f(BigBuildTarget(_f,'*.f_o',his_f, $(BASIC_DEP_f), $(BASIC_HIs_f))) IfBuild_g(BigBuildTarget(_g,'*.g_o',his_g, $(BASIC_DEP_g), $(BASIC_HIs_g))) IfBuild_h(BigBuildTarget(_h,'*.h_o',his_h, $(BASIC_DEP_h), $(BASIC_HIs_h))) IfBuild_i(BigBuildTarget(_i,'*.i_o',his_i, $(BASIC_DEP_i), $(BASIC_HIs_i))) IfBuild_j(BigBuildTarget(_j,'*.j_o',his_j, $(BASIC_DEP_j), $(BASIC_HIs_j))) IfBuild_k(BigBuildTarget(_k,'*.k_o',his_k, $(BASIC_DEP_k), $(BASIC_HIs_k))) IfBuild_l(BigBuildTarget(_l,'*.l_o',his_l, $(BASIC_DEP_l), $(BASIC_HIs_l))) IfBuild_m(BigBuildTarget(_m,'*.m_o',his_m, $(BASIC_DEP_m), $(BASIC_HIs_m))) IfBuild_n(BigBuildTarget(_n,'*.n_o',his_n, $(BASIC_DEP_n), $(BASIC_HIs_n))) IfBuild_o(BigBuildTarget(_o,'*.o_o',his_o, $(BASIC_DEP_o), $(BASIC_HIs_o))) IfBuild_A(BigBuildTarget(_A,'*.A_o',his_A, $(BASIC_DEP_A), $(BASIC_HIs_A))) IfBuild_B(BigBuildTarget(_B,'*.B_o',his_B, $(BASIC_DEP_B), $(BASIC_HIs_B))) /**************************************************************** * * * Creating the individual .hc files: * * * * For the just-vary-the-GC-thanks flavors, we only need to * * compile .hs->.hc once; then re-use the .hc file each time. * * * * For the profiling one (_p) and all the user-specified * * ones, we recompile the Haskell each time. * * * * NB: old (WDP 95/06) * ****************************************************************/ /* some "helpful" internal macros first... */ #if GhcWithHscBuiltViaC == YES && HaskellCompilerType == HC_USE_HC_FILES #define CompileWayishly__(hc,file,isuf,way,flags) @@\ clean :: @@\ $(RM) CAT3(file,way,.hc) #endif /* now use the macro: */ CompileWayishly(GHC,prelude/Prelude,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals Prelude -fno-implicit-prelude) CompileWayishly(GHC,prelude/GHCbase,hs,-iprelude -fglasgow-exts -fcompiling-ghc-internals GHCbase) CompileWayishly(GHC,prelude/GHCps,hs, -iprelude -fglasgow-exts) CompileWayishly(GHC,prelude/GHCio,hs, -iprelude -fglasgow-exts) CompileWayishly(GHC,prelude/GHCmain,hs,-iprelude -fglasgow-exts) CompileWayishly(GHC,prelude/PreludeGlaST,hs,-iprelude -fglasgow-exts) CompileWayishly(GHC,required/Array,hs,-fglasgow-exts -iprelude) CompileWayishly(GHC,required/Char,hs,) CompileWayishly(GHC,required/Complex,hs,) CompileWayishly(GHC,required/Directory,hs,-fglasgow-exts) CompileWayishly(GHC,required/IO,hs,-fglasgow-exts) CompileWayishly(GHC,required/Ix,hs,-fglasgow-exts) CompileWayishly(GHC,required/List,hs,) CompileWayishly(GHC,required/Maybe,hs,) CompileWayishly(GHC,required/Monad,hs,) CompileWayishly(GHC,required/Ratio,hs,) CompileWayishly(GHC,required/System,hs,-fglasgow-exts) CompileWayishly(GHC,concurrent/Channel,hs,) CompileWayishly(GHC,concurrent/ChannelVar,hs,) CompileWayishly(GHC,concurrent/Merge,hs,-iconcurrent) CompileWayishly(GHC,concurrent/Parallel,hs,) CompileWayishly(GHC,concurrent/SampleVar,hs,) CompileWayishly(GHC,concurrent/Semaphore,hs,) CompileWayishly(GHC,concurrent/Concurrent,hs,-iconcurrent) /**************************************************************** * * * misc "make" targets -- depend, clean, tags * * * ****************************************************************/ /* this is a BAD idea! ExtraStuffToClean( $(SRCS_C) ) without the .hc files, the distrib cannot boot itself */ ExtraStuffToBeVeryClean( $(SRCS_C) ) ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) ) ClearTagsFile() /* Ugly but OK? [WDP 94/09] */ HsTagsTarget( */[A-Z]*.*hs ) HSTAGS_OPTS=-cpp -fglasgow-exts /* should be *LAST* */ #if HaskellCompilerType != HC_USE_HC_FILES /* otherwise, the dependencies jeopardize our .hc files -- which are all we have! */ MAIN_INCLUDE_DIR = $(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES) MKDEPENDHS_OPTS= -o .hc -I$(MAIN_INCLUDE_DIR) HaskellDependTarget( $(BASIC_HS_PREL) ) #endif