#  Copyright (c) 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
#  ALL RIGHTS RESERVED
#
#  Makefile to: build motif books
#
#  $Header:$


DOC_DIRS	= \
    aes man programGuide releaseNotes styleGuide usersGuide
LIBDIR		= /project/tools/libdata
LOOK		= -d
BOOK_FMT_ARGS	= $(LOOK) -libdir "$(LIBDIR)" $(TYPESET_OPT) $(EXTRA_ARGS)

ER_no_LIBDIR	= "LIBDIR must be defined on command line - no default!"

all: ascii ps
#all: Check ps ascii

ps:
	@for d in $(DOC_DIRS) ; do ( \
	    if [ ! -d $$d ]; then echo "Directory $$d not found"; exit 1; fi;\
	    echo ""; echo "-- building doc in $$d as $@ --"; date; \
		cd $$d ; \
		book-format -t $(BOOK_FMT_ARGS) all ) \
	    done

ascii:
	@for d in $(DOC_DIRS) ; do ( \
	    if [ ! -d $$d ]; then echo "Directory $$d not found"; exit 1; fi;\
	    echo ""; echo "-- building doc in $$d as $@ --"; date; \
		cd $$d ; \
		book-format -n $(BOOK_FMT_ARGS) all ) \
	    done

install:
	echo ""
	echo "This Makefile does not install man pages."
	echo "Use the DTE install-ref command instead."
	echo "See the README file in DTE/tools/src/installref."

longnames:
	echo ""
	echo "This Makefile does not expand man page names."
	echo "Use the DTE install-ref command instead."
	echo "See the README file in DTE/tools/src/installref."

clean:
	-@for d in $(DOC_DIRS) ; \
	    do ( echo ""; echo "--- $@ in $$d ---"; cd $$d; \
		rm -rf Sync core *~ )\
	    done
clobber:
	-@for d in $(DOC_DIRS) ; \
	    do ( echo ""; echo "--- $@ in $$d ---"; cd $$d; \
		rm -rf Sync core *~ Output )\
	    done


# a bit of a hack
Check:
	@sh -c 'if [ -z "$(LIBDIR)" -a -z "${DTE_LIBDIR}" ]; \
	    then echo #(ER_no_LIBDIR) ;\
	    exit 1 ; \
	else true ; fi'

