Makefile #4

  • //
  • guest/
  • barrie_slaymaker/
  • safari/
  • src/
  • conf/
  • perllib/
  • Makefile
  • View
  • Commits
  • Open Download .zip Download (4 KB)
#
# 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 "$@"
# Change User Description Committed
#4 187 Barrie Slaymaker Added lots of options to saf_http_out to let the source file
       be used to figure out file type for determining filter and
       tool menus.  Changed Makefiles to pass the original source file
       name in to saf_http_out.

       Added --PRE to saf_http_out.  This is good for displaying plain
       text versions of HTML files.

       Improved the tool and filter logic in Safari::Edit::p4.pm to work
       with original file type to determine what makes sense for what kind
       of file. This really needs to be generalized in to a config file
       instead of being buried in a module.

       Increased usage of HTML::Entities::encode_entities instead of s///g .

       Moved Content-type: header to after the edit() routine call and
       now we pass and recover mime-type as an option.

       Added SAF_TARGET to environment under cgimake,

       Fixed updirectory counting, which broke when cgimake started
       parsing the project name from PATH_INFO.

       Removed all edit routines from saf_http_out.conf files.

       NOTE: we can now fall back to a single cgimake.conf file. Any day now.
#3 168 Barrie Slaymaker Added YAPC paper, slides
#2 165 Barrie Slaymaker Applied Greg KH's license patch.
#1 162 Barrie Slaymaker First code & documentation checkin