aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-03 11:26:53 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-03 11:26:53 +0000
commitafd92376d6bd2380216a5f1a56eb8b81093b2a54 (patch)
tree355b6eca250d51bc44dc3dcf6f327a426c6ab10d
parentfdfe8494ca162508850455c0b0cbce6fac905ab8 (diff)
downloadpandoc-afd92376d6bd2380216a5f1a56eb8b81093b2a54.tar.gz
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
-rw-r--r--Makefile29
1 files changed, 18 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index a189c3490..74820def2 100644
--- a/Makefile
+++ b/Makefile
@@ -19,12 +19,6 @@ PROGS := $(EXECS) html2markdown markdown2html latex2markdown markdown2latex
DOCS := README.html README BUGS TODO
#-------------------------------------------------------------------------------
-# Variables to setup through environment
-#-------------------------------------------------------------------------------
-PREFIX ?= /usr/local
-DESTDIR ?=
-
-#-------------------------------------------------------------------------------
# Constant names and commands in source tree
#-------------------------------------------------------------------------------
SRCDIR := src
@@ -32,9 +26,23 @@ MANDIR := man
BUILDDIR := dist
BUILDCONF := .setup-config
BUILDCMD := runhaskell Setup.hs
+BUILDVARS := vars
CONFIGURE := configure
#-------------------------------------------------------------------------------
+# Variables to setup through environment
+#-------------------------------------------------------------------------------
+
+# Specify default values.
+prefix := /usr/local
+destdir :=
+# Attempt to set variables from a previous make session.
+-include $(BUILDVARS)
+# Fallback to defaults but allow to get the values from environment.
+PREFIX ?= $(prefix)
+DESTDIR ?= $(destdir)
+
+#-------------------------------------------------------------------------------
# Installation paths
#-------------------------------------------------------------------------------
THIS := $(shell echo $(NAME) | tr A-Z a-z)
@@ -85,10 +93,13 @@ $(CABAL): cabalize $(CABAL).in
./cabalize <$(CABAL).in >$(CABAL)
.PHONY: configure
-cleanup_files+=$(BUILDDIR) $(BUILDCONF)
+cleanup_files+=$(BUILDDIR) $(BUILDCONF) $(BUILDVARS)
configure: $(BUILDCONF)
$(BUILDCONF): $(CABAL)
$(BUILDCMD) configure --prefix=$(PREFIX)
+ # Make configuration time settings persistent (definitely a hack).
+ @echo "PREFIX?=$(PREFIX)" >$(BUILDVARS)
+ @echo "DESTDIR?=$(DESTDIR)" >>$(BUILDVARS)
.PHONY: build
build: $(BUILDDIR)
@@ -121,10 +132,6 @@ html/: configure
.PHONY: build-all
build-all: all 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.
-
# User documents installation.
.PHONY: install-doc uninstall-doc
man_all:=$(patsubst $(MANDIR)/%,%,$(wildcard $(MANDIR)/man?/*.1))