tools: make fixperms, viewall, printall, site; doc building updates
This commit is contained in:
		
							parent
							
								
									7a895b0133
								
							
						
					
					
						commit
						10e75ebdf6
					
				
							
								
								
									
										71
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								Makefile
									
									
									
									
									
								
							@ -19,9 +19,14 @@ COVCMD=test
 | 
				
			|||||||
# standard cabal builds, also constrained to parsec 2 for now.
 | 
					# standard cabal builds, also constrained to parsec 2 for now.
 | 
				
			||||||
BENCHEXES=hledger-0.6 hledger-0.7 ledger-3pre
 | 
					BENCHEXES=hledger-0.6 hledger-0.7 ledger-3pre
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# document viewing commands
 | 
					# misc. tools
 | 
				
			||||||
VIEWHTMLCMD=open
 | 
					PANDOC=pandoc
 | 
				
			||||||
VIEWPSCMD=open
 | 
					RST2HTML=rst2html
 | 
				
			||||||
 | 
					RST2HTML=/opt/local/bin/rst2html.py
 | 
				
			||||||
 | 
					VIEWHTML=open
 | 
				
			||||||
 | 
					VIEWPS=open
 | 
				
			||||||
 | 
					VIEWPDF=open
 | 
				
			||||||
 | 
					PRINT=lpr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SOURCEFILES:= \
 | 
					SOURCEFILES:= \
 | 
				
			||||||
	hledger.hs \
 | 
						hledger.hs \
 | 
				
			||||||
@ -93,6 +98,10 @@ hledgerlinux: setversion
 | 
				
			|||||||
continuous ci: setversion
 | 
					continuous ci: setversion
 | 
				
			||||||
	sp --no-exts --no-default-map -o hledger ghc --make hledger.hs $(BUILDFLAGS) --run $(CICMD)
 | 
						sp --no-exts --no-default-map -o hledger ghc --make hledger.hs $(BUILDFLAGS) --run $(CICMD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# fix permissions (eg after darcs get)
 | 
				
			||||||
 | 
					fixperms:
 | 
				
			||||||
 | 
						chmod +x tools/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# build the standalone unit test runner. Requires test-framework, which
 | 
					# build the standalone unit test runner. Requires test-framework, which
 | 
				
			||||||
# may not work on windows.
 | 
					# may not work on windows.
 | 
				
			||||||
tools/unittest: tools/unittest.hs
 | 
					tools/unittest: tools/unittest.hs
 | 
				
			||||||
@ -150,7 +159,7 @@ functest: hledger
 | 
				
			|||||||
		&& echo $@ passed) || echo $@ FAILED
 | 
							&& echo $@ passed) || echo $@ FAILED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# run doc tests
 | 
					# run doc tests
 | 
				
			||||||
doctest: tools/doctest
 | 
					doctest: tools/doctest hledger
 | 
				
			||||||
	@(tools/doctest Commands/Add.hs \
 | 
						@(tools/doctest Commands/Add.hs \
 | 
				
			||||||
		&& tools/doctest Tests.hs \
 | 
							&& tools/doctest Tests.hs \
 | 
				
			||||||
		&& echo $@ passed) || echo $@ FAILED
 | 
							&& echo $@ passed) || echo $@ FAILED
 | 
				
			||||||
