# # Makefile for Safari perllib project # Copyright (c) 1999 by Barrie Slaymaker, rbs@telerama.com # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # # .SUFFIXES: # Some redirects to make it easy to endy up in the right place in the # tree http_dir/index.html: echo "Forwarding..." |\ saf_http_out $(EXPIRES) -h ":loc: _head/Default/" -o "$@" http_dir/$(SAF_REV)/index.html: echo "Forwarding..." |\ saf_http_out $(EXPIRES) -h ":loc: Default/" -o "$@" # # Multiplex directories in @INC in to a single place # # Use .PRECIOUS since more than one target depends on this, and it will # speed up secondary target generation. # .PRECIOUS: mux/% mux: flatten_perllib mux mux/%: flatten_perllib mux # # Handle views # http/$(SAF_REV)/plain/%: /usr/lib/perl5/% saf_http_out --file-type=text "$<" -o "$@" http/$(SAF_REV)/pretty/%: /usr/lib/perl5/% { \ export LANGCODE=`pfile --follow --fields=type "$<"` ; \ unset GATEWAY_INTERFACE ; code2html --linknumbers $$LANGCODE "$<" | \ saf_http_out $(EXPIRES) -o "$@" \ } || \ saf_http_out $(EXPIRES) "$<" -o "$@" http/$(SAF_REV)/HTML/%: /usr/lib/perl5/% saf_http_out $(EXPIRES) "$<" -o "$@" # Preferred view # If make was invoked by cgimake or the command line, MAKELEVEL will be 0. # in this case, we do a recursive make so that the SAF_FILTER can be altered # In the recursive make MAKELEVEL is set to 1 by make. In this case, we # analyze the base file and figure out what view is preferred, then # build that view and link to it. ifeq ($(MAKELEVEL),0) http/$(SAF_REV)/Default/%: $(MAKE) -f $(SAF_CONF_DIR)/Makefile \ --no-print-directory http/$(SAF_REV)/Default/$* else SAF_FILTER=plain http/$(SAF_REV)/Default/%: http/$(SAF_REV)/$(SAF_FILTER)/% mkpath "$@" -rm -f "$@" ln -s "${shell pwd}/$<" "$@" endif http/$(SAF_REV)/Default/%: http/$(SAF_REV)/plain/% mkpath "$@" -rm -f "$@" ln -s "${shell pwd}/$<" "$@" # pod2html method: incremental, but pod2html is buggy # #http/POD/%: /usr/lib/perl5/5.00503/% # mkpath "$@" # pod2html --htmlroot=/safari/lib/perl5/POD "--infile=$<" | \ # dress_my_perl_lib "--path=$@" | \ # add_headers --no-http-present --Content-type=text/html > "$@" .PRECIOUS: \ http/$(SAF_REV)/plain/%\ http/$(SAF_REV)/pretty/%\ http/$(SAF_REV)/ChLines/%\ http/$(SAF_REV)/HTML/%\ http/$(SAF_REV)/Default/%\ # pod2html method: batch, but cleaner. # # Uses an intermediate directory tree to hold all the docs, then # dresses and http-izes as needed. Note that we convert the hrefs in # refs to .pm files to match our browsing scheme. # http/$(SAF_REV)/POD/%: mkpath "$@" pod2html "--infile=/usr/lib/perl5/$*" \ "--htmlroot=/safaridev/perl/$(SAF_REV)/POD/" | \ saf_http_out $(EXPIRES) -o "$@" # # Links in podtohtml output pages point to .html files, so redirect these # to point to a .pm file... I leave it here as an example of a redirect. # Note that we need to put some text in the body to keep cgimake from # complaining about unmade targets... # #http/POD/%.html: POD/%.html # mkpath "$@" # echo "New location: $*.pm" | \ # add_headers --no-http-present "--Location=${notdir $*.pm}" > "$@" #.PHONY: POD/build #http/POD/build: # rm -rf POD # mkpath "$@" # podtohtml -S -d "POD" -i "POD/index.html" mux >/tmp/perllibPODbuild 2>&1 # cat /tmp/perllibPODbuild | \ # plain_html | \ # dress_my_perl_lib "--path=$@" | \ # add_headers --no-http-present --Content-type=text/html > "$@" # # Handle directory listings. Note that we need two entries for each # view, one for the project root and one for dirs under root. # http_dir/$(SAF_REV)/$(SAF_FILTER)/index.html: /usr/lib/perl5 ls_html "$<" | \ saf_http_out --file-type=html -o "$@" http_dir/$(SAF_REV)/$(SAF_FILTER)/%/index.html: /usr/lib/perl5/% ls_html "$<" | \ saf_http_out --file-type=html -o "$@" # # Utility functions... # .PHONY: http/clean http/clean: rm -rfv http > /tmp/perllibclean 2>&1 rm -rfv http_dir >> /tmp/perllibclean 2>&1 rm -rfv lock >> /tmp/perllibclean 2>&1 rm -rfv mux >> /tmp/perllibclean 2>&1 cat /tmp/perllibclean | \ saf_http_out /tmp/perllibclean -o "$@"