summaryrefslogtreecommitdiff
path: root/ghc/runtime/Makefile.libHSrts
blob: 10c8bf5dfef5ea9de219913248d7726abbc370db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#-----------------------------------------------------------------------------
# $Id: Makefile.libHSrts,v 1.2 1996/11/21 16:48:19 simonm Exp $

# The is the makefile for libHSrts, invoked once for each different build.

# The variable $(suffix) defines the current build.

# To make libHSrts for a specific build, you can do 
#	make -f Makefile.libHSrts suffix=<build>

#-----------------------------------------------------------------------------

TOP=../..
SuffixRules_WantStdOnes = NO
UnlitSuffixRules = YES_PLEASE
include $(TOP)/ghc/mk/ghc.mk

# 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.

GHC_OPTS = $(EXTRA_HC_OPTS)

# per-build options: shared with libraries
DoingRTS = YES
include ../mk/buildflags.mk

#-----------------------------------------------------------------------------
# what it is we are compiling;
# these are long and tedious lists, but c'est la guerre

RTS_LH =				\
	storage/SMmarkDefs.lh 		\
	storage/SMcopying.lh		\
	storage/SMcompacting.lh		\
	storage/SMextn.lh		\
	storage/SMinternal.lh

RTS_LC = 				\
	c-as-asm/CallWrap_C.lc		\
	c-as-asm/HpOverflow.lc		\
	c-as-asm/StablePtr.lc		\
	c-as-asm/StablePtrOps.lc	\
	c-as-asm/StgDebug.lc		\
	c-as-asm/StgMiniInt.lc		\
	gum/GlobAddr.lc			\
	gum/HLComms.lc			\
	gum/Hash.lc			\
	gum/LLComms.lc			\
	gum/Pack.lc			\
	gum/ParInit.lc			\
	gum/RBH.lc			\
	gum/Sparks.lc			\
	gum/Unpack.lc			\
	main/GranSim.lc			\
	main/Itimer.lc			\
	main/Ticky.lc			\
	main/SMRep.lc			\
	main/Select.lc			\
	main/Signals.lc			\
	main/StgOverflow.lc		\
	main/Threads.lc			\
	main/RtsFlags.lc		\
	main/main.lc			\
	prims/PrimArith.lc		\
	prims/PrimMisc.lc		\
	profiling/CostCentre.lc		\
	profiling/Hashing.lc		\
	profiling/HeapProfile.lc	\
	profiling/Indexing.lc		\
	profiling/Timer.lc		\
	storage/SM1s.lc			\
	storage/SM2s.lc			\
	storage/SMap.lc			\
	storage/SMcheck.lc		\
	storage/SMcompacting.lc 	\
	storage/SMcopying.lc 		\
	storage/SMdu.lc			\
	storage/SMevac.lc 		\
	storage/SMextn.lc		\
	storage/SMinit.lc 		\
	storage/SMmarking.lc 		\
	storage/SMscan.lc		\
	storage/SMscav.lc		\
	storage/SMstacks.lc		\
	storage/SMstatic.lc		\
	storage/SMstats.lc 		\
	storage/mprotect.lc

# LATER?: storage/SMgen.lc

RTS_LHC = 				\
	main/StgStartup.lhc		\
	main/StgUpdate.lhc		\
	main/StgThreads.lhc		\
	c-as-asm/PerformIO.lhc		\
	storage/SMmark.lhc		\
	gum/FetchMe.lhc

CLIB_LC = 				\
	hooks/ErrorHdr.lc		\
	hooks/FreeForeignObj.lc		\
	hooks/OutOfHeap.lc		\
	hooks/OutOfStk.lc		\
	hooks/OutOfVM.lc		\
	hooks/NoRunnableThrds.lc	\
	hooks/PatErrorHdr.lc		\
	hooks/TraceHooks.lc		\
	hooks/SizeHooks.lc		\
	hooks/InitEachPE.lc		\
	main/Mallocs.lc

