[project @ 1996-11-21 16:45:53 by simonm]
[ghc-hetmet.git] / ghc / runtime / Makefile
1 #-----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.2 1996/11/21 16:48:17 simonm Exp $
3
4 #  This is the Makefile for the runtime-system stuff.
5 #  This stuff is written in C (and cannot be written in Haskell).
6 #
7 #  Things are organised into exactly one level of subdirs.
8 #
9 #  At the moment, there are a few such subdirs:
10 #       c-as-asm        -- mini-interpreter & register hackery
11 #       gum             -- GUM-specific stuff
12 #       main            -- "main", associated startup stuff, & MISC things
13 #       prims           -- code for primitives that must be written in C
14 #       profiling       -- cost-centre profiling
15 #       storage         -- the storage manager(s)
16 #
17 #  We create two libraries.  One, libHSrts<tag>.a, is built separately
18 #  for each "build".  The other, libHSclib.a is built once: it is just
19 #  .lc files that end up the same no matter what, i.e. completely
20 #  ordinary C.
21
22 #  Other sorta independent, compile-once subdirs are:
23
24 #       gmp             -- GNU multi-precision library (for Integer)
25
26 #-----------------------------------------------------------------------------
27
28 TOP=../..
29 SuffixRules_WantStdOnes = NO
30 UnlitSuffixRules = YES_PLEASE
31 include $(TOP)/ghc/mk/ghc.mk
32
33 SUBDIRS = gmp
34 include $(TOP)/mk/subdir.mk
35
36 # If you use EXTRA_HC_OPTS on the command line (which you shouldn't,
37 # strictly speaking), it will probably work -- it is pinned onto
38 # GHC_OPTS, just for fun.
39
40 GHC_OPTS = $(EXTRA_HC_OPTS)
41
42 # per-build options: shared with libraries
43 DoingRTS = YES
44 include ../mk/buildflags.mk
45
46 #-----------------------------------------------------------------------------
47 # knock the "clib" (completely ordinary C, compiled once)
48 # stuff over the head first...
49
50 CLIB_LC =                               \
51         hooks/ErrorHdr.lc               \
52         hooks/FreeForeignObj.lc         \
53         hooks/OutOfHeap.lc              \
54         hooks/OutOfStk.lc               \
55         hooks/OutOfVM.lc                \
56         hooks/NoRunnableThrds.lc        \
57         hooks/PatErrorHdr.lc            \
58         hooks/TraceHooks.lc             \
59         hooks/SizeHooks.lc              \
60         hooks/InitEachPE.lc             \
61         main/Mallocs.lc
62
63 ARCHIVE = libHSclib.a
64 LIBOBJS = $(CLIB_LC:.lc=.o)
65 DESTDIR = $(INSTLIBDIR_GHC)
66
67 include $(TOP)/mk/lib.mk
68
69 #-----------------------------------------------------------------------------
70 # Rules for building various types of objects from C files
71
72 RTS_GHC = $(GHC) -c -o $@ $(GHCFLAGS) $($*_flags) 
73
74 %.o : %.c
75         @$(RM) $@
76         $(RTS_GHC) $*.c
77
78 #-----------------------------------------------------------------------------
79 # the TopClosure
80
81 all :: main/TopClosure.o
82
83 clean ::
84         $(RM) main/TopClosure.o
85
86 install :: main/TopClosure.o
87         $(INSTALL) $(INSTLIBFLAGS) main/TopClosure.o $(INSTLIBDIR_GHC)/TopClosure.o
88
89 #-----------------------------------------------------------------------------
90 # libHSrts.a, in several different 'ways'
91
92 all ::
93         @for i in $(WAY_SUFFIXES); do \
94                 echo; \
95                 echo =========== Making runtime system for way $$i; \
96                 echo; \
97                 $(MAKE) -f Makefile.libHSrts suffix=$$i; \
98         done
99
100 install ::
101         @for i in $(WAY_SUFFIXES); do \
102                 $(MAKE) -f Makefile.libHSrts suffix=$$i install; \
103         done
104
105 clean ::
106         @$(MAKE) -f Makefile.libHSrts clean
107         @for i in $(WAY_SUFFIXES); do \
108                 $(MAKE) -f Makefile.libHSrts suffix=$$i cleanobj; \
109         done
110
111 # Dependencies are done by Makefile.libHSrts
112
113 depend ::
114         @$(MAKE) -f Makefile.libHSrts depend