[project @ 2001-07-03 11:37:49 by simonmar]
[ghc-base.git] / Makefile
1 # -----------------------------------------------------------------------------
2 # $Id: Makefile,v 1.2 2001/07/03 11:37:49 simonmar Exp $
3
4 TOP=../..
5 include $(TOP)/mk/boilerplate.mk
6
7 ifeq "$(way)" ""
8 SUBDIRS = cbits
9 else
10 SUBDIRS=
11 endif
12
13 ALL_DIRS = \
14         Control \
15         Control/Concurrent \
16         Control/Monad \
17         Control/Monad/ST \
18         Data \
19         Data/Array \
20         Database \
21         Debug \
22         FileFormat \
23         Foreign \
24         Foreign/C \
25         Foreign/Marshal \
26         GHC \
27         Hugs \
28         Language \
29         Network \
30         NHC \
31         System \
32         System/IO \
33         Text \
34         Text/Show
35
36 PRE_SRCS += $(wildcard $(patsubst %, %/*.hsc, $(ALL_DIRS)))
37 SRC_HSC2HS_OPTS += -Iinclude -I.
38
39 ALL_HS_SRCS = $(wildcard $(patsubst %, %/*.hs, . $(ALL_DIRS)))
40 ALL_LHS_SRCS += $(wildcard GHC/*.lhs)
41 ALL_HS_OBJS = $(patsubst %.hs, %.o, $(ALL_HS_SRCS)) \
42         $(patsubst %.lhs, %.o, $(ALL_LHS_SRCS))
43 ALL_HS_HIS = $(patsubst %.o, %.hi, $(ALL_HS_OBJS))
44
45 srcs : $(HS_SRCS) GHC/Prim.$(way_)hi
46
47 # dependencies between .hsc files
48 GHC/IO.hs : GHC/Handle.hs
49
50 GHC/Prim.$(way_)hi : GHC/Prim.hi-boot
51         cp $< $@
52
53 SRC_HC_OPTS += -cpp -fglasgow-exts -fvia-C -I$(FPTOOLS_TOP)/ghc/includes -Iinclude -package-name core -H128m $(GhcLibHcOpts)
54
55 LIBNAME = libHScore$(_way).a
56
57 CLEAN_FILES += $(ALL_HS_OBJS) $(ALL_HS_HIS)
58
59 all :: $(LIBNAME)
60
61 $(ALL_HS_OBJS) : srcs
62         $(GHC_INPLACE) $(HC_OPTS) --make $(ALL_HS_SRCS) $(ALL_LHS_SRCS)
63
64 $(LIBNAME) : $(ALL_HS_OBJS)
65         $(RM) $@
66         $(AR) $(AR_OPTS) $@ $(ALL_HS_OBJS)
67         $(RANLIB) $@
68
69 %.o : %.hs
70         $(GHC_INPLACE) $(HC_OPTS) --make $<
71 %.o : %.lhs
72         $(GHC_INPLACE) $(HC_OPTS) --make $<
73
74 include $(TOP)/mk/target.mk