aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-02 06:45:03 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-02 06:45:03 +0000
commit2d2914ff1aa02d487f5454248b7640e0e2551286 (patch)
tree95fac70082e06d3015e61af9f6e390ce397423b3 /Makefile
parentd3f52801c79bb5661503a4b0c19f98c451450f70 (diff)
downloadpandoc-2d2914ff1aa02d487f5454248b7640e0e2551286.tar.gz
Sanitize Makefile:
+ Move $(BINS) target to a new PHONY 'build-exec' target. This should be used in all (non-build type) targets which refer BINS. Also, create a new 'build-program' target for user's convenience. + Update all targets so as to use build-exec (instead of BINS). + Use an explicit global DOCS variable which lists buildable documents; this makes our intention more clear. Also, for the sake of consistency, move BINS variable (which lists buildable executables) to a new section and create a redundant (for the moment, at least) EXECS variable. + Move all buildable target files in install-* targets to the related build-* targets. This mostly involves document files (e.g. README.hmtl). As a result, we now have a new build target 'build-doc' which builds main documents. This modification provides a clean separation between build and install type targets. git-svn-id: https://pandoc.googlecode.com/svn/trunk@69 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 31 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 4a748d8ab..21ea0090e 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,13 @@ CABAL := Pandoc.cabal
NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL).in)
THIS := $(shell echo $(NAME) | tr A-Z a-z)
VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL).in)
-BINS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
+EXECS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
+
+#-------------------------------------------------------------------------------
+# Build targets
+#-------------------------------------------------------------------------------
+BINS := $(EXECS)
+DOCS := README.html
#-------------------------------------------------------------------------------
# Variables to setup through environment
@@ -52,8 +58,9 @@ GHC_PKG := ghc-pkg
# Recipes
#-------------------------------------------------------------------------------
+# Default target.
.PHONY: all
-all: $(BINS)
+all: build-program
# Document process rules.
%.html: % $(THIS)
@@ -84,6 +91,21 @@ $(BUILDCONF): $(CABAL)
build: templates configure
$(BUILDCMD) build
+.PHONY: build-exec
+build-exec: $(BINS)
+cleanup_files+=$(BINS)
+$(BINS): build
+ find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec cp {} . \;
+
+.PHONY: build-doc
+DOCS:=README.html
+cleanup_files+=$(DOCS)
+build-doc: $(DOCS)
+$(DOCS): build-exec
+
+.PHONY: build-program
+build-program: build-exec build-doc
+
.PHONY: build-lib-doc haddock
build-lib-doc: html
haddock: build-lib-doc
@@ -92,12 +114,8 @@ html/: configure
-rm -rf html
$(BUILDCMD) haddock && mv $(BUILDDIR)/doc/html .
-cleanup_files+=$(BINS)
-$(BINS): build
- find $(BUILDDIR) -type f -name "$(BINS)" -perm +a=x -exec cp {} . \;
-
.PHONY: build-all
-build-all: build $(BINS) build-lib-doc
+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
@@ -105,10 +123,9 @@ build-all: build $(BINS) build-lib-doc
# 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: $(BINS) $(doc_all)
+doc_all:=$(DOCS) README BUGS TODO
+install-doc: build-doc
$(INSTALL) -d $(DOCPATH) && $(INSTALL_DATA) $(doc_all) $(DOCPATH)/
for f in $(man_all); do \
$(INSTALL) -d $(MANPATH)/$$(dirname $$f); \
@@ -130,7 +147,7 @@ uninstall-lib-doc:
# Program only installation.
.PHONY: install-exec uninstall-exec
bin_all:=$(BINS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
-install-exec: $(bin_all)
+install-exec: build-exec
$(INSTALL) -d $(BINPATH); \
for f in $(bin_all); do $(INSTALL_PROGRAM) $$f $(BINPATH)/; done
uninstall-exec:
@@ -170,7 +187,7 @@ doc_more:=README.rtf LICENSE.rtf $(osx_src)/Welcome.rtf
osx_pkg_name:=Pandoc_$(VERSION).pkg
cleanup_files+=$(osx_dest) $(doc_more) $(osx_pkg_name)
osx-pkg-prep: $(osx_dest)
-$(osx_dest)/: $(doc_more) $(BINS)
+$(osx_dest)/: build-exec $(doc_more)
-rm -rf $(osx_dest)
$(INSTALL) -d $(osx_dest)
DESTDIR=$(osx_dest)/Package_root $(MAKE) install-program
@@ -214,9 +231,9 @@ $(osx_dmg_name): $(osx_pkg_name)
mv Pandoc.udzo.dmg $(osx_dmg_name)
.PHONY: test test-markdown
-test: $(BINS)
+test: build-exec
@cd tests && perl runtests.pl -s $(PWD)/$(THIS)
-test-markdown: $(BINS)
+test-markdown: build-exec
@cd tests/MarkdownTest_1.0.3 && perl MarkdownTest.pl -s $(PWD)/$(THIS) -tidy
# Stolen and slightly improved from a GPLed Makefile. Credits to John Meacham.