CLIB_LC = 				\
	hooks/ErrorHdr.lc		\
	hooks/FreeForeignObj.lc		\
	hooks/OutOfHeap.lc		\
	hooks/OutOfStk.lc		\
	hooks/OutOfVM.lc		\
	hooks/NoRunnableThrds.lc	\
	hooks/PatErrorHdr.lc		\
	hooks/TraceHooks.lc		\
	hooks/SizeHooks.lc		\
	hooks/InitEachPE.lc		\
	main/Mallocs.lc

H_FILES = $(RTS_LH:.lh=.h)
C_FILES = $(RTS_LC:.lc=.c) $(RTS_LHC:.lhc=.hc) $(CLIB_LC:.lc=.c)

# Header files

all depend :: $(H_FILES)

clean ::
	$(RM) $(H_FILES)
	$(RM) $(C_FILES)

#-----------------------------------------------------------------------------
# Rules for building various types of objects from C files

RTS_GHC = $(GHC) -c -o $@ $(GHCFLAGS) $($*_flags) 

%.o : %.c
	@$(RM) $@
	$(RTS_GHC) $*.c

%.$(suffix)_o : %.c
	@$(RM) $@
	$(RTS_GHC) $(GHC_OPTS_$(suffix)) $*.c

%.$(suffix)_o : %.hc
	@$(RM) $@
	$(RTS_GHC) $(GHC_OPTS_$(suffix)) $*.hc

#-----------------------------------------------------------------------------

ifeq ($(suffix), mp)
ifdef solaris2_TARGET_OS
__socket_libs = -lsocket -lnsl
else
__socket_libs =
endif

all :: gum/SysMan

gum/SysMan : gum/SysMan.mp_o gum/LLComms.mp_o main/Mallocs.o hooks/OutOfVM.o
	$(RM) $@
	$(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)

clean ::
	$(RM) gum/SysMan.mp_o gum/SysMan

install :: gum/SysMan
	$(INSTALL) -c $(INSTBINFLAGS) gum/SysMan $(INSTLIBDIR_GHC)/SysMan
endif

#-----------------------------------------------------------------------------
# creating and installing libHSrts.a (in its many flavors)

ifeq ($(suffix), norm)
RTS_LIB = libHSrts.a 		# this one is special
else
RTS_LIB = libHSrts_$(suffix).a
endif 

RTS_OBJS = $(RTS_LC:.lc=.$(suffix)_o)  $(RTS_LHC:.lhc=.$(suffix)_o)

all :: $(RTS_LIB) 

install :: $(RTS_LIB)
	$(INSTALL) $(INSTLIBFLAGS) $(RTS_LIB) $(INSTLIBDIR_GHC)/$(RTS_LIB)
	$(RANLIB) $(INSTLIBDIR_GHC)/$(RTS_LIB)

cleanobj ::
	$(RM) $(RTS_OBJS)
	$(RM) $(RTS_LIB)

$(RTS_LIB) :: $(H_FILES) $(RTS_OBJS)
	$(RM) $@
	$(AR) $@ $(RTS_OBJS)
	$(RANLIB) $@

c-as-asm/PerformIO_flags 	= -optc-DIN_GHC_RTS=1
gum/FetchMe_flags	 	= -optc-DIN_GHC_RTS=1
main/StgStartup_flags 		= -optc-DIN_GHC_RTS=1
main/StgThreads_flags 		= -optc-DIN_GHC_RTS=1
main/StgUpdate_flags		= -optc-DIN_GHC_RTS=1
storage/SMmark_flags		= -optc-DIN_GHC_RTS=1 -optc-DMARK_REG_MAP

# ToDo:
# /* this is not the way we should do this [WDP [lazy] 94/09] */
# CTagsTarget( $(RTS_LC) $($RTS_LHC) $(CLIB_LC) )
# CTagsTarget( gmp/[a-z]*.c )

#-----------------------------------------------------------------------------
# Do dependencies

MKDEPENDC_OPTS= -I$(GHC_INCLUDES)

C_DEP_SRCS = $(RTS_LC) $(RTS_LHC) $(CLIB_LC)
include $(TOP)/mk/cdepend.mk