summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-10-29 12:54:08 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-10-29 12:54:08 +0000
commit40a8480efdf2a073c3741b11970a2a3f71dce83a (patch)
tree4f380f46a8846b5d39d26af3ccc8155b1651217c /Makefile
parent09473903dc473d29526c023cf5018c21b5ac7805 (diff)
Remove 'install-lib', it causes too much trouble which needs to be dealed
in ugly ways. + Now, we have 'install-program' and 'install-all' targets. The former installs only program and user documents, while the latter installs everything: program, user documents, library files and library documents. + Behaviour of 'install' target hasn't changed, it calls 'install-program'. + Update README accordingly. + Implement missing uninstall-* targets (including 'uninstall-all' and 'uninstall-program' for the new targets). + Call 'install-program' in debian/rules explicitly to prevent confusions. git-svn-id: https://pandoc.googlecode.com/svn/trunk@33 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile75
1 files changed, 53 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 7079f997f..60afaea8b 100644
--- a/Makefile
+++ b/Makefile
@@ -29,8 +29,10 @@ CONFIGURE := configure
#-------------------------------------------------------------------------------
# Installation paths
#-------------------------------------------------------------------------------
-BINPATH := $(DESTDIR)$(PREFIX)/bin
-DATAPATH := $(DESTDIR)$(PREFIX)/share
+DESTPATH := $(DESTDIR)$(PREFIX)
+BINPATH := $(DESTPATH)/bin
+DATAPATH := $(DESTPATH)/share
+LIBPATH := $(DESTPATH)/$(NAME)-$(VERSION)
DOCPATH := $(DATAPATH)/doc/$(THIS)
LIBDOCPATH := $(DATAPATH)/doc/$(THIS)-doc
MANPATH := $(DATAPATH)/man
@@ -43,6 +45,7 @@ INSTALL := install -c
INSTALL_PROGRAM := $(INSTALL) -m 755
INSTALL_DATA := $(INSTALL) -m 644
GHC := ghc
+GHC_PKG := ghc-pkg
#-------------------------------------------------------------------------------
# Recipes
@@ -80,26 +83,21 @@ html/: configure
cleanup_files+=$(BINS)
$(BINS): build
- # Ugly kludge to seperate program and library installations.
- # Leave the library installation to Cabal ('install-lib' target).
- find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec mv {} . \;
+ find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec cp {} . \;
+
+.PHONY: build-all
+build-all: build $(BINS) build-lib-doc
# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
# i.e. any PREFIX given at the configuration time is lost, unless it is
# also supplied (via environment) at these stages.
-.PHONY: install-exec uninstall-exec
-bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
-install-exec: $(bin_all)
- $(INSTALL) -d $(BINPATH); \
- for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
-uninstall-exec:
- -for f in $(bin_all); do rm -f $(BINPATH)/$$f; done
+# User documents installation.
.PHONY: install-doc uninstall-doc
doc_all:=README.html README BUGS TODO
man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))
cleanup_files+=README.html
-install-doc: $(doc_all)
+install-doc: $(BINS) $(doc_all)
$(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
for f in $(man_all); do \
$(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
@@ -110,17 +108,50 @@ uninstall-doc:
-for f in $(man_all); do rm -f $(MANPATH)/$$f; done
-rmdir $(DOCPATH)
-# Handle program installation manually (due to the deficiencies in Cabal).
-.PHONY: install uninstall
-install: install-exec install-doc
-# FIXME: incomplete support for uninstallation.
-uninstall: uninstall-exec uninstall-doc
-
-.PHONY: install-lib install-lib-doc
-install-lib:
- @$(BUILDCMD) install || true # required since we move executable
+# Library documents installation.
+.PHONY: install-lib-doc uninstall-lib-doc
install-lib-doc: build-lib-doc
$(INSTALL) -d $(LIBDOCPATH) && cp -a html $(LIBDOCPATH)/
+uninstall-lib-doc:
+ -rm -rf $(LIBDOCPATH)/html
+ -rmdir $(LIBDOCPATH)
+
+# Program only installation.
+.PHONY: install-exec uninstall-exec
+bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
+install-exec: $(bin_all)
+ $(INSTALL) -d $(BINPATH); \
+ for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
+uninstall-exec:
+ -for f in $(bin_all); do rm -f $(BINPATH)/$$f; done
+
+# Program + user documents installation.
+.PHONY: install-program uninstall-program
+install-program: install-exec install-doc
+uninstall-program: uninstall-exec uninstall-doc
+
+# Install everything.
+.PHONY: install-all uninstall-all
+install-all: install-doc install-lib-doc
+ destdir=$(DESTDIR); destdir=$${destdir:-/}; \
+ $(BUILDCMD) copy --destdir=$$destdir; \
+ $(BUILDCMD) register
+uninstall-all: uninstall-doc uninstall-lib-doc
+ -pkg_id="$(NAME)-$(VERSION)"; \
+ libdir=$$($(GHC_PKG) field $$pkg_id library-dirs 2>/dev/null | \
+ sed 's/^library-dirs: *//'); \
+ if [ -d "$$libdir" ]; then \
+ $(BUILDCMD) unregister; \
+ rm -rf $$libdir; \
+ rmdir $$(dirname $$libdir); \
+ else \
+ echo "*** Couldn't locate library files for pkgid: $$pkg_id. ***"; \
+ fi
+
+# Default installation recipe for a common deployment scenario.
+.PHONY: install uninstall
+install: install-program
+uninstall: uninstall-program
.PHONY: test test-markdown
test: $(BINS)