# Makefile for the X backend to XGKS
#
# $__Header$
#
# $__copyright$

# Anticipated, changeable macros (others might not work):
COPTS	= -O
DESTDIR	= /usr/local/ldm#	assumed to contain "bin", "include",
#				"lib", and "man" subdirectories
LIBTYPE	= sharable#		"nonsharable" or "sharable"
OS	= sunos_4.1.1
RANLIB	= ranlib

# End of anticipated macros

# The following macro is for passing the above, "anticipated" macros to
# make(1)s invoked by this makefile (i.e. recursive make(1)s).
# 
# There is, however, a problem.  The placement of macro re-definitions on
# a make(1) command-line is significant: when more than one definition
# for a given macro is given, the one that takes effect depends on the
# peculiarities of the particular make(1).  For example, the SunOS 4.1
# make(1) takes the last re-definition, whereas the 4.0.3 make(1) takes
# the first.  Consequently, those actions in this makefile that need to
# redefine certain macros, do not use the macro MY_MFLAGS; instead
# they explicitly reproduce the following list.  Therefore, if you add or
# remove macros from this list, be sure to do the same to those actions
# just mentioned.  Also, don't attempt to redefine any of the following
# macros on a make(1) command-line if you also use the MY_MFLAGS macro on
# the command-line.
#
MY_MFLAGS	= \
		COPTS="$(COPTS)" \
		DESTDIR="$(DESTDIR)" \
		LIBTYPE="$(LIBTYPE)" \
		OS="$(OS)" \
		RANLIB="$(RANLIB)"

# Directories:
LIBDIR		= $(DESTDIR)/lib
INCDIR		= $(DESTDIR)/include
FONTDBDIR	= $(LIBDIR)/xgksfonts
X11_INCDIR	= $${OPENWINHOME-/usr}/include

UNICOS_INC	= `case $(OS) in unicos*) echo -I/usr/include/stdc;; esac`
INCLUDES	= -I.. -I$(INCDIR)/udposix -I$(X11_INCDIR) $(UNICOS_INC)
DEFINES		=
CPPOPTS		= $(INCLUDES) $(DEFINES)
CFLAGS		= $(CPPOPTS) $(COPTS)
SHELL		= /bin/sh

CSRCS		= xSet.c xcellarray.c xcolours.c xevent.c xfillarea.c \
		xinqpixel.c xopws.c xpline.c xpmarker.c xport.c xtext.c \
		xupdate.c

LNS		= xSet.ln xcellarray.ln xcolours.ln xevent.ln xfillarea.ln \
		xinqpixel.ln xopws.ln xpline.ln xpmarker.ln xport.ln xtext.ln \
		xupdate.ln

HSRCS		=

SOURCES		= $(CSRCS) $(HSRCS) Makefile

OBJECTS		= xSet.o xcellarray.o xcolours.o xevent.o xfillarea.o \
		xinqpixel.o xopws.o xpline.o xpmarker.o xport.o xtext.o \
		xupdate.o

.PHONY:         all install clean

all:		$(LIBTYPE)_lib

install:

clean:
	rm -f *.o core *.log *.ln

nonsharable_lib:
	@$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(OBJECTS)

sharable_lib:
	@case "$(OS)" in \
	    sunos*) \
		$(MAKE) $(MFLAGS) \
		    COPTS="$(COPTS) -pic" \
		    DESTDIR="$(DESTDIR)" \
		    LIBTYPE="$(LIBTYPE)" \
		    OS="$(OS)" \
		    RANLIB="$(RANLIB)" \
		    $(OBJECTS);; \
	    *) \
		$(MAKE) $(MFLAGS) $(MY_MFLAGS) $(OBJECTS);; \
	esac

lint:		$(LNS)
	lint -nuz $$lins -lansic -lposix 2>&1

.SUFFIXES:	.o .ln .c

#
# The following implicit rule allows the user to conveniently set the
# DEFINES macro.
#
.c.o:
	$(CC) $(CFLAGS) -DOS_`echo $(OS) | sed 's/_.*//'` -c $<

.c.ln:
	lint -nuz $(CPPOPTS) -c $< -lansic -lposix 2>&1

tags:		$(CSRCS) $(HSRCS)
	ctags -t $(CSRCS) $(HSRCS)

.DEFAULT:
	co $@

xSet.o: xSet.c
xSet.o: ../gks_implem.h
xSet.o: ../xgks.h
xSet.o: ../gks_defines.h
xSet.o: ../primitive.h
xSet.o: ../input.h
xSet.o: ../wdt.h
xSet.o: ../wslist.h
xSet.o: ../gkslist.h
xSet.o: ../gks_errors.h
xSet.o: ../event.h
xcellarray.o: xcellarray.c
xcellarray.o: ../gks_implem.h
xcellarray.o: ../xgks.h
xcellarray.o: ../gks_defines.h
xcellarray.o: ../primitive.h
xcellarray.o: ../input.h
xcellarray.o: ../wdt.h
xcellarray.o: ../wslist.h
xcellarray.o: ../gkslist.h
xcellarray.o: ../gks_errors.h
xcellarray.o: ../event.h
xcolours.o: xcolours.c
xcolours.o: ../gks_implem.h
xcolours.o: ../xgks.h
xcolours.o: ../gks_defines.h
xcolours.o: ../primitive.h
xcolours.o: ../input.h
xcolours.o: ../wdt.h
xcolours.o: ../wslist.h
xcolours.o: ../gkslist.h
xcolours.o: ../gks_errors.h
xcolours.o: ../event.h
xevent.o: xevent.c
xevent.o: ../gks_implem.h
xevent.o: ../xgks.h
xevent.o: ../gks_defines.h
xevent.o: ../primitive.h
xevent.o: ../input.h
xevent.o: ../wdt.h
xevent.o: ../wslist.h
xevent.o: ../gkslist.h
xevent.o: ../gks_errors.h
xevent.o: ../event.h
xfillarea.o: xfillarea.c
xfillarea.o: ../gks_implem.h
xfillarea.o: ../xgks.h
xfillarea.o: ../gks_defines.h
xfillarea.o: ../primitive.h
xfillarea.o: ../input.h
xfillarea.o: ../wdt.h
xfillarea.o: ../wslist.h
xfillarea.o: ../gkslist.h
xfillarea.o: ../gks_errors.h
xfillarea.o: ../event.h
xinqpixel.o: xinqpixel.c
xinqpixel.o: ../gks_implem.h
xinqpixel.o: ../xgks.h
xinqpixel.o: ../gks_defines.h
xinqpixel.o: ../primitive.h
xinqpixel.o: ../input.h
xinqpixel.o: ../wdt.h
xinqpixel.o: ../wslist.h
xinqpixel.o: ../gkslist.h
xinqpixel.o: ../gks_errors.h
xinqpixel.o: ../event.h
xopws.o: xopws.c
xopws.o: ../gks_implem.h
xopws.o: ../xgks.h
xopws.o: ../gks_defines.h
xopws.o: ../primitive.h
xopws.o: ../input.h
xopws.o: ../wdt.h
xopws.o: ../wslist.h
xopws.o: ../gkslist.h
xopws.o: ../gks_errors.h
xopws.o: ../event.h
xpline.o: xpline.c
xpline.o: ../gks_implem.h
xpline.o: ../xgks.h
xpline.o: ../gks_defines.h
xpline.o: ../primitive.h
xpline.o: ../input.h
xpline.o: ../wdt.h
xpline.o: ../wslist.h
xpline.o: ../gkslist.h
xpline.o: ../gks_errors.h
xpline.o: ../event.h
xpmarker.o: xpmarker.c
xpmarker.o: ../gks_implem.h
xpmarker.o: ../xgks.h
xpmarker.o: ../gks_defines.h
xpmarker.o: ../primitive.h
xpmarker.o: ../input.h
xpmarker.o: ../wdt.h
xpmarker.o: ../wslist.h
xpmarker.o: ../gkslist.h
xpmarker.o: ../gks_errors.h
xpmarker.o: ../event.h
xport.ln: xport.c
xport.o: xport.c
xport.o: ../gks_implem.h
xport.o: ../xgks.h
xport.o: ../gks_defines.h
xport.o: ../primitive.h
xport.o: ../input.h
xport.o: ../wdt.h
xport.o: ../wslist.h
xport.o: ../gkslist.h
xport.o: ../gks_errors.h
xport.o: ../event.h
xport.o: ../metafile.h
xtext.o: xtext.c
xtext.o: ../gks_implem.h
xtext.o: ../xgks.h
xtext.o: ../gks_defines.h
xtext.o: ../primitive.h
xtext.o: ../input.h
xtext.o: ../wdt.h
xtext.o: ../wslist.h
xtext.o: ../gkslist.h
xtext.o: ../gks_errors.h
xtext.o: ../event.h
xtext.o: ../font.h
xupdate.o: xupdate.c
xupdate.o: ../gks_implem.h
xupdate.o: ../xgks.h
xupdate.o: ../gks_defines.h
xupdate.o: ../primitive.h
xupdate.o: ../input.h
xupdate.o: ../wdt.h
xupdate.o: ../wslist.h
xupdate.o: ../gkslist.h
xupdate.o: ../gks_errors.h
xupdate.o: ../event.h
