X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=mk%2Fpackage.mk;h=516af242f956ef1be1a72c57753081581dcd5f7c;hb=6f0b6600d2a3834d0088e6e4aa37b470b7d1243d;hp=da8712fc4ad0d5c8c2fa26fd62fe1572e1b3e07d;hpb=2cc5b907318f97e19b28b2ad8ed9ff8c1f401dcc;p=ghc-hetmet.git diff --git a/mk/package.mk b/mk/package.mk index da8712f..516af24 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# $Id: package.mk,v 1.1 2002/02/12 15:17:35 simonmar Exp $ +# $Id: package.mk,v 1.12 2002/06/24 14:38:06 simonmar Exp $ ifneq "$(PACKAGE)" "" @@ -13,14 +13,12 @@ $(PACKAGE).conf.inplace : $(PACKAGE).conf.in | sed 's/^#.*$$//g' >$@ $(PACKAGE).conf.installed : $(PACKAGE).conf.in - $(CPP) $(RAWCPP_FLAGS) -I$(GHC_INCLUDE_DIR) -DINSTALLED -x c $(PACKAGE_CPP_OPTS) $< \ + $(CPP) $(RAWCPP_FLAGS) -I$(GHC_INCLUDE_DIR) -DINSTALLING -x c $(PACKAGE_CPP_OPTS) $< \ | sed 's/^#.*$$//g' >$@ boot all :: $(PACKAGE).conf.inplace $(PACKAGE).conf.installed - -$(GHC_PKG_INPLACE) --remove-package $(PACKAGE) - $(GHC_PKG_INPLACE) --add-package <$(PACKAGE).conf.inplace - -$(GHC_PKG_INPLACE) -f $(GHC_DRIVER_DIR)/package.conf --remove-package $(PACKAGE) - $(GHC_PKG_INPLACE) -f $(GHC_DRIVER_DIR)/package.conf --add-package <$(PACKAGE).conf.installed + $(GHC_PKG_INPLACE) --update-package <$(PACKAGE).conf.inplace + $(GHC_PKG_INPLACE) -f $(GHC_DRIVER_DIR)/package.conf --update-package <$(PACKAGE).conf.installed CLEAN_FILES += $(PACKAGE).conf.installed $(PACKAGE).conf.inplace @@ -60,27 +58,61 @@ all :: $(LIBRARY) # %.o : %.lhs # $(GHC_INPLACE) $(HC_OPTS) --make $< +# ----------------------------------------------------------------------------- +# Installation; need to install .hi files as well as libraries + +ifeq "$(DLLized)" "YES" +INSTALL_PROGS += $(DLL_NAME) +INSTALL_LIBS += $(patsubst %.a,%_imp.a, $(LIBRARY)) +endif + +# The interface files are put inside the $(libdir), since they +# might (potentially) be platform specific.. + +ifacedir = $(libdir)/imports/$(PACKAGE) + +# If the lib consists of a hierachy of modules, we must retain the directory +# structure when we install the interfaces. +ifeq "$(HIERARCHICAL_LIB)" "YES" +INSTALL_IFACES_WITH_DIRS += $(HS_IFACES) +ifneq "$(ALL_DIRS)" "" +install :: + @for i in $(ALL_DIRS); do \ + $(INSTALL_DIR) $(ifacedir)/$$i; \ + done +endif +else +INSTALL_IFACES += $(HS_IFACES) +endif + +# ----------------------------------------------------------------------------- +# Dependencies + +MKDEPENDHS = $(GHC_INPLACE) +SRC_MKDEPENDC_OPTS += $(addprefix -I,$(ALL_DIRS)) -I$(GHC_INCLUDE_DIR) + +endif # $(PACKAGE) /= "" + +# install library (could be implicitly specified or explicitly, like libHS*_cbits.a) +INSTALL_LIBS += $(LIBRARY) + #-------------------------------------------------------------- # Building dynamically-linkable libraries for GHCi # -# Build $(GHCI_LIBRARY) from $(OBJS) +# Build $(GHCI_LIBRARY) whenever we build $(LIBRARY) # # Why? GHCi can only link .o files (at the moment), not .a files # so we have to build libFoo.o as well as libFoo.a # # Furthermore, GHCi currently never loads # profiling libraries (or other non-std ways) -# -# Inputs: -# $(GHCI_LIBRARY) -# -# Outputs: -# Rule to build $(GHCI_LIBRARY) + +ifneq "$(LIBRARY)" "" ifeq "$(way)" "" ifeq "$(GhcWithInterpreter)" "YES" -GHCI_LIBRARY = HS$(PACKAGE)$(_cbits)$(_way).o +GHCI_LIBRARY = $(patsubst lib%.a,%.o,$(LIBRARY)) INSTALL_LIBS += $(GHCI_LIBRARY) CLEAN_FILES += $(GHCI_LIBRARY) @@ -93,30 +125,45 @@ ifneq "$(DONT_WANT_STD_GHCI_LIB_RULE)" "YES" # hslibs/Win32 uses this 'feature', which will go away soon # when we can use a "fixed" ld. # -$(GHCI_LIBRARY) : $(OBJS) - $(LD) -r $(LD_X) -o $@ $(OBJS) +$(GHCI_LIBRARY) : $(LIBOBJS) + $(LD) -r $(LD_X) -o $@ $(STUBOBJS) $(LIBOBJS) endif # DONT_WANT_STD_GHCI_LIB_RULE endif # GhcWithInterpreter endif # way # ----------------------------------------------------------------------------- -# Installation; need to install .hi files as well as libraries -# -# The interface files are put inside the $(libdir), since they -# might (potentially) be platform specific.. -# -# override is used here because for binary distributions, datadir is -# set on the command line. sigh. -# +# Doc building with Haddock -override datadir:=$(libdir)/imports/$(PACKAGE) +HS_PPS = $(addsuffix .raw-hs, $(basename $(filter-out $(EXCLUDED_HADDOCK_SRCS), $(HS_SRCS)))) -# ----------------------------------------------------------------------------- -# Dependencies +HTML_DIR = html +HTML_DOC = $(HTML_DIR)/index.html -MKDEPENDHS = $(GHC_INPLACE) -SRC_MKDEPENDC_OPTS += $(patsubst %,-I%,$(ALL_DIRS)) -I$(GHC_INCLUDE_DIR) +ifneq "$(HS_PPS)" "" +html :: $(HTML_DOC) -endif # $(PACKAGE) /= "" +$(HTML_DOC) : $(HS_PPS) $(HADDOCK_INPLACE) + @$(INSTALL_DIR) $(HTML_DIR) + $(HADDOCK_INPLACE) $(HADDOCK_OPTS) -h -o $(HTML_DIR) $(HS_PPS) \ + --dump-interface=$(PACKAGE).haddock \ + $(foreach pkg, $(PACKAGE_DEPS), \ + --read-interface=../$(pkg),../$(pkg)/$(pkg).haddock) + +%.raw-hs : %.lhs + $(GHC) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@ + +%.raw-hs : %.hs + $(GHC) $(HC_OPTS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@ + +install-docs :: $(HTML_DOC) + @$(INSTALL_DIR) $(datadir)/html/$(PACKAGE) + @for i in $(HTML_DIR)/*; do \ + $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/html/$(PACKAGE); \ + done + +endif # HS_PPS + +# ----------------------------------------------------------------------------- +endif # $(LIBRARY) /= ""