git.iko.soy/typeable/pandoc
on master help sign in
Remove 'install-lib', it causes too much trouble which needs to be dealed
40a8480roktas
Makefile+53−22
@@ -29,8 +29,10 @@ CONFIGURE := configure
29#-------------------------------------------------------------------------------
29#-------------------------------------------------------------------------------
30# Installation paths
30# Installation paths
31#-------------------------------------------------------------------------------
31#-------------------------------------------------------------------------------
32+DESTPATH := $(DESTDIR)$(PREFIX)
32−BINPATH := $(DESTDIR)$(PREFIX)/bin
33+BINPATH := $(DESTPATH)/bin
33−DATAPATH := $(DESTDIR)$(PREFIX)/share
34+DATAPATH := $(DESTPATH)/share
35+LIBPATH := $(DESTPATH)/$(NAME)-$(VERSION)
34DOCPATH := $(DATAPATH)/doc/$(THIS)
36DOCPATH := $(DATAPATH)/doc/$(THIS)
35LIBDOCPATH := $(DATAPATH)/doc/$(THIS)-doc
37LIBDOCPATH := $(DATAPATH)/doc/$(THIS)-doc
36MANPATH := $(DATAPATH)/man
38MANPATH := $(DATAPATH)/man
@@ -43,6 +45,7 @@ INSTALL := install -c
43INSTALL_PROGRAM := $(INSTALL) -m 755
45INSTALL_PROGRAM := $(INSTALL) -m 755
44INSTALL_DATA := $(INSTALL) -m 644
46INSTALL_DATA := $(INSTALL) -m 644
45GHC := ghc
47GHC := ghc
48+GHC_PKG := ghc-pkg
46
49
47#-------------------------------------------------------------------------------
50#-------------------------------------------------------------------------------
48# Recipes
51# Recipes
@@ -80,26 +83,21 @@ html/: configure
80
83
81cleanup_files+=$(BINS)
84cleanup_files+=$(BINS)
82$(BINS): build
85$(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
86
90
87# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
91# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
88# i.e. any PREFIX given at the configuration time is lost, unless it is
92# i.e. any PREFIX given at the configuration time is lost, unless it is
89# also supplied (via environment) at these stages.
93# 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
97
94
95+# User documents installation.
98.PHONY: install-doc uninstall-doc
96.PHONY: install-doc uninstall-doc
99doc_all:=README.html README BUGS TODO
97doc_all:=README.html README BUGS TODO
100man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))
98man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))
101cleanup_files+=README.html
99cleanup_files+=README.html
102−install-doc: $(doc_all)
100+install-doc: $(BINS) $(doc_all)
103 $(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
101 $(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
104 for f in $(man_all); do \
102 for f in $(man_all); do \
105 $(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
103 $(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
@@ -110,17 +108,50 @@ uninstall-doc:
110 -for f in $(man_all); do rm -f $(MANPATH)/$$f; done
108 -for f in $(man_all); do rm -f $(MANPATH)/$$f; done
111 -rmdir $(DOCPATH)
109 -rmdir $(DOCPATH)
112
110
113−# Handle program installation manually (due to the deficiencies in Cabal).
111+# Library documents installation.
114−.PHONY: install uninstall
112+.PHONY: install-lib-doc uninstall-lib-doc
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
122install-lib-doc: build-lib-doc
113install-lib-doc: build-lib-doc
123 $(INSTALL) -d $(LIBDOCPATH) && cp -a html $(LIBDOCPATH)/
114 $(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
124
155
125.PHONY: test test-markdown
156.PHONY: test test-markdown
126test: $(BINS)
157test: $(BINS)
README+4−9
@@ -74,13 +74,10 @@ using Windows, you can install [Cygwin].
74
74
75 PREFIX=~ make install-exec
75 PREFIX=~ make install-exec
76
76
77−5. Install Haskell libraries (optional):
77+5. Install everthing including Haskell libraries and library documentation
78+ (optional):
78
79
79− make install-lib
80+ make install-all
80−
81−6. Install library documentation into `/usr/local/pandoc-doc` (optional):
82−
83− make install-lib-doc
84
81
85## Removing `pandoc`
82## Removing `pandoc`
86
83
@@ -90,10 +87,8 @@ Each of the installation steps described above can be reversed:
90
87
91 PREFIX=~ make uninstall-exec
88 PREFIX=~ make uninstall-exec
92
89
93− make uninstall-lib
90+ make uninstall-all
94
91
95− make uninstall-lib-doc
96−
97# Using `pandoc`
92# Using `pandoc`
98
93
99If you run `pandoc` without arguments, it will accept input from
94If you run `pandoc` without arguments, it will accept input from
debian/rules+1−1
@@ -67,7 +67,7 @@ install: build
67 # http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/INSTRUCTIONS.txt
67 # http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/INSTRUCTIONS.txt
68 find debian/libghc6-$(THIS)-dev -type d -name 'bin' -true | \
68 find debian/libghc6-$(THIS)-dev -type d -name 'bin' -true | \
69 while read bin; do mv $$bin/* .; rm -rf $$bin; done
69 while read bin; do mv $$bin/* .; rm -rf $$bin; done
70− $(MAKE) install
70+ $(MAKE) install-program
71
71
72build-indep: build-indep-stamp
72build-indep: build-indep-stamp
73build-indep-stamp:
73build-indep-stamp: