From: Simon Marlow Date: Mon, 5 Nov 2007 16:39:54 +0000 (+0000) Subject: build ghctags-inplace X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=a2dd573dca7d1cf150e900a7ea6e03d734bee96b build ghctags-inplace --- diff --git a/mk/config.mk.in b/mk/config.mk.in index c569159..68f460e 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -785,7 +785,7 @@ GHC_SPLIT_DIR_ABS = $(FPTOOLS_TOP_ABS)/$(GHC_SPLIT_DIR_REL) GHC_UNLIT_PGM = unlit$(exeext) GHC_HP2PS_PGM = hp2ps GHC_HSTAGS_PGM = hasktags -GHC_GHCTAGS_PGM = ghctags +GHC_GHCTAGS_INPLACE_PGM = ghctags-inplace GHC_HSC2HS_INPLACE_PGM = hsc2hs-inplace GHC_TOUCHY_PGM = touchy$(exeext) GHC_MANGLER_PGM = ghc-asm @@ -811,7 +811,7 @@ endif UNLIT = $(GHC_UNLIT_DIR)/$(GHC_UNLIT_PGM) HP2PS = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM) HSTAGS = $(GHC_HSTAGS_DIR)/$(GHC_HSTAGS_PGM) -GHCTAGS = $(GHC_GHCTAGS_DIR)/$(GHC_GHCTAGS_PGM) +GHCTAGS_INPLACE = $(GHC_GHCTAGS_DIR)/$(GHC_GHCTAGS_INPLACE_PGM) HSC2HS_INPLACE = $(GHC_HSC2HS_DIR)/$(GHC_HSC2HS_INPLACE_PGM) MANGLER = $(GHC_MANGLER_DIR)/$(GHC_MANGLER_PGM) SPLIT = $(GHC_SPLIT_DIR)/$(GHC_SPLIT_PGM) diff --git a/utils/ghctags/Makefile b/utils/ghctags/Makefile index 586c3b0..d3a59ff 100644 --- a/utils/ghctags/Makefile +++ b/utils/ghctags/Makefile @@ -1,13 +1,60 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk -HS_PROG = ghctags SRC_HC_OPTS += -package ghc + HC=$(GHC_STAGE1) -CLEAN_FILES += Main.hi +# On Windows, ghc-pkg is a standalone program +# ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script +# to pass the appropriate flag to the real binary +# ($libexecdir/ghc-pkg.bin) so that it can find package.conf. +ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" +HS_PROG = ghctags.exe +INSTALL_PROGS += $(HS_PROG) +else +HS_PROG = ghctags.bin +INSTALL_LIBEXECS += $(HS_PROG) +endif + +# ----------------------------------------------------------------------------- +# ghctags and ghctags-inplace scripts + +# See commentary in ../ghc-pkg/Makefile + +INPLACE_HS=ghctags-inplace.hs +INPLACE_PROG=ghctags-inplace +EXCLUDED_SRCS+=$(INPLACE_HS) + +$(INPLACE_HS): Makefile $(FPTOOLS_TOP)/mk/config.mk + echo "import System.Cmd; import System.Environment; import System.Exit" > $@ + echo "main = do args <- getArgs; rawSystem \"$(FPTOOLS_TOP_ABS)/$(GHC_GHCTAGS_DIR_REL)/$(HS_PROG)\" (\"--topdir\":\"$(FPTOOLS_TOP_ABS)\":args) >>= exitWith" >> $@ + +$(INPLACE_PROG): $(INPLACE_HS) + $(HC) --make $< -o $@ + +all :: $(INPLACE_PROG) + +CLEAN_FILES += $(INPLACE_HS) $(INPLACE_PROG) + +ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32" +LINK = ghctags +LINK_TARGET = $(LINK)-$(ProjectVersion) +INSTALLED_SCRIPT=$(DESTDIR)$(bindir)/$(LINK_TARGET) +install:: + $(INSTALL_DIR) $(DESTDIR)$(bindir) + $(RM) -f $(INSTALLED_SCRIPT) + echo "#!$(SHELL)" >> $(INSTALLED_SCRIPT) + echo "GHCTAGSBIN=$(libexecdir)/$(HS_PROG)" >> $(INSTALLED_SCRIPT) + echo "TOPDIR=$(libdir)" >> $(INSTALLED_SCRIPT) + echo 'exec $$GHCTAGSBIN --topdir $$TOPDIR $${1+"$$@"}' >> $(INSTALLED_SCRIPT) + $(EXECUTABLE_FILE) $(INSTALLED_SCRIPT) +endif -INSTALL_PROGS += $(HS_PROG) +binary-dist: + $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/ghctags + $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/utils/ghctags/ + $(INSTALL_PROGRAM) $(HS_PROG) $(BIN_DIST_DIR)/utils/ghctags/ include $(TOP)/mk/target.mk