Samplefa Makefile

From DLXS Documentation

Revision as of 10:48, 30 September 2007 by Cboulay (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Main Page > Mounting Collections: Class-specific Steps > Mounting a Finding Aids Collection > Preparing Data and Directories > Samplefa Makfile


NAMEPREFIX = samplefa
FIRSTLETTERSUBDIR = s
# --------------------------------------------------
OBJDIR = /l1/release/13/obj/$(FIRSTLETTERSUBDIR)/$(NAMEPREFIX)/
IDXDIR = /l1/release/13/idx/$(FIRSTLETTERSUBDIR)/$(NAMEPREFIX)/
PREPDIR = /l1/release/13/prep/$(FIRSTLETTERSUBDIR)/$(NAMEPREFIX)/
DATADIR = /l1/release/13/prep/$(FIRSTLETTERSUBDIR)/$(NAMEPREFIX)/data/

COLLBINDIR = /l1/release/13/bin/$(FIRSTLETTERSUBDIR)/$(NAMEPREFIX)/
BINDIR = /l1/release/13/bin/t/text/

XMLFILE = $(OBJDIR)$(NAMEPREFIX).xml

# --------------------------------------------------
XMLDOCTYPE = $(PREPDIR)$(NAMEPREFIX).xml.inp
# --------------------------------------------------
XMLDECL = /l1/release/13/misc/sgml/xml.dcl
# --------------------------------------------------
XPATBINDIR = /l/local/bin/
XPATBLD = $(XPATBINDIR)xpatbldu
XPATEXEC = $(XPATBINDIR)xpatu
SGMLRGN = $(XPATBINDIR)sgmlrgn
MULTIRGN = $(XPATBINDIR)multirgn
XMLRGN = $(XPATBINDIR)xmlrgn
# Use OpsnSP 1.5 or higher
OSX = /l/local/bin/osx
OSGMLNORM = /l/local/bin/osgmlnorm


VALIDATEEACHSCRIPT = $(PREPDIR)validateeach.csh

# --------------------------------------------------
# Set these environment variables so that onsgmls osgmlnorm
# will use XML rules to determin input encoding and output 
# UTF-8

# Enable XML all the time: The multibyte version of OpenSP can 
# operate in a mode in which the internal character set does not
# vary with the document character set, but is always a fixed
# character set, known as the system character set; this mode of
# operation is called fixed character set mode.  
export SP_CHARSET_FIXED=YES

# This specifies the default encoding when operating in fixed
# character set mode. The value must be the name of an available
# encoding. The default encoding cannot be document character set
# relative when operating in fixed character set mode. On input,
# this uses XML's rules to determine the encoding. On output, this
# uses UTF-8.
export SP_ENCODING=XML

# ---------------------------------------------------------------------
# We are forced to use this pseudo-target to ignore errors from osx in
# the 'norm' target below because we're using an xml decl to parse the
# output of osgmlnorm to turn sgml singletons into xml singletons.  In
# spite of the error, osx seems to run to completion and produce correct
# output 
#
.IGNORE:

### ----------------------------------------------------------------------
### validate each file individually (easier to find errors that way)
validateeach:
        $(VALIDATEEACHSCRIPT)


all: prepdocs validate norm singledd xml post

### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
###       Now check .err files in data dir
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

### ----------------------------------------------------------------------
### fix up docs
prepdocs:
        $(COLLBINDIR)preparedocs.pl $(DATADIR) $(XMLFILE) $(PREPDIR)logfile.txt
### ----------------------------------------------------------------------

## ----------------------------------------------------------------------
## validate one last time for luck
validate:
        onsgmls -wxml -s -f $(PREPDIR)$(NAMEPREFIX).errors $(XMLDECL) $(XMLDOCTYPE) $(XMLFILE)
## ----------------------------------------------------------------------

## ----------------------------------------------------------------------
## ensure attribute order matches DTD (required for xmlrgn) and that 
## singletons have the form <foo/> not <foo>
norm:
        cp $(XMLFILE) $(XMLFILE).prenorm
        $(OSGMLNORM) -f $(PREPDIR)$(NAMEPREFIX).errors $(XMLDECL) $(XMLDOCTYPE) $(XMLFILE).prenorm > $(XMLFILE).postnorm
        $(OSX) -bUTF-8 -xlower -xempty -xno-nl-in-tag -f $(PREPDIR)$(NAMEPREFIX).errors $(XMLDECL) $(XMLDOCTYPE) $(XMLFILE).postnorm > $(XMLFILE).postnorm.osx 
        cp $(XMLFILE).postnorm.osx $(XMLFILE)

## ----------------------------------------------------------------------

## ----------------------------------------------------------------------
## have xpat index everything as a single file
singledd:
        cp $(PREPDIR)$(NAMEPREFIX).blank.dd $(IDXDIR)$(NAMEPREFIX).dd
        $(XPATBLD) -m 256m -D $(IDXDIR)$(NAMEPREFIX).dd
        cp $(IDXDIR)$(NAMEPREFIX).dd $(PREPDIR)$(NAMEPREFIX).presgml.dd
## ----------------------------------------------------------------------

## ----------------------------------------------------------------------
## index the sgml using xmlrgn -- validates and indexes with SGML declaration.
xml:
        cp $(PREPDIR)$(NAMEPREFIX).presgml.dd $(IDXDIR)$(NAMEPREFIX).dd
        $(XMLRGN) -D $(IDXDIR)$(NAMEPREFIX).dd $(XMLDECL) $(XMLDOCTYPE) $(XMLFILE) 
        cp $(IDXDIR)$(NAMEPREFIX).dd $(PREPDIR)$(NAMEPREFIX).prepost.dd
## ----------------------------------------------------------------------


## ----------------------------------------------------------------------
post:
        cp $(PREPDIR)$(NAMEPREFIX).prepost.dd $(IDXDIR)$(NAMEPREFIX).dd
        touch $(IDXDIR)$(NAMEPREFIX).init
        $(XPATEXEC) -q $(IDXDIR)$(NAMEPREFIX).dd < $(PREPDIR)$(NAMEPREFIX).extra.srch | $(BINDIR)output.dd.frag.pl $(IDXDIR) > $(PREPDIR)$(NAMEPREFIX).extra.dd
        $(BINDIR)inc.extra.dd.pl $(PREPDIR)$(NAMEPREFIX).extra.dd $(IDXDIR)$(NAMEPREFIX).dd
## ----------------------------------------------------------------------
clean:
        rm -f $(PREPDIR)$(NAMEPREFIX).errors
        rm -f $(PREPDIR)$(NAMEPREFIX).presgml.dd
        rm -f $(PREPDIR)$(NAMEPREFIX).prepost.dd
        rm -f $(PREPDIR)$(NAMEPREFIX).extra.dd
        rm -f $(IDXDIR)$(NAMEPREFIX).dd
        rm -f $(IDXDIR)*.rgn
        rm -f $(IDXDIR)*.idx
        rm -f $(XMLFILE).prenorm
        rm -f $(XMLFILE).postnorm
        rm -f $(XMLFILE).postnorm.osx

Top

Personal tools