@ -250,32 +259,54 @@ cleandocs:
 | 
				
			|||||||
	rm -rf website/[A-Z]*.html website/api-doc/*
 | 
						rm -rf website/[A-Z]*.html website/api-doc/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# rebuild all docs
 | 
					# rebuild all docs
 | 
				
			||||||
docs: web pdf api-docs
 | 
					docs: html pdf apidocs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# build the main hledger.org website
 | 
					# generate html versions of docs (and the hledger.org website)
 | 
				
			||||||
web:
 | 
					# work around pandoc not handling full rst image directive
 | 
				
			||||||
	for d in $(DOCFILES); do pandoc --toc -s -H website/header.html -A website/footer.html -r rst $$d >website/$$d.html; done
 | 
					html:
 | 
				
			||||||
 | 
						for d in $(DOCFILES); do $(PANDOC) --toc -s -H website/header.html -A website/footer.html -r rst $$d >website/$$d.html; done
 | 
				
			||||||
 | 
						cd website && ln -sf ../SCREENSHOTS && $(RST2HTML) SCREENSHOTS >SCREENSHOTS.html && rm -f SCREENSHOTS
 | 
				
			||||||
	cd website; rm -f index.html; ln -s README.html index.html; rm -f profs; ln -s ../profs
 | 
						cd website; rm -f index.html; ln -s README.html index.html; rm -f profs; ln -s ../profs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ..from anywhere
 | 
					pdf: docspdf codepdf
 | 
				
			||||||
updatesite: push
 | 
					 | 
				
			||||||
	ssh joyful.com 'make -C/repos/hledger docs'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# generate pdf versions of main docs
 | 
					# generate pdf versions of main docs
 | 
				
			||||||
pdf:
 | 
					# work around rst2pdf needing images in the same directory
 | 
				
			||||||
	-for d in $(DOCFILES); do rst2pdf $$d -o website/$$d.pdf; done
 | 
					docspdf:
 | 
				
			||||||
 | 
						-for d in $(DOCFILES); do (cd website && ln -sf ../$$d && rst2pdf $$d && rm -f $$d); done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# format all code as a pdf for offline reading
 | 
				
			||||||
 | 
					ENSCRIPT=enscript -q --header='$$n|$$D{%+}|Page $$% of $$=' --line-numbers --font=Courier6 --color -o-
 | 
				
			||||||
 | 
					codepdf:
 | 
				
			||||||
 | 
						$(ENSCRIPT) --pretty-print=makefile hledger.cabal >cabal.ps
 | 
				
			||||||
 | 
						$(ENSCRIPT) --pretty-print=makefile Makefile >make.ps
 | 
				
			||||||
 | 
						$(ENSCRIPT) --pretty-print=haskell $(SOURCEFILES) >haskell.ps
 | 
				
			||||||
 | 
						cat cabal.ps make.ps haskell.ps | ps2pdf - >code.pdf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# view all docs and code as pdf
 | 
				
			||||||
 | 
					PDFS=website/{README,README2,MANUAL,NEWS,CONTRIBUTORS,SCREENSHOTS}.pdf code.pdf
 | 
				
			||||||
 | 
					viewall: pdf
 | 
				
			||||||
 | 
						$(VIEWPDFCMD) $(PDFS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# print all docs and code for offline reading
 | 
				
			||||||
 | 
					printall: pdf
 | 
				
			||||||
 | 
						$(PRINTCMD) $(PDFS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# push latest docs etc. and update the hledger.org site
 | 
				
			||||||
 | 
					site: push
 | 
				
			||||||
 | 
						ssh joyful.com 'make -C/repos/hledger docs'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# generate api docs
 | 
					# generate api docs
 | 
				
			||||||
# We munge haddock and hoogle into a rough but useful framed layout.
 | 
					# We munge haddock and hoogle into a rough but useful framed layout.
 | 
				
			||||||
# For this to work the hoogle cgi must be built with base target "main".
 | 
					# For this to work the hoogle cgi must be built with base target "main".
 | 
				
			||||||
# XXX move the framed index building into haddock: ?
 | 
					# XXX move the framed index building into haddock: ?
 | 
				
			||||||
api-docs: haddock #hoogle
 | 
					apidocs: haddock #hoogle
 | 
				
			||||||
	sed -i -e 's%^></HEAD%><base target="main"></HEAD%' website/api-doc/modules-index.html ; \
 | 
						sed -i -e 's%^></HEAD%><base target="main"></HEAD%' website/api-doc/modules-index.html ; \
 | 
				
			||||||
	cp website/api-doc-frames.html website/api-doc/index.html ; \
 | 
						cp website/api-doc-frames.html website/api-doc/index.html ; \
 | 
				
			||||||
# 	cp website/hoogle-small.html website/api-doc
 | 
					# 	cp website/hoogle-small.html website/api-doc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# generate and view the api docs
 | 
					# generate and view the api docs
 | 
				
			||||||
view-api-docs: api-docs
 | 
					viewapidocs: api-docs
 | 
				
			||||||
	$(VIEWHTMLCMD) website/api-doc/index.html
 | 
						$(VIEWHTMLCMD) website/api-doc/index.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAIN=hledger.hs
 | 
					MAIN=hledger.hs
 | 
				
			||||||
@ -497,16 +528,8 @@ emacstags:
 | 
				
			|||||||
	@rm -f TAGS; hasktags -e $(SOURCEFILES) hledger.cabal
 | 
						@rm -f TAGS; hasktags -e $(SOURCEFILES) hledger.cabal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -f `find . -name "*.o" -o -name "*.hi" -o -name "*~" -o -name "darcs-amend-record*"`
 | 
						rm -f `find . -name "*.o" -o -name "*.hi" -o -name "*~" -o -name "darcs-amend-record*" -o -name "*-darcs-backup*"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Clean: clean cleandocs
 | 
					Clean: clean cleandocs
 | 
				
			||||||
	rm -f hledger TAGS tags
 | 
						rm -f hledger TAGS tags
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printps:
 | 
					 | 
				
			||||||
	enscript --line-numbers --font=Courier7 --output=cabal.ps hledger.cabal
 | 
					 | 
				
			||||||
	enscript --line-numbers --font=Courier7 --color --pretty-print=makefile --output=make.ps  Makefile 
 | 
					 | 
				
			||||||
	enscript --line-numbers --font=Courier7 --color --pretty-print=haskell --output=code.ps $(SOURCEFILES)
 | 
					 | 
				
			||||||
	cat cabal.ps make.ps code.ps >all.ps
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print: printps
 | 
					 | 
				
			||||||
	lpr all.ps
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user