# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: The application programming interfaces
# established by SGI in conjunction with the Original Code are The
# OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
# April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
# 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
# Window System(R) (Version 1.3), released October 19, 1998. This software
# was created using the OpenGL(R) version 1.2.1 Sample Implementation
# published by SGI, but has not been independently verified as being
# compliant with the OpenGL(R) version 1.2.1 Specification.
#
# $XFree86$

# Common definitions for man page Makefiles

MMDOC	    = sh -x $(DEPTH)/tools/mmdoc
MPATH	    = $(DEPTH)/macros
GETNAMES    = awk -f $(DEPTH)/tools/getnames
ADDINST     = awk -f $(DEPTH)/tools/addinst
MAN2HTML    = $(DEPTH)/tools/man2html

# Global version and (published) date values for man page footers.  Can override
# for a particular directory by reassigning after the inclusion of mandefs.
VERSION     = Version 1.0
DATE	    = June 1991

#
# directories - these may exist under some or all of the man sections
# and correspond to option man pages
# we list them all here once

OPTIONS = standard nfs dwb trans ftn emacs pascal pl1 5080 ada t3270 pfa diags \
	  x11 xt noship sna sna_3770 sna_3270 sna_server sna_lu6.2 spaceball \
	  x25 netvis netman softpc c++ sna_lu0-3 bsdlpr 4DDN dgl gpib slip \
	  nonstandard libil pca t3270dft vc nqs seiko5500 vfr bvo tcp3270 \
	  smt sqa fddi fddivis cc cmplrs dbx edge ld efast cdrom gltools \
	  moregltools imagetools gldebug libsphere

# Change /pubs/tools symbolic name to $(MPATH) in .so's
FIXPUBS     = sed 's:^\.so[	 ]*/pubs/tools/:.so $(MPATH)/:'

# script to translate the first line of the manpage
# from '\"! tbl | eqn | mmdoc
# to '\" t e
# which is what the linux man command needs.

ifeq ($(OS),Linux)
FIXROFF = awk '/\\\"!/ { gsub(/!/, ""); \
			 gsub(/eqn/, "e"); \
			 gsub(/tbl/, "t"); \
			 gsub(/mmdoc/, ""); \
			 gsub(/\|/, ""); print $0; next; } { print $0; }'
else
FIXROFF = cat
endif

# Convert .TH lines to all uppercase when making online pages (mostly
# for GL man pages).  If line is .TH \*(}x, don't uppercase it.
THTOUPPER   = \
	sed '/^\.TH[^}]*$$/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'

# Add string definitions containing VERSION, DATE, and RELEASE (only
# the portion after the "-", if it exists) to man page input.  Also
# define strings with print date (i.e. "now"), last modified date of
# input file, and result of "sum <input file>".
ADDSTRINGS  = awk  'BEGIN { \
			first = 1; \
			if (split("$(RELEASE)", r, "-") > 1) \
			    release = r[2]; \
			else \
			    release="$(RELEASE)"; \
		    } \
		    first == 1 && $$0 !~ /^'"'"'\\"/ { \
			print ".ds Vn $(VERSION)"; \
			print ".ds Dt $(DATE)"; \
			print ".ds Re Release", release; \
			print ".ds Dp '"`date '+%b %d %H:%M'`"'"; \
			print ".ds Dm '"`ls -l $< | cut -c42-53`"'"; \
			print ".ds Xs '"`sum $<`"'"; \
			first = 0; \
		    } \
		    { print }'

# If page doesn't start with a magic '\", add a default one.
ADDMAGIC = ( case `head -1 $<` in \
	       "'\\\""*)	cat $< ;; \
	       _*) $(DEPTH)/tools/glman $(PREFIX) $(DEPTH) $< $(APIFILE) $(M4OPTS) ;; \
	       *)	echo "'\\\"macro stdmacro" ; cat $< ;; \
	     esac ) | $(FIXPUBS) | $(ADDSTRINGS) | $(FIXROFF)

# If GL page starts '\"!, second line is assumed to contain '\"macro stdmacro,
# and it is changed to '\"macro mn; if page doesn't start with '\",
# '\"macro mn is added (if it's not there already).  Only use the "mn"
# macros for hardcopy; online man pages use stdmacro like all other man pages.
ADDGLMAGIC = ( case `head -1 $<` in \
		 "'\\\"macro mn")	cat $< ;; \
		 "'\\\""!*)	sed '2 s/stdmacro/mn/' $< ;; \
		 _*) $(DEPTH)/tools/glman $(PREFIX) $(DEPTH) $< $(APIFILE) $(M4OPTS) ;; \
		 *)		echo "'\\\"macro mn" ; cat $< ;; \
	       esac ) | $(FIXPUBS) | $(ADDSTRINGS)

RUNMMDOC    = TMMACRO=$(MPATH) PATH=$(DEPTH)/tools:$$PATH \
	      OTHERFILES="$(MPATH)/Op $(LANGOPT) $(MPATH)/localmacs" \
	      $(MMDOC) $(MMFLAGS)


LEGALBASE  = [0-z+,%-]*#
LEGALSUF1  = [1-7]#
LEGALSUF2  = [1-7][a-z]#
LEGALSUF3  = [1-7]X11#
LEGALSUF4  = [1-7]Xt#
LEGALNAME1 = $(LEGALBASE).$(LEGALSUF1)#
LEGALNAME2 = $(LEGALBASE).$(LEGALSUF2)#
LEGALNAME3 = $(LEGALBASE).$(LEGALSUF3)#
LEGALNAME4 = $(LEGALBASE).$(LEGALSUF4)#
LISTLEGAL  = find . \( -name '$(LEGALNAME1)' -o -name '$(LEGALNAME2)' \
	     -o -name '$(LEGALNAME3)' -o -name '$(LEGALNAME4)' \) -print | \
	     sed -e 's/^..//' -e '/\//d'

#
# The following defintions are release-note specific.
#

# File that should be included before each chapter is formatted
CHAPHEAD = Templates/cFront

# Files that should be included before each appendix is formatted
APPDXHEAD = Templates/cFront Templates/aFront

# Between start and end put file names for generating
# the TC files in the right order.

BASE	   = ch*#
CHAPSUF    = cmm#
APPSUF	   = amm#

LEGALCHAP  = $(BASE).$(CHAPSUF)
LEGALAPP   = $(BASE).$(APPSUF)
RELNOTES   = find . \( -name '$(LEGALCHAP)' -o -name '$(LEGALAPP)' \) -print | \
	     sed -e 's/^..//' -e '/\//d' | sort

TCFILES = ToC/TC.start ToC/ch*.TC ToC/TC.end

MMFILES = `$(RELNOTES)`

IXFILES = Index/ch*.IX

CHAP_PP = pic $(CHAPHEAD) $? | tbl
APP_PP	= pic $(APPDXHEAD) $? | tbl

# these should to be macros, so they can be overridden
PSVIEWOPTS = -F1.2 -0,2-6,11
PSVIEW = psview
# this scale and geom works to show 6x9 pages on a 1280x1024
# display.
XPSVIEWOPTS = -wp -skipc -sc 1.1 -geom 660x1020 -
XPSVIEW = xpsview

# this can be used under X for previewing
DITVIEW = xditview -geom 640x950 -

