1 # -----------------------------------------------------------------------------
2 # $Id: package.mk,v 1.6 2002/02/17 13:46:39 panne Exp $
6 # -----------------------------------------------------------------------------
7 # Build the package configuration file and tell the compiler about it.
11 $(PACKAGE).conf.inplace : $(PACKAGE).conf.in
12 $(CPP) $(RAWCPP_FLAGS) -I$(GHC_INCLUDE_DIR) -x c $(PACKAGE_CPP_OPTS) $< \
13 | sed 's/^#.*$$//g' >$@
15 $(PACKAGE).conf.installed : $(PACKAGE).conf.in
16 $(CPP) $(RAWCPP_FLAGS) -I$(GHC_INCLUDE_DIR) -DINSTALLED -x c $(PACKAGE_CPP_OPTS) $< \
17 | sed 's/^#.*$$//g' >$@
19 boot all :: $(PACKAGE).conf.inplace $(PACKAGE).conf.installed
20 $(GHC_PKG_INPLACE) --update-package <$(PACKAGE).conf.inplace
21 $(GHC_PKG_INPLACE) -f $(GHC_DRIVER_DIR)/package.conf --update-package <$(PACKAGE).conf.installed
23 CLEAN_FILES += $(PACKAGE).conf.installed $(PACKAGE).conf.inplace
27 # -----------------------------------------------------------------------------
28 # Building the static library libHS<pkg>.a
32 SRC_HSC2HS_OPTS += -I.
34 ifeq "$(NON_HS_PACKAGE)" ""
35 SRC_HC_OPTS += -package-name $(PACKAGE)
36 SRC_HC_OPTS += $(GhcLibHcOpts)
37 SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS))
40 LIBRARY = libHS$(PACKAGE)$(_way).a
46 # POSSIBLE alternative version using --make:
49 # $(GHC_INPLACE) $(HC_OPTS) --make $(HS_SRCS)
53 # $(AR) $(AR_OPTS) $@ $(HS_OBJS)
57 # $(GHC_INPLACE) $(HC_OPTS) --make $<
59 # $(GHC_INPLACE) $(HC_OPTS) --make $<
61 # -----------------------------------------------------------------------------
62 # Installation; need to install .hi files as well as libraries
64 INSTALL_LIBS += $(LIBRARY)
66 ifeq "$(DLLized)" "YES"
67 INSTALL_PROGS += $(DLL_NAME)
68 INSTALL_LIBS += $(patsubst %.a,%_imp.a, $(LIBRARY))
71 # The interface files are put inside the $(libdir), since they
72 # might (potentially) be platform specific..
74 # override is used here because for binary distributions, datadir is
75 # set on the command line. sigh.
76 override datadir:=$(libdir)/imports/$(PACKAGE)
78 # If the lib consists of a hierachy of modules, we must retain the directory
79 # structure when we install the interfaces.
80 ifeq "$(HIERARCHICAL_LIB)" "YES"
81 INSTALL_DATAS_WITH_DIRS += $(HS_IFACES)
82 ifneq "$(ALL_DIRS)" ""
84 @for i in $(ALL_DIRS); do \
85 $(INSTALL_DIR) $(datadir)/$$i; \
89 INSTALL_DATAS += $(HS_IFACES)
92 # -----------------------------------------------------------------------------
95 MKDEPENDHS = $(GHC_INPLACE)
96 SRC_MKDEPENDC_OPTS += $(patsubst %,-I%,$(ALL_DIRS)) -I$(GHC_INCLUDE_DIR)
98 endif # $(PACKAGE) /= ""
100 #--------------------------------------------------------------
101 # Building dynamically-linkable libraries for GHCi
103 # Build $(GHCI_LIBRARY) whenever we build $(LIBRARY)
105 # Why? GHCi can only link .o files (at the moment), not .a files
106 # so we have to build libFoo.o as well as libFoo.a
108 # Furthermore, GHCi currently never loads
109 # profiling libraries (or other non-std ways)
111 ifneq "$(LIBRARY)" ""
114 ifeq "$(GhcWithInterpreter)" "YES"
116 GHCI_LIBRARY = $(patsubst lib%.a,%.o,$(LIBRARY))
118 INSTALL_LIBS += $(GHCI_LIBRARY)
119 CLEAN_FILES += $(GHCI_LIBRARY)
121 all :: $(GHCI_LIBRARY)
123 ifneq "$(DONT_WANT_STD_GHCI_LIB_RULE)" "YES"
124 # If you don't want to build GHCI_LIBRARY the 'standard' way,
125 # set DONT_WANT_STD_GHCI_LIB_RULE to YES. The Prelude and
126 # hslibs/Win32 uses this 'feature', which will go away soon
127 # when we can use a "fixed" ld.
129 $(GHCI_LIBRARY) : $(LIBOBJS)
130 $(LD) -r $(LD_X) -o $@ $(LIBOBJS)
132 endif # DONT_WANT_STD_GHCI_LIB_RULE
133 endif # GhcWithInterpreter
136 endif # $(LIBRARY) /= ""