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
This commit is contained in:
roktas 2006-11-16 02:37:25 +00:00
parent d5d81b0b53
commit 83077346a1

View file

@ -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