@@ -1,34 +1,33 @@
11# Makefile for Pandoc.
22
3+#-------------------------------------------------------------------------------
4+# Constant names and commands in source tree
5+#-------------------------------------------------------------------------------
36CABAL := Pandoc.cabal
7+SRCDIR := src
8+MANDIR := man
9+BUILDDIR := dist
10+BUILDCONF := .setup-config
11+BUILDCMD := runhaskell Setup.hs
12+BUILDVARS := vars
13+CONFIGURE := configure
414
515#-------------------------------------------------------------------------------
616# Cabal constants
717#-------------------------------------------------------------------------------
818NAME := $(shell sed -ne 's/^[Nn]ame:[[:space:]]*//p' $(CABAL).in)
919VERSION := $(shell sed -ne 's/^[Vv]ersion:[[:space:]]*//p' $(CABAL).in)
10−EXECS := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
11−
12−# First entry in Cabal's executable stanza is the main executable.
13−MAIN := $(word 1, $(EXECS))
20+EXECNAMES := $(shell sed -ne 's/^[Ee]xecutable:[[:space:]]*//p' $(CABAL).in)
1421
1522#-------------------------------------------------------------------------------
1623# Install targets
1724#-------------------------------------------------------------------------------
25+EXECS :=$(join $(patsubst %,$(BUILDDIR)/build/%/,$(EXECNAMES)),$(EXECNAMES))
26+# First entry in Cabal's executable stanza is the main executable.
27+MAIN := $(firstword $(EXECS))
1828PROGS := $(EXECS) html2markdown markdown2html latex2markdown markdown2latex markdown2pdf
1929DOCS := README.html README BUGS TODO
2030
21−#-------------------------------------------------------------------------------
22−# Constant names and commands in source tree
23−#-------------------------------------------------------------------------------
24−SRCDIR := src
25−MANDIR := man
26−BUILDDIR := dist
27−BUILDCONF := .setup-config
28−BUILDCMD := runhaskell Setup.hs
29−BUILDVARS := vars
30−CONFIGURE := configure
31−
3231#-------------------------------------------------------------------------------
3332# Variables to setup through environment
3433#-------------------------------------------------------------------------------
@@ -109,9 +108,6 @@ build: templates configure
109108build-exec: $(EXECS)
110109cleanup_files+=$(EXECS)
111110$(EXECS): build
112− for f in $@; do \
113− find $(BUILDDIR) -type f -name "$$f" -perm +a=x -exec cp -p {} . \; ; \
114− done
115111
116112.PHONY: build-doc
117113cleanup_files+=README.html
@@ -207,7 +203,7 @@ $(osx_dest)/: $(doc_more)
207203 DESTDIR=$(osx_dest)/Package_root $(MAKE) install-program
208204 cp $(osx_src)/uninstall-pandoc $(osx_dest)/Package_root/usr/local/bin/
209205 find $(osx_dest) -type f -regex ".*bin/.*" | xargs chmod +x
210− find $(osx_dest) -type f -regex ".*bin/$(MAIN)" | xargs $(STRIP)
206+ find $(osx_dest) -type f -regex ".*bin/$(notdir $(MAIN))" | xargs $(STRIP)
211207 $(INSTALL) -d $(osx_dest)/Resources
212208 cp README.rtf $(osx_dest)/Resources/ReadMe.rtf
213209 cp LICENSE.rtf $(osx_dest)/Resources/License.rtf