git.iko.soy/typeable/pandoc
on master help sign in
Add a 'osx-pkg' target for the creation of a Mac OSX® package (using
52f07a0roktas
Makefile+30−2
@@ -44,6 +44,7 @@ PKGPATH := $(DATAPATH)/$(THIS)
44INSTALL := install -c
44INSTALL := install -c
45INSTALL_PROGRAM := $(INSTALL) -m 755
45INSTALL_PROGRAM := $(INSTALL) -m 755
46INSTALL_DATA := $(INSTALL) -m 644
46INSTALL_DATA := $(INSTALL) -m 644
47+STRIP := strip
47GHC := ghc
48GHC := ghc
48GHC_PKG := ghc-pkg
49GHC_PKG := ghc-pkg
49
50
@@ -59,6 +60,16 @@ templates: $(SRCDIR)/templates
59$(SRCDIR)/templates:
60$(SRCDIR)/templates:
60 $(MAKE) -C $(SRCDIR)/templates
61 $(MAKE) -C $(SRCDIR)/templates
61
62
63+# Document process rules.
64+%.html: %
65+ ./$(THIS) -s $^ >$@ || rm -f $@
66+%.tex: %
67+ $(THIS) -s -w latex $^ >$@ || rm -f $@
68+%.rtf: %
69+ $(THIS) -s -w rtf $^ >$@ || rm -f $@
70+%.pdf: %
71+ sh ./markdown2pdf $^ || rm -f $@
72+
62cleanup_files+=$(CABAL)
73cleanup_files+=$(CABAL)
63$(CABAL): cabalize $(CABAL).in
74$(CABAL): cabalize $(CABAL).in
64 ./cabalize <$(CABAL).in >$(CABAL)
75 ./cabalize <$(CABAL).in >$(CABAL)
@@ -153,13 +164,30 @@ uninstall-all: uninstall-exec uninstall-doc uninstall-lib-doc
153install: install-program
164install: install-program
154uninstall: uninstall-program
165uninstall: uninstall-program
155
166
167+.PHONY: osx-pkg
168+osx_dest:=osx-pkg
169+doc_more:=README.rtf LICENSE.rtf
170+cleanup_files+=$(osx_dest) $(doc_more)
171+osx-pkg: $(doc_more)
172+ -rm -rf $(osx_dest)
173+ $(INSTALL) -d $(osx_dest)
174+ DESTDIR=$(osx_dest) $(MAKE) install-program
175+ find $(osx_dest) -type f -regex ".*bin/.*" | xargs chmod +x
176+ find $(osx_dest) -type f -regex ".*bin/$(THIS)" | xargs $(STRIP)
177+ $(INSTALL) -d $(osx_dest)/Resources
178+ mv README.rtf $(osx_dest)/Resources/ReadMe.rtf
179+ mv LICENSE.rtf $(osx_dest)/Resources/License.rtf
180+ @echo
181+ @echo "You may now run PackageMaker.app. For Root, specify"
182+ @echo "osx-pkg/Package_Root. The ReadMe.rtf and License.rtf files"
183+ @echo "can be found in osx-pkg/Resources."
184+ @echo
185+
156.PHONY: test test-markdown
186.PHONY: test test-markdown
157test: $(BINS)
187test: $(BINS)
158 @cd tests && perl runtests.pl -s $(PWD)/$(THIS)
188 @cd tests && perl runtests.pl -s $(PWD)/$(THIS)
159test-markdown: $(BINS)
189test-markdown: $(BINS)
160 @cd tests/MarkdownTest_1.0.3 && perl MarkdownTest.pl -s $(PWD)/$(THIS) -tidy
190 @cd tests/MarkdownTest_1.0.3 && perl MarkdownTest.pl -s $(PWD)/$(THIS) -tidy
161−%.html: %
162− ./$(THIS) -s $^ >$@ || rm -f $@
163
191
164# Stolen and slightly improved from a GPLed Makefile. Credits to John Meacham.
192# Stolen and slightly improved from a GPLed Makefile. Credits to John Meacham.
165src_all:=$(shell find $(SRCDIR) -type f -name '*hs' | egrep -v '^\./(_darcs|lib|test)/')
193src_all:=$(shell find $(SRCDIR) -type f -name '*hs' | egrep -v '^\./(_darcs|lib|test)/')