X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fghctags%2FMakefile;h=d3a59ffcf062b23396056f1a8309fd7e8a6f1a61;hb=0843c0bdc66008008d38eff07c90437ed56d9ca1;hp=586c3b080e0f2610ee4e5255c3c3a49841bbdc6d;hpb=3a1da42b064024d25eefc1a70366ecda986c37eb;p=ghc-hetmet.git 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