From 83077346a1464686e6439d81fee391a60a7225b8 Mon Sep 17 00:00:00 2001 From: roktas Date: Thu, 16 Nov 2006 02:37:25 +0000 Subject: [PATCH] Using hardcoded executable paths in Makefile doesn't work. While GHC 6.6 Cabal builds executables in dist/build/$executable, older Cabal versions use dist/build/src. To cope with this situation: + Revert to old code which determines executable paths dynamically. + Create symlinks to the compiled executables in top directory. Make sure to not touch symlinks once they've been created. + As PROGS variable can now contain symlinks, determine the actual file during installation. + Replace EXECNAMES with EXECS, as the former became a redundant name due to these changes. git-svn-id: https://pandoc.googlecode.com/svn/trunk@104 788f1e2b-df1e-0410-8736-df70ead52e1b --- Makefile | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 673afc711..7d92f18ba 100644 --- a/Makefile +++ b/Makefile @@ -17,14 +17,13 @@ CONFIGURE := configure #------------------------------------------------------------------------------- NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL).in) VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL).in) -EXECNAMES := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in) +EXECS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in) +# First entry in Cabal's executable stanza is the main executable. +MAIN := $(firstword $(EXECS)) #------------------------------------------------------------------------------- # Install targets #------------------------------------------------------------------------------- -EXECS :=$(join $(patsubst %,$(BUILDDIR)/build/%/,$(EXECNAMES)),$(EXECNAMES)) -# First entry in Cabal's executable stanza is the main executable. -MAIN := $(firstword $(EXECS)) PROGS := $(EXECS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf DOCS := README.html README BUGS TODO @@ -108,6 +107,12 @@ build: templates configure build-exec: $(EXECS) cleanup_files+=$(EXECS) $(EXECS): build + for f in $@; do \ + [ -f $$f ] || { \ + find $(BUILDDIR) -type f -name "$$f" \ + -perm +a=x -exec ln -s {} . \; ; \ + } \ + done .PHONY: build-doc cleanup_files+=README.html @@ -153,7 +158,12 @@ uninstall-lib-doc: .PHONY: install-exec uninstall-exec install-exec: build-exec $(INSTALL) -d $(BINPATH); \ - for f in $(PROGS); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done + for f in $(PROGS); do \ + if [ -L $$f ]; then \ + f=$$(readlink $$f); \ + fi; \ + $(INSTALL_PROGRAM) $$f $(BINPATH)/; \ + done uninstall-exec: -for f in $(notdir $(PROGS)); do rm -f $(BINPATH)/$$f; done