# $XFree86: doctools/Makefile,v 1.10 1998/11/01 12:25:09 dawes Exp $

SHELL = /bin/sh

PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
INSTALL = install
INSTALLCMD = $(INSTALL) -c
EXTRALIBS =
CC = cc
CDEBUGFLAGS = -O
CXX = c++
CXXDEFS = -fno-implicit-templates
CXXDEBUGFLAGS = -O2
RANLIB = ranlib
# perl 5 is best
PERLCMD = /usr/local/bin/perl

# Use this for SVR4/Solaris
#INSTALL = /usr/ucb/install
#RANLIB = :

# Use this for SVR4
#EXTRALIBS = -lnsl

# If the OS doesn't have POSIX regex, use the version provided here
#REGEXDIR = regex
#REGEXLIB = -lregex

# To force gcc/g++
#CC = gcc
#CXX = g++

SGMLCAT = $(PREFIX)/share/sgml/catalog
JADEDEFINES = -DSGML_CATALOG_FILES_DEFAULT=\"${PREFIX}/share/sgml/catalog\"

SUBDIRS = $(REGEXDIR) docbook iso8879 jade linuxdoc sgmlformat

MDEFS = 'PREFIX=$(PREFIX)' 'prefix=$(PREFIX)' 'INSTALL=$(INSTALL)' \
	'INSTALLCMD=$(INSTALLCMD)' 'BINDIR=$(BINDIR)' 'PERLCMD=$(PERLCMD)' \
	'CXX=$(CXX) $(CXXDEFS) $(CXXDEBUGFLAGS)' \
	'CC=$(CC)' 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'EXTRALIBS=$(EXTRALIBS)' \
	'RANLIB=$(RANLIB)' 'JADEDEFINES=$(JADEDEFINES)' \
	'REGEXLIB=$(REGEXLIB)'

all:
	mydir=`pwd`; \
	for i in $(SUBDIRS); do \
	  echo "Making all in $$i ..."; \
	  cd $$i; $(MAKE) $(MDEFS) TOPDIR=$$mydir all; \
	  cd $$mydir; \
	done

install:
	mydir=`pwd`; \
	for i in $(SUBDIRS); do \
	  echo "Installing in $$i ..."; \
	  cd $$i; $(MAKE) $(MDEFS) TOPDIR=$$mydir install; \
	  cd $$mydir; \
	done

clean:
	mydir=`pwd`; \
	for i in $(SUBDIRS); do \
	  echo "Cleaning in $$i ..."; \
	  cd $$i; $(MAKE) TOPDIR=$$mydir clean; \
	  cd $$mydir; \
	done

