git.iko.soy/typeable/pandoc
on master help sign in
Attempt to fix a (long-standing) Makefile drawback which is documented in

previous revisions as follows: # 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. With this (optional and experimental) hack, config time settings will become persistent. Such persistency allows one to specify PREFIX and/or DESTDIR only once (at the first run). That is, the below actions should work fine now: DESTDIR=/tmp/foo make make install In previous code these variables need to be specified at each run. For example: DESTDIR=/tmp/foo make DESTDIR=/tmp/foo make install This change (as an ugly hack) is optional (and might be removed) as the user could always work around that issue with 'DESTDIR=/tmp/foo make install'. git-svn-id: https://pandoc.googlecode.com/svn/trunk@75 788f1e2b-df1e-0410-8736-df70ead52e1b

commitafd92376d6bd2380216a5f1a56eb8b81093b2a54 authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b> dateFri 3 Nov 2006, 11:26 (20 years ago) parentfdfe849
1 file changed+18−11
Makefile+18−11
Makefile+18−11
@@ -18,12 +18,6 @@ MAIN := $(word 1, $(EXECS))
1818PROGS := $(EXECS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
1919DOCS := README.html README BUGS TODO
2020
21−#-------------------------------------------------------------------------------
22−# Variables to setup through environment
23−#-------------------------------------------------------------------------------
24−PREFIX ?= /usr/local
25−DESTDIR ?=
26−
2721#-------------------------------------------------------------------------------
2822# Constant names and commands in source tree
2923#-------------------------------------------------------------------------------
@@ -32,8 +26,22 @@ MANDIR := man
3226BUILDDIR := dist
3327BUILDCONF := .setup-config
3428BUILDCMD := runhaskell Setup.hs
29+BUILDVARS := vars
3530CONFIGURE := configure
3631
32+#-------------------------------------------------------------------------------
33+# Variables to setup through environment
34+#-------------------------------------------------------------------------------
35+
36+# Specify default values.
37+prefix := /usr/local
38+destdir :=
39+# Attempt to set variables from a previous make session.
40+-include $(BUILDVARS)
41+# Fallback to defaults but allow to get the values from environment.
42+PREFIX ?= $(prefix)
43+DESTDIR ?= $(destdir)
44+
3745#-------------------------------------------------------------------------------
3846# Installation paths
3947#-------------------------------------------------------------------------------
@@ -85,10 +93,13 @@ $(CABAL): cabalize $(CABAL).in
8593 ./cabalize <$(CABAL).in >$(CABAL)
8694
8795.PHONY: configure
88−cleanup_files+=$(BUILDDIR) $(BUILDCONF)
96+cleanup_files+=$(BUILDDIR) $(BUILDCONF) $(BUILDVARS)
8997configure: $(BUILDCONF)
9098$(BUILDCONF): $(CABAL)
9199 $(BUILDCMD) configure --prefix=$(PREFIX)
100+ # Make configuration time settings persistent (definitely a hack).
101+ @echo "PREFIX?=$(PREFIX)" >$(BUILDVARS)
102+ @echo "DESTDIR?=$(DESTDIR)" >>$(BUILDVARS)
92103
93104.PHONY: build
94105build: $(BUILDDIR)
@@ -121,10 +132,6 @@ html/: configure
121132.PHONY: build-all
122133build-all: all build-lib-doc
123134
124−# XXX: Note that we don't handle PREFIX correctly at the install-* stages,
125−# i.e. any PREFIX given at the configuration time is lost, unless it is
126−# also supplied (via environment) at these stages.
127−
128135# User documents installation.
129136.PHONY: install-doc uninstall-doc
130137man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))