# $Id: Makefile,v 1.9 1991/10/08 18:24:27 steve Exp $
#
# Makefile for the XGKS C and FORTRAN libraries.

# Anticipated, changeable macros (others might not work):
COPTS	= -O
DESTDIR	= /usr/local/ldm#	assumed to contain "bin", "include",
#				"lib", and "man" subdirectories
#FC	= f77#			Fortran compiler.  Unset => make(1) default.
#				Set to empty string => platform doesn't have
#				a Fortran compiler.
FOPTS	= -O
INCMODE	= 644
INSTALL	= install
LIBMODE	= 664
LIBTYPE	= sharable#	"nonsharable" or "sharable"
OS	= sunos_4.1
RANLIB	= ranlib

# End of anticipated macros

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

#
#	The "src" subdirectory is first because the creation of a 
#	sharable Fortran library under the AIX operating system 
#	requires the C XGKS runtime library to already exist.
#

all:		_src
	@-if [ -n "$(FC)" ]; then \
	    $(MAKE) $(MFLAGS) $(MY_MFLAGS) TARGET="$(TARGET)" _fortran; \
	fi

install:
	@$(MAKE) $(MFLAGS) $(MY_MFLAGS) TARGET=install all

clean:
	@$(MAKE) $(MFLAGS) $(MY_MFLAGS) TARGET=clean all

_src:
	@cd src; \
	    echo "Making '$(TARGET)' in `pwd`"; \
	    $(MAKE) $(MFLAGS) $(MY_MFLAGS) $(TARGET)

_fortran:
	@cd fortran; \
	    echo "Making '$(TARGET)' in `pwd`"; \
	    PATH=$${PATH}:$(DESTDIR)/bin \
		$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(TARGET)
