add haddock/hscolour/hoole make targets like the ones in darcs
This commit is contained in:
		
							parent
							
								
									7051721c60
								
							
						
					
					
						commit
						59181876aa
					
				
							
								
								
									
										70
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										70
									
								
								Makefile
									
									
									
									
									
								
							| @ -28,9 +28,6 @@ test: | ||||
| 	@./hledger.hs test | ||||
| 	@./regtest.py | ||||
| 
 | ||||
| docs haddock: | ||||
| 	haddock -h -o doc *.hs | ||||
| 
 | ||||
| loc: | ||||
| 	@darcs trackdown 'find . -name "*hs" |xargs wc -l |echo OUTPUT `tail -1`; false' |ruby -nae'puts $$F[1] if /^OUTPUT/' | ||||
| 
 | ||||
| @ -40,6 +37,71 @@ Tags: | ||||
| clean: | ||||
| 	rm -f *.o *.hi *~ 1 2 | ||||
| 
 | ||||
| Clean: clean | ||||
| clean-docs: | ||||
| 	rm -rf api-doc hoogle | ||||
| 
 | ||||
| Clean: clean clean-docs | ||||
| 	rm -f hledger hledgeropt TAGS tags | ||||
| 
 | ||||
| # docs
 | ||||
| 
 | ||||
| MAIN=hledger.hs | ||||
| 
 | ||||
| docs: haddock-with-source hoogleweb api-doc-frames | ||||
| 
 | ||||
| api-doc-dir: | ||||
| 	mkdir -p api-doc | ||||
| 
 | ||||
| haddock: api-doc-dir $(MAIN) | ||||
| 	echo "Generating haddock api docs" ; \
 | ||||
| 	haddock --no-warnings --ignore-all-exports -B `ghc --print-libdir` -o api-doc -h $(filter-out %api-doc-dir,$^) ; \
 | ||||
| 	cp api-doc/index.html api-doc/modules-index.html | ||||
| 
 | ||||
| haddock-with-source: api-doc-dir colourised-source $(MAIN) | ||||
| 	echo "Generating haddock api docs" ; \
 | ||||
| 	haddock --no-warnings --ignore-all-exports -B `ghc --print-libdir` -o api-doc -h --source-module=src-%{MODULE/./-}.html --source-entity=src-%{MODULE/./-}.html#%N $(filter-out %api-doc-dir colourised-source,$^) ; \
 | ||||
| 	cp api-doc/index.html api-doc/modules-index.html | ||||
| 
 | ||||
| # convert haddock output to a rough but useful frame layout. Run after haddock.
 | ||||
| # if frames.html includes a hoogle pane, ensure the hoogle cgi is built with base target "main"
 | ||||
| api-doc-frames: | ||||
| 	echo "Converting api docs to frames" ; \
 | ||||
| 	sed -i -e 's%^></HEAD%><base target="main"></HEAD%' api-doc/modules-index.html ; \
 | ||||
| 	cp data/frames.html api-doc/index.html | ||||
| 
 | ||||
| colourised-source: api-doc-dir | ||||
| 	echo "Generating colourised source" ; \
 | ||||
| 	for f in *hs; do \
 | ||||
| 		HsColour -css -anchor $$f -oapi-doc/`echo "src/"$$f | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%'` ; \
 | ||||
| 	done ; \
 | ||||
| 	HsColour -print-css >api-doc/hscolour.css | ||||
| 
 | ||||
| #generate a hoogle index
 | ||||
| #uses system hoogle, works around http://code.google.com/p/ndmitchell/issues/detail?id=93
 | ||||
| #to use: hoogle --data=hoogle/default ...
 | ||||
| hoogleindex: $(MAIN) | ||||
| 	echo "Generating hoogle index" ; \
 | ||||
| 	mkdir -p hoogle && \
 | ||||
| 	haddock --no-warnings --ignore-all-exports -B `ghc --print-libdir` -o hoogle --hoogle $^ && \
 | ||||
| 	cd hoogle && \
 | ||||
| 	sed -i -e 's/^(_/-- (_/' main.txt && \
 | ||||
| 	hoogle --convert=main.txt --output=default.hoo | ||||
| 
 | ||||
| #set up the hoogle web interface
 | ||||
| #uses a hoogle source tree configured with --datadir=., patched to fix haddock urls/target frame
 | ||||
| HOOGLESRC=/usr/local/src/hoogle | ||||
| HOOGLE=$(HOOGLESRC)/dist/build/hoogle/hoogle | ||||
| HOOGLEVER=`$(HOOGLE) --version |tail -n 1 | sed -e 's/Version /hoogle-/'` | ||||
| hoogleweb: hoogleindex | ||||
| 	echo "Configuring hoogle web interface" ; \
 | ||||
| 	if test -f $(HOOGLE) ; then \
 | ||||
| 		mkdir -p hoogle && \
 | ||||
| 		cd hoogle && \
 | ||||
| 		rm -f $(HOOGLEVER) && \
 | ||||
| 		ln -s . $(HOOGLEVER) && \
 | ||||
| 		cp -r $(HOOGLESRC)/src/res/ . && \
 | ||||
| 		cp -p $(HOOGLE) index.cgi && \
 | ||||
| 		touch log.txt && chmod 666 log.txt ; \
 | ||||
| 	else \
 | ||||
| 		echo "Could not find $(HOOGLE) in the hoogle source tree" ; \
 | ||||
| 	fi | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user