# $Id: Makefile,v 2.5.4.1 1993/03/10 19:44:02 steve Exp $
#
# Root Makefile for the XGKS package.

#
#	Anticipated, changeable macros (others might not work):
#
#		File protection modes for installed files:
#
BINMODE	= 775#		Programs
INCMODE	= 664#		Header-files
LIBMODE	= 664#		Libraries (both shared and unshared)
MANMODE	= 664#		man(1) pages

#
#		Compilation options:
#
COPTS	= -O -I$(OPENWINHOME)/include  # C compiler options (e.g. "-g", "-DDEBUG")
FOPTS	= -O#			Fortran compiler options (e.g. "-g")

#		Commands:
#
#FC	= f77#			Fortran compiler.  Unset => make(1) default.
#				Set to empty string => platform doesn't have
#				a Fortran compiler.
INSTALL	= install#		An install(1)-like command. Must understand
#				"-c" (copy) and "-m" (mode) options.  Under AIX,
#				this is /usr/ucb/install rather than
#				/usr/bin/install.  If you don't have install(1),
#				then try using install.sh in this directory.
RANLIB	= ranlib#		A ranlib(1)-like command.  If one doesn't exist
#				on your platform, then define it as "touch".
TBL	= tbl#			A tbl(1)-like command
TROFF	= ptroff#		A troff(1)-like command

#		The root destination-directory.  It's assumed to
#		to contain "bin", "include", "lib", and "man" 
#		subdirectories.  "/usr/local" is a possible candidate.
#
DESTDIR	= /usr/local #/ldm

#		The type of libraries to create.  Possible values are
#		"sharable" and "nonsharable".  If a makefile doesn't
#		know how to create a sharable library on the given
#		platform, then it will create a non-sharable one.
#
LIBTYPE	= sharable

#		The type of operating-system.  Known values include
#			aix_3.1,
#			domainos_10.{2,3.{2,5}}
#			nextos_2.0,
#			hpux_8.0,
#			sunos_4.{0.3,1{,.1}},
#			ultrix_4.{0,1,2}, and
#			unicos_5.1.{9,11}.
#		Needed if sharable-libraries are to be created.
#
OS	= sunos_4.1.1

#
#	End of anticipated macros
#

MY_MFLAGS	= \
		BINMODE="$(BINMODE)" \
		COPTS="$(COPTS)" \
		DESTDIR="$(DESTDIR)" \
		FC="$(FC)" \
		FOPTS="$(FOPTS)" \
		INCMODE="$(INCMODE)" \
		INSTALL="$(INSTALL)" \
		LIBMODE="$(LIBMODE)" \
		LIBTYPE="$(LIBTYPE)" \
		MANMODE="$(MANMODE)" \
		OS="$(OS)" \
		RANLIB="$(RANLIB)" \
		TBL="$(TBL)" \
		TROFF="$(TROFF)"

BINDIR		= $(DESTDIR)/bin
INCDIR		= $(DESTDIR)/include
LIBDIR		= $(DESTDIR)/lib
MANDIR		= $(DESTDIR)/man

SUBDIRS	= lib fontdb progs doc

all:	_lib _fontdb _progs _doc

install:	$(BINDIR) $(INCDIR) $(LIBDIR) \
		$(MANDIR) $(MANDIR)/man1 $(MANDIR)/man3
	@$(MAKE) $(MFLAGS) $(MY_MFLAGS) TARGET=install all

clean:
	@$(MAKE) $(MFLAGS) $(MY_MFLAGS) TARGET=clean all
	rm -f core *.log *.bak

$(BINDIR) $(INCDIR) $(LIBDIR) $(MANDIR) $(MANDIR)/man1 $(MANDIR)/man3:
	mkdir $@

_lib:
	@echo 'Changing to directory lib/'
	@cd lib; \
	$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(TARGET)

_fontdb:
	@echo 'Changing to directory fontdb/'
	@cd fontdb; \
	$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(TARGET)

_progs:
	@echo 'Changing to directory progs/'
	@cd progs; \
	$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(TARGET)

_doc:
	@echo 'Changing to directory doc/'
	@cd doc; \
	$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(TARGET)
