#-*-ksh-*--------------------------------------------------------------
#  Makefile
# 
#   Makefile for ssTest Directory
# 
# (c) Copyright 1995  Hewlett-Packard Company.
# The contents of this software are proprietary and confidential to
# the Hewlett- Packard Company, and are limited in distribution to
# those with a direct need to know.  Individuals having access to
# this software are responsible for maintaining the confidentiality
# of the content and for keeping the software secure when not in use.
# Transfer to any party is strictly forbidden other than as expressly
# permitted in writing by Hewlett-Packard Company.  Unauthorized
# transfer to or possession by any unauthorized party may be a
# criminal offense.
# 
#		     RESTRICTED RIGHTS LEGEND
# 
#      Use,  duplication,  or disclosure by the Government  is
#      subject to restrictions as set forth in subdivision (b)
#      (3)  (ii)  of the Rights in Technical Data and Computer
#      Software clause at 52.227-7013.
# 
#			 HEWLETT-PACKARD COMPANY
#			 3000 Hanover St.
#			 Palo Alto, CA  94304
# 
# LINK ERRORS:
# 
#  If ld gives "target of unconditional branch out of range" errors,
#  you most likely need too upadate your system with path PHSS_5083.
# 
#  This problem seems to be made worse by many levels of nested
#  inlines.
#  
#  This same problem was HELPED (but not fixed) by fixing the order of
#  the files in the final link-compile step.  For all of the tests,
#  <testname>.o is listed before ssLib.o and any other modules it needs
#  to link in.
#
# TARGETS:
#
#  all:              All Tests
#  noDevTests:       Tests which may be run without a device.
#  destructiveTests: Tests which write to device object.
#  nsrTests:         Tests which require valid NSR disk in device.
#  clean:            Removes all executables and all .o files.
#
# COMPILER WARNINGS:
#
#  See tail of file for explanation
#
# ----------------------------------------------------------------------
# $Source: /projects/HMS/nsr/udfAncil/ssTest/Makefile,v $
# $Revision: 1.42 $	$Author: hmgr $
# $State: Exp $   	$Locker:  $
# $Date: 96/06/22 00:14:53 $

NSRDIR		= ../..
COREDIR		= $(NSRDIR)/udfCore
ANCILDIR	= $(NSRDIR)/udfAncil
CONFIGDIR  	= $(COREDIR)/config
SSDIR		= $(COREDIR)/ss
SYSDIR		= $(COREDIR)/sys
DEVDIR		= $(COREDIR)/devs
DESCRDIR	= $(COREDIR)/descr

INCLUDE_DIRS    = -I$(NSRDIR) -I$(DEVDIR) -I$(SYSDIR) -I$(COREDIR)

TESTS_NO_DISK	= barefTst simDvTst

TESTS_RAW_DISK	= devTest flipTest ntfTest srTest newsrTst nodeTest \
		  lelTest bmsrTest

TESTS_NSR_DISK	= adtTest deTest dlTest extTest volPrint

PURE_TESTS_NO_DISK	= PbarefTst PsimDvTst

PURE_TESTS_RAW_DISK	= PdevTest PflipTest PntfTest PsrTest PnewsrTst \
			  PnodeTest PlelTest PbmsrTest

PURE_TESTS_NSR_DISK	= PadtTest PdeTest PdlTest PextTest PvolPrint

#CXX= CC
CXX= g++

#CXXFLAGS= -g -DSSTEST -D_INCLUDE__STDC__ $(INCLUDE_DIRS) -DNSR_VERIFY $(OFLAGS) -I"/usr/local/include"
CXXFLAGS= -g -DSSTEST -D_INCLUDE__STDC__ $(INCLUDE_DIRS) \
	  -DNSR_VERIFY $(OFLAGS) -I"/usr/local/include" \
	  -DDEBUG
LOADER=/usr/local/lib/gcc-lib/hppa1.1-hp-hpux9.01/2.6.3/ld

# place extra options in macro below:
LIBFLAGS= $(CXXFLAGS) -D_NO_ALIASES_
TSTFLAGS= $(CXXFLAGS) -D_HP_ALIASES_ -D_HP_ENUM_ALIASES_

TEST_SOURCE=	\
		barefTst.cpp \
		simDvTst.cpp \
		devTest.cpp \
		flipTest.cpp \
		ntfTest.cpp \
		srTest.cpp \
		newsrTst.cpp \
		nodeTest.cpp \
		lelTest.cpp \
		bmsrTest.cpp \
		adtTest.cpp \
		deTest.cpp \
		dlTest.cpp \
		extTest.cpp \
		volPrint.cpp

INCLS=	\
	$(COREDIR)/nsrLib.h \
	$(CONFIGDIR)/nsrCfg.h \
	$(CONFIGDIR)/nsrTypdf.h \
	$(CONFIGDIR)/nsrAlias.h \
	$(SYSDIR)/nsrError.h \
	$(SYSDIR)/nsrAux.h \
	$(SYSDIR)/nsrTrace.h \
	$(DESCRDIR)/nsrAttr.h \
	$(SYSDIR)/nsrDebug.h \
	$(DESCRDIR)/nsrTypes.h \
	$(DESCRDIR)/nsrRecog.h \
	$(DESCRDIR)/nsrVol.h \
	$(DESCRDIR)/nsrEA.h \
	$(DESCRDIR)/nsrFile.h \
	$(SSDIR)/nsrExt.h \
	$(SSDIR)/nsrDir.h \
	$(DEVDIR)/nsrscsi.h \
	$(DEVDIR)/RealSSdv.h \
	$(DEVDIR)/nsrASSdv.h \
	$(DEVDIR)/nsrRSSdv.h \
	$(DEVDIR)/moDevSim.h \
	$(SSDIR)/nsrSpace.h \
	$(SSDIR)/nsrEAttr.h \
	$(SSDIR)/nsrAEDWt.h \
	$(SSDIR)/nsrNode.h \
	$(SSDIR)/nsrSSVol.h

LIBSOURCES=\
	$(CONFIGDIR)/nsrStat.cpp \
	$(SYSDIR)/nsrError.cpp \
	$(SYSDIR)/nsrAux.cpp \
	$(SYSDIR)/nsrTrace.cpp \
	$(DESCRDIR)/nsrAttr.cpp \
	$(SYSDIR)/nsrDebug.cpp \
	$(DEVDIR)/nsrRSSdv.cpp \
	$(DESCRDIR)/nsrTypes.cpp \
	$(DESCRDIR)/nsrVol.cpp \
	$(DESCRDIR)/nsrEA.cpp \
	$(DESCRDIR)/nsrFile.cpp \
	$(SSDIR)/nsrExt.cpp \
	$(SSDIR)/nsrDir.cpp \
	$(SSDIR)/nsrSpace.cpp \
	$(SSDIR)/nsrEAttr.cpp \
	$(SSDIR)/nsrAEDWt.cpp \
	$(SSDIR)/nsrNode.cpp \
	$(SSDIR)/nsrSSVol.cpp

all:			$(TESTS_RAW_DISK) $(TESTS_NSR_DISK) $(TESTS_NO_DISK) \
			$(PURE_TESTS_RAW_DISK) $(PURE_TESTS_NSR_DISK) $(PURE_TESTS_NO_DISK)

noDevTests:		$(TESTS_NO_DISK)  
					  
destructiveTests:	$(TESTS_RAW_DISK) 
					  
nsrTests:		$(TESTS_NSR_DISK)

pureNoDevTests:         $(PURE_TESTS_NO_DISK) 
			                      
pureDestructiveTests:	$(PURE_TESTS_RAW_DISK)
			                      
pureNsrTests:		$(PURE_TESTS_NSR_DISK)

# First, the libraries

ssLib.o:	$(INCLS) $(LIBSOURCES) Makefile ssLib.cpp
	$(CXX) $(LIBFLAGS) -c ssLib.cpp 
		
# Then, the devices

nsrRSSdv.o:	$(INCLS) $(DEVDIR)/nsrRSSdv.cpp
	$(CXX) $(LIBFLAGS) -c $(DEVDIR)/nsrRSSdv.cpp

moDevSim.o:	$(INCLS) $(DEVDIR)/moDevSim.cpp
	$(CXX) $(LIBFLAGS) -c $(DEVDIR)/moDevSim.cpp

# Then, the tests.

barefTst.o:	$(INCLS) barefTst.cpp Makefile
	$(CXX) $(TSTFLAGS) -c barefTst.cpp

simDvTst.o:	$(INCLS) simDvTst.cpp Makefile
	$(CXX) $(TSTFLAGS) -c simDvTst.cpp

devTest.o:	$(INCLS) devTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c devTest.cpp

flipTest.o:	$(INCLS) flipTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c flipTest.cpp

ntfTest.o:	$(INCLS) ntfTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c ntfTest.cpp

srTest.o:	$(INCLS) srTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c srTest.cpp

newsrTst.o:	$(INCLS) newsrTst.cpp Makefile
	$(CXX) $(TSTFLAGS) -c newsrTst.cpp

nodeTest.o:	$(INCLS) nodeTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c nodeTest.cpp

lelTest.o:	$(INCLS) lelTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c lelTest.cpp

bmsrTest.o:	$(INCLS) bmsrTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c bmsrTest.cpp

adtTest.o:	$(INCLS) adtTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c adtTest.cpp

deTest.o:	$(INCLS) deTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c deTest.cpp

dlTest.o:	$(INCLS) dlTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c dlTest.cpp

extTest.o:	$(INCLS) extTest.cpp Makefile
	$(CXX) $(TSTFLAGS) -c extTest.cpp

volPrint.o:	$(INCLS) volPrint.cpp Makefile
	$(CXX) $(TSTFLAGS) -c volPrint.cpp

#
# First, the ones not requiring a real device
#

barefTst:	$(INCLS) barefTst.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o barefTst barefTst.o nsrRSSdv.o ssLib.o -lrwtool

PbarefTst:	$(INCLS) barefTst.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PbarefTst barefTst.o nsrRSSdv.o ssLib.o -lrwtool

simDvTst:	$(INCLS) simDvTst.o ssLib.o moDevSim.o Makefile
	$(CXX) $(TSTFLAGS) -o simDvTst simDvTst.o moDevSim.o ssLib.o -lrwtool

PsimDvTst:	$(INCLS) simDvTst.o ssLib.o moDevSim.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PsimDvTst simDvTst.o moDevSim.o ssLib.o -lrwtool

#
# Next, the ones requiring a raw device
#

devTest:	$(INCLS) devTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o devTest devTest.o nsrRSSdv.o ssLib.o  -lrwtool

PdevTest:	$(INCLS) devTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PdevTest devTest.o nsrRSSdv.o ssLib.o -lrwtool

flipTest:	$(INCLS) flipTest.o ssLib.o  nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o flipTest flipTest.o nsrRSSdv.o ssLib.o -lrwtool

PflipTest:	$(INCLS) flipTest.o ssLib.o  nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PflipTest flipTest.o nsrRSSdv.o ssLib.o -lrwtool

ntfTest:	$(INCLS) ntfTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o ntfTest ntfTest.o nsrRSSdv.o ssLib.o  -lrwtool

PntfTest:	$(INCLS) ntfTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PntfTest ntfTest.o nsrRSSdv.o ssLib.o  -lrwtool

srTest:		$(INCLS) srTest.o ssLib.o  nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o srTest srTest.o nsrRSSdv.o ssLib.o -lrwtool

PsrTest:	$(INCLS) srTest.o ssLib.o  nsrRSSdv.o Makefile
	purify -force_rebuild -repair_dead_branches -no_link ld \
	 srTest.o nsrRSSdv.o ssLib.o
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PsrTest \
	 srTest.o nsrRSSdv.o ssLib.o -lrwtool

newsrTst:	$(INCLS) newsrTst.o ssLib.o  nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o newsrTst newsrTst.o nsrRSSdv.o ssLib.o -lrwtool

PnewsrTst:	$(INCLS) newsrTst.o ssLib.o  nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PnewsrTst newsrTst.o nsrRSSdv.o ssLib.o -lrwtool

nodeTest:	$(INCLS) nodeTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o nodeTest nodeTest.o nsrRSSdv.o ssLib.o -lrwtool

PnodeTest:	$(INCLS) nodeTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PnodeTest nodeTest.o nsrRSSdv.o ssLib.o -lrwtool

lelTest:	$(INCLS) lelTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o lelTest lelTest.o nsrRSSdv.o ssLib.o  -lrwtool

PlelTest:	$(INCLS) lelTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PlelTest lelTest.o nsrRSSdv.o ssLib.o  -lrwtool

bmsrTest:	$(INCLS) bmsrTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o bmsrTest bmsrTest.o nsrRSSdv.o ssLib.o  -lrwtool

PbmsrTest:	$(INCLS) bmsrTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PbmsrTest bmsrTest.o nsrRSSdv.o ssLib.o  -lrwtool

#
# Now, the tests which require a loaded valid NSR disk.
# NOTE: Recommended that write-protect be set.
#

adtTest:	$(INCLS) adtTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o adtTest adtTest.o nsrRSSdv.o ssLib.o -lrwtool

PadtTest:	$(INCLS) adtTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PadtTest adtTest.o nsrRSSdv.o ssLib.o -lrwtool

deTest:	$(INCLS) deTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o deTest deTest.o nsrRSSdv.o ssLib.o  -lrwtool

PdeTest:	$(INCLS) deTest.o ssLib.o nsrRSSdv.o Makefile
	purify -force_rebuild -repair_dead_branches -no_link ld \
	 deTest.o nsrRSSdv.o ssLib.o 
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PdeTest \
	 deTest.o nsrRSSdv.o ssLib.o  -lrwtool

dlTest:	$(INCLS) dlTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o dlTest dlTest.o nsrRSSdv.o ssLib.o  -lrwtool

PdlTest:	$(INCLS) dlTest.o ssLib.o nsrRSSdv.o Makefile
	purify -force_rebuild -repair_dead_branches -no_link ld \
	 dlTest.o nsrRSSdv.o ssLib.o 
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PdlTest \
	 dlTest.o nsrRSSdv.o ssLib.o  -lrwtool

extTest:	$(INCLS) extTest.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o extTest extTest.o nsrRSSdv.o ssLib.o -lrwtool

PextTest:	$(INCLS) extTest.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PextTest extTest.o nsrRSSdv.o ssLib.o -lrwtool

volPrint:	$(INCLS) volPrint.o ssLib.o nsrRSSdv.o Makefile
	$(CXX) $(TSTFLAGS) -o volPrint volPrint.o nsrRSSdv.o ssLib.o  -lrwtool

PvolPrint:	$(INCLS) volPrint.o ssLib.o nsrRSSdv.o Makefile
	purify -collector=$(LOADER) \
	 $(CXX) $(TSTFLAGS) -o PvolPrint volPrint.o nsrRSSdv.o ssLib.o  -lrwtool

clean:
	rm -f $(TESTS_NO_DISK) $(TESTS_RAW_DISK) $(TESTS_NSR_DISK) *.o

CHECK_UTIL = ../../tools/findsym.pl

check: $(INCLS) $(LIBSOURCES) $(TEST_SOURCE) Makefile
	$(CHECK_UTIL) $?

