# 
#  Copyright 1990, 1991 by the Massachusetts Institute of Technology and
#  UniSoft Group Limited.
#  
#  Permission to use, copy, modify, distribute, and sell this software and
#  its documentation for any purpose is hereby granted without fee,
#  provided that the above copyright notice appear in all copies and that
#  both that copyright notice and this permission notice appear in
#  supporting documentation, and that the names of MIT and UniSoft not be
#  used in advertising or publicity pertaining to distribution of the
#  software without specific, written prior permission.  MIT and UniSoft
#  make no representations about the suitability of this software for any
#  purpose.  It is provided "as is" without express or implied warranty.
# 
#  $XConsortium: gtdflt.m,v 1.17 92/07/01 11:37:17 rws Exp $
#  
#
# Makefile for XGetDefault
#

SOURCES=gtdflt.m 
CFILES=Test.c 
OFILES=Test.o 
LOFILES=link.o 
LINKOBJ=gtdflt.o
LINKEXEC=gtdflt


AUXFILES=.Xdefaults Test3 Test4 Test5
AUXCLEAN=Test3 Test4 Test5 Test3.o Test4.o Test5.o .Xdefaults\
	.Xdefaults-$(XTESTHOST)

all: Test

.Xdefaults : Xdefaults HstXdefaults
	$(RM) .Xdefaults ./.Xdefaults-$(XTESTHOST)
	$(CP) Xdefaults .Xdefaults
	$(CP) HstXdefaults ./.Xdefaults-$(XTESTHOST)

Test3 : Test3.o $(LIBS) $(TCMCHILD)
	$(CC) $(LDFLAGS) -o $@ Test3.o $(TCMCHILD) $(LIBLOCAL) $(LIBS) $(SYSLIBS)

Test4 : Test4.o $(LIBS) $(TCMCHILD)
	$(CC) $(LDFLAGS) -o $@ Test4.o $(TCMCHILD) $(LIBLOCAL) $(LIBS) $(SYSLIBS)

Test5 : Test5.o $(LIBS) $(TCMCHILD)
	$(CC) $(LDFLAGS) -o $@ Test5.o $(TCMCHILD) $(LIBLOCAL) $(LIBS) $(SYSLIBS)

# $XConsortium: mmsa.mc,v 1.2 92/06/29 19:42:24 rws Exp $
#
# Build a standalone version of the test case.
#
Test: $(OFILES) $(LIBS) $(TCM) $(AUXFILES)
	$(CC) $(LDFLAGS) -o $@ $(OFILES) $(TCM) $(LIBLOCAL) $(LIBS) $(SYSLIBS)

Test.c: $(SOURCES)
	$(CODEMAKER) -o Test.c $(SOURCES)

# $XConsortium: mmlink.mc,v 1.2 92/06/29 19:42:10 rws Exp $
#
# A version of the test that can be combined together with
# all the other tests to make one executable.  This will save a
# fair amount of disk space especially if the system does not
# have shared libraries.  Different names are used so that
# there is no possibility of confusion.
#
link.c: $(SOURCES)
	$(CODEMAKER) -l -o link.c $(SOURCES)

# Link the objects into one large object.
#
$(LINKOBJ): $(LOFILES)
	$(LD) $(LINKOBJOPTS) $(LOFILES) -o $(LINKOBJ)

# Link the object file into the parent directory.
#
../$(LINKOBJ): $(LINKOBJ)
	$(RM) ../$(LINKOBJ)
	$(LN) $(LINKOBJ) ..

# Make a link to the combined executable.
#
$(LINKEXEC): ../Tests
	$(RM) $(LINKEXEC)
	$(LN) ../Tests $(LINKEXEC)

../Tests: ../$(LINKOBJ)

linkexec:: $(LINKEXEC) $(AUXFILES) ;

# $XConsortium: mmlib.mc,v 1.2 92/06/29 19:42:08 rws Exp $
# 
# This part of the makefile checks for the existance of the libraries
# and creates them if necessary.
#

# The xtestlib is made if it doesn't exist
#
$(XTESTLIB):
	cd $(XTESTROOT)/src/lib; $(TET_BUILD_TOOL) install

# The fontlib is made if it doesn't exist
#
$(XTESTFONTLIB):
	cd $(XTESTROOT)/fonts; $(TET_BUILD_TOOL) install

# $XConsortium: mmmisc.mc,v 1.3 92/06/29 19:42:14 rws Exp $
#
# Miscellaneous housekeeping functions.
#

# clean up and remove remakable sources, objects and junk files.
#
clean:
	$(RM) Test $(OFILES) $(LOFILES) $(LINKOBJ) $(LINKEXEC) core\
		MTest m$(LINKEXEC) $(MOFILES) CONFIG Makefile.bak $(AUXCLEAN)\
		MTest.c Test.c mlink.c link.c Makefile *.err

# clobber - aka clean.
#
clobber:	clean

# Lint makerules
#
lint: $(CFILES)
	$(LINT) $(LINTFLAGS) $(CFILES) $(LINTTCM) $(LINTLIBS)

LINT:lint

# $XConsortium: mmpgen.mc,v 1.2 92/06/29 19:42:21 rws Exp $
#
# Pixel generation makerules for generating the reference
# known good image files.
#

PVOFILES=pvtest.o

pvgen: $(PVOFILES) $(PVLIBS) $(TCM)
	$(CC) $(LDFLAGS) -o $@ $(PVOFILES) $(TCM) \
	$(PVLIBS) $(SYSLIBS) $(SYSMATHLIB)

pvtest.o: pvtest.c
	cc -c -DGENERATE_PIXMAPS $(CFLAGS) pvtest.c

pvtest.c: Test.c
	$(RM) pvtest.c; \
	$(LN) Test.c pvtest.c

