git.iko.soy/typeable/pandoc
on master help sign in
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

commit40a8480efdf2a073c3741b11970a2a3f71dce83a authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 29 Oct 2006, 12:54 (20 years ago) parent0947390
3 files changed+58−32
Makefile+53−22 README+4−9 debian/rules+1−1
Makefile+53−22
@@ -29,8 +29,10 @@ CONFIGURE := configure
2929#-------------------------------------------------------------------------------
3030# Installation paths
3131#-------------------------------------------------------------------------------
32−BINPATH := $(DESTDIR)$(PREFIX)/bin
33−DATAPATH := $(DESTDIR)$(PREFIX)/share
32+DESTPATH := $(DESTDIR)$(PREFIX)
33+BINPATH := $(DESTPATH)/bin
34+DATAPATH := $(DESTPATH)/share
35+LIBPATH := $(DESTPATH)/$(NAME)-$(VERSION)
3436DOCPATH := $(DATAPATH)/doc/$(THIS)
3537LIBDOCPATH := $(DATAPATH)/doc/$(THIS)-doc
3638MANPATH := $(DATAPATH)/man
@@ -43,6 +45,7 @@ INSTALL := install -c
4345INSTALL_PROGRAM := $(INSTALL) -m 755
4446INSTALL_DATA := $(INSTALL) -m 644
4547GHC := ghc
48+GHC_PKG := ghc-pkg
4649
4750#-------------------------------------------------------------------------------
4851# Recipes
@@ -80,26 +83,21 @@ html/: configure
8083
8184cleanup_files+=$(BINS)
8285$(BINS): build
83− # Ugly kludge to seperate program and library installations.
84− # Leave the library installation to Cabal ('install-lib' target).
85− find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec mv {} . \;
86+ find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec cp {} . \;
87+
88+.PHONY: build-all
89+build-all: build $(BINS) build-lib-doc
8690
8791# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
8892# i.e. any PREFIX given at the configuration time is lost, unless it is
8993# also supplied (via environment) at these stages.
90−.PHONY: install-exec uninstall-exec
91−bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
92−install-exec: $(bin_all)
93− $(INSTALL) -d $(BINPATH); \
94− for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
95−uninstall-exec:
96− -for f in $(bin_all); do rm -f $(BINPATH)/$$f; done
9794
95+# User documents installation.
9896.PHONY: install-doc uninstall-doc
9997doc_all:=README.html README BUGS TODO
10098man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))
10199cleanup_files+=README.html
102−install-doc: $(doc_all)
100+install-doc: $(BINS) $(doc_all)
103101 $(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
104102 for f in $(man_all); do \
105103 $(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
@@ -110,17 +108,50 @@ uninstall-doc:
110108 -for f in $(man_all); do rm -f $(MANPATH)/$$f; done
111109 -rmdir $(DOCPATH)
112110
113−# Handle program installation manually (due to the deficiencies in Cabal).
114−.PHONY: install uninstall
115−install: install-exec install-doc
116−# FIXME: incomplete support for uninstallation.
117−uninstall: uninstall-exec uninstall-doc
118−
119−.PHONY: install-lib install-lib-doc
120−install-lib:
121− @$(BUILDCMD) install || true # required since we move executable
111+# Library documents installation.
112+.PHONY: install-lib-doc uninstall-lib-doc
122113install-lib-doc: build-lib-doc
123114 $(INSTALL) -d $(LIBDOCPATH) && cp -a html $(LIBDOCPATH)/
115+uninstall-lib-doc:
116+ -rm -rf $(LIBDOCPATH)/html
117+ -rmdir $(LIBDOCPATH)
118+
119+# Program only installation.
120+.PHONY: install-exec uninstall-exec
121+bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
122+install-exec: $(bin_all)
123+ $(INSTALL) -d $(BINPATH); \
124+ for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
125+uninstall-exec:
126+ -for f in $(bin_all); do rm -f $(BINPATH)/$$f; done
127+
128+# Program + user documents installation.
129+.PHONY: install-program uninstall-program
130+install-program: install-exec install-doc
131+uninstall-program: uninstall-exec uninstall-doc
132+
133+# Install everything.
134+.PHONY: install-all uninstall-all
135+install-all: install-doc install-lib-doc
136+ destdir=$(DESTDIR); destdir=$${destdir:-/}; \
137+ $(BUILDCMD) copy --destdir=$$destdir; \
138+ $(BUILDCMD) register
139+uninstall-all: uninstall-doc uninstall-lib-doc
140+ -pkg_id="$(NAME)-$(VERSION)"; \
141+ libdir=$$($(GHC_PKG) field $$pkg_id library-dirs 2>/dev/null | \
142+ sed 's/^library-dirs: *//'); \
143+ if [ -d "$$libdir" ]; then \
144+ $(BUILDCMD) unregister; \
145+ rm -rf $$libdir; \
146+ rmdir $$(dirname $$libdir); \
147+ else \
148+ echo "*** Couldn't locate library files for pkgid: $$pkg_id. ***"; \
149+ fi
150+
151+# Default installation recipe for a common deployment scenario.
152+.PHONY: install uninstall
153+install: install-program
154+uninstall: uninstall-program
124155
125156.PHONY: test test-markdown
126157test: $(BINS)
README+4−9
@@ -74,13 +74,10 @@ using Windows, you can install [Cygwin].
7474
7575 PREFIX=~ make install-exec
7676
77−5. Install Haskell libraries (optional):
77+5. Install everthing including Haskell libraries and library documentation
78+ (optional):
7879
79− make install-lib
80−
81−6. Install library documentation into `/usr/local/pandoc-doc` (optional):
82−
83− make install-lib-doc
80+ make install-all
8481
8582## Removing `pandoc`
8683
@@ -90,10 +87,8 @@ Each of the installation steps described above can be reversed:
9087
9188 PREFIX=~ make uninstall-exec
9289
93− make uninstall-lib
90+ make uninstall-all
9491
95− make uninstall-lib-doc
96−
9792# Using `pandoc`
9893
9994If you run `pandoc` without arguments, it will accept input from
debian/rules+1−1
@@ -67,7 +67,7 @@ install: build
6767 # http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/INSTRUCTIONS.txt
6868 find debian/libghc6-$(THIS)-dev -type d -name 'bin' -true | \
6969 while read bin; do mv $$bin/* .; rm -rf $$bin; done
70− $(MAKE) install
70+ $(MAKE) install-program
7171
7272build-indep: build-indep-stamp
7373build-indep-stamp: