3a857f85ca225c6bb9b86fe56762e396bb9046a7
[ghc-hetmet.git] / ghc / runtime / Makefile.libHSrts
1 #-----------------------------------------------------------------------------
2 # $Id: Makefile.libHSrts,v 1.3 1997/01/07 13:18:15 simonm Exp $
3
4 # The is the makefile for libHSrts, invoked once for each different build.
5
6 # The variable $(suffix) defines the current build.
7
8 # To make libHSrts for a specific build, you can do 
9 #       make -f Makefile.libHSrts suffix=<build>
10
11 #-----------------------------------------------------------------------------
12
13 TOP=../..
14 SuffixRules_WantStdOnes = NO
15 UnlitSuffixRules = YES_PLEASE
16 include $(TOP)/ghc/mk/ghc.mk
17
18 # If you use EXTRA_HC_OPTS on the command line (which you shouldn't,
19 # strictly speaking), it will probably work -- it is pinned onto
20 # GHC_OPTS, just for fun.
21
22 GHC_OPTS = $(EXTRA_HC_OPTS)
23
24 # per-build options: shared with libraries
25 DoingRTS = YES
26 include ../mk/buildflags.mk
27
28 #-----------------------------------------------------------------------------
29 # what it is we are compiling;
30 # these are long and tedious lists, but c'est la guerre
31
32 RTS_LH =                                \
33         storage/SMmarkDefs.lh           \
34         storage/SMcopying.lh            \
35         storage/SMcompacting.lh         \
36         storage/SMextn.lh               \
37         storage/SMinternal.lh
38
39 RTS_LC =                                \
40         c-as-asm/CallWrap_C.lc          \
41         c-as-asm/HpOverflow.lc          \
42         c-as-asm/StablePtr.lc           \
43         c-as-asm/StablePtrOps.lc        \
44         c-as-asm/StgDebug.lc            \
45         c-as-asm/StgMiniInt.lc          \
46         gum/GlobAddr.lc                 \
47         gum/HLComms.lc                  \
48         gum/Hash.lc                     \
49         gum/LLComms.lc                  \
50         gum/Pack.lc                     \
51         gum/ParInit.lc                  \
52         gum/RBH.lc                      \
53         gum/Sparks.lc                   \
54         gum/Unpack.lc                   \
55         main/GranSim.lc                 \
56         main/Itimer.lc                  \
57         main/Ticky.lc                   \
58         main/SMRep.lc                   \
59         main/Select.lc                  \
60         main/Signals.lc                 \
61         main/StgOverflow.lc             \
62         main/Threads.lc                 \
63         main/RtsFlags.lc                \
64         main/main.lc                    \
65         prims/PrimArith.lc              \
66         prims/PrimMisc.lc               \
67         profiling/CostCentre.lc         \
68         profiling/Hashing.lc            \
69         profiling/HeapProfile.lc        \
70         profiling/Indexing.lc           \
71         profiling/Timer.lc              \
72         storage/SM1s.lc                 \
73         storage/SM2s.lc                 \
74         storage/SMap.lc                 \
75         storage/SMcheck.lc              \
76         storage/SMcompacting.lc         \
77         storage/SMcopying.lc            \
78         storage/SMdu.lc                 \
79         storage/SMevac.lc               \
80         storage/SMextn.lc               \
81         storage/SMinit.lc               \
82         storage/SMmarking.lc            \
83         storage/SMscan.lc               \
84         storage/SMscav.lc               \
85         storage/SMstacks.lc             \
86         storage/SMstatic.lc             \
87         storage/SMstats.lc              \
88         storage/mprotect.lc
89
90 # LATER?: storage/SMgen.lc
91
92 RTS_LHC =                               \
93         main/StgStartup.lhc             \
94         main/StgUpdate.lhc              \
95         main/StgThreads.lhc             \
96         c-as-asm/PerformIO.lhc          \
97         storage/SMmark.lhc              \
98         gum/FetchMe.lhc
99
100 CLIB_LC =                               \
101         hooks/ErrorHdr.lc               \
102         hooks/FreeForeignObj.lc         \
103         hooks/OutOfHeap.lc              \
104         hooks/OutOfStk.lc               \
105         hooks/OutOfVM.lc                \
106         hooks/NoRunnableThrds.lc        \
107         hooks/PatErrorHdr.lc            \
108         hooks/TraceHooks.lc             \
109         hooks/SizeHooks.lc              \
110         hooks/InitEachPE.lc             \
111         main/Mallocs.lc
112
113 CLIB_LC =                               \
114         hooks/ErrorHdr.lc               \
115         hooks/FreeForeignObj.lc         \
116         hooks/OutOfHeap.lc              \
117         hooks/OutOfStk.lc               \
118         hooks/OutOfVM.lc                \
119         hooks/NoRunnableThrds.lc        \
120         hooks/PatErrorHdr.lc            \
121         hooks/TraceHooks.lc             \
122         hooks/SizeHooks.lc              \
123         hooks/InitEachPE.lc             \
124         main/Mallocs.lc
125
126 H_FILES = $(RTS_LH:.lh=.h)
127 C_FILES = $(RTS_LC:.lc=.c) $(RTS_LHC:.lhc=.hc) $(CLIB_LC:.lc=.c)
128
129 # Header files
130
131 all depend :: $(H_FILES)
132
133 clean ::
134         $(RM) $(H_FILES)
135         $(RM) $(C_FILES)
136
137 #-----------------------------------------------------------------------------
138 # Rules for building various types of objects from C files
139
140 RTS_GHC = $(GHC) -c -o $@ $(GHCFLAGS) $($*_flags) 
141
142 %.o : %.c
143         @$(RM) $@
144         $(RTS_GHC) $*.c
145
146 %.$(suffix)_o : %.c
147         @$(RM) $@
148         $(RTS_GHC) $(GHC_OPTS_$(suffix)) $*.c
149
150 %.$(suffix)_o : %.hc
151         @$(RM) $@
152         $(RTS_GHC) $(GHC_OPTS_$(suffix)) $*.hc
153
154 #-----------------------------------------------------------------------------
155
156 ifeq ($(suffix), mp)
157 ifdef solaris2_TARGET_OS
158 __socket_libs = -lsocket -lnsl
159 else
160 __socket_libs =
161 endif
162
163 all :: gum/SysMan
164
165 gum/SysMan : gum/SysMan.mp_o gum/LLComms.mp_o main/Mallocs.o hooks/OutOfVM.o
166         $(RM) $@
167         $(CC) -o $@ gum/SysMan.mp_o gum/LLComms.mp_o main/Mallocs.o hooks/OutOfVM.o -L$$PVM_ROOT/lib/$$PVM_ARCH -lpvm3 -lgpvm3 $(__socket_libs)
168
169 clean ::
170         $(RM) gum/SysMan.mp_o gum/SysMan
171
172 install :: gum/SysMan
173         $(INSTALL) -c $(INSTBINFLAGS) gum/SysMan $(INSTLIBDIR_GHC)/SysMan
174 endif
175
176 #-----------------------------------------------------------------------------
177 # creating and installing libHSrts.a (in its many flavors)
178
179 ifeq ($(suffix), norm)
180 ARCHIVE = libHSrts.a            # this one is special
181 else
182 ARCHIVE = libHSrts_$(suffix).a
183 endif 
184
185 LIBOBJS = $(RTS_LC:.lc=.$(suffix)_o)  $(RTS_LHC:.lhc=.$(suffix)_o)
186 DESTDIR = $(INSTLIBDIR_GHC)
187
188 MKDEPENDC_OPTS= -I$(GHC_INCLUDES)
189 C_DEP_SRCS = $(RTS_LC) $(RTS_LHC) $(CLIB_LC)
190
191 include $(TOP)/mk/lib.mk
192
193 #-----------------------------------------------------------------------------
194
195 c-as-asm/PerformIO_flags        = -optc-DIN_GHC_RTS=1
196 gum/FetchMe_flags               = -optc-DIN_GHC_RTS=1
197 main/StgStartup_flags           = -optc-DIN_GHC_RTS=1
198 main/StgThreads_flags           = -optc-DIN_GHC_RTS=1
199 main/StgUpdate_flags            = -optc-DIN_GHC_RTS=1
200 storage/SMmark_flags            = -optc-DIN_GHC_RTS=1 -optc-DMARK_REG_MAP
201
202 # ToDo:
203 # /* this is not the way we should do this [WDP [lazy] 94/09] */
204 # CTagsTarget( $(RTS_LC) $($RTS_LHC) $(CLIB_LC) )
205 # CTagsTarget( gmp/[a-z]*.c )