# Generated automatically from Makefile.in by configure.
###########################################################################
##      Copyright (C) 1995,1996,1997 University of Oxford                ##
##                                                                       ##
## Permission to use, copy, modify, and distribute this software,        ##
## and to incorporate it, in whole or in part, into other software,      ##
## is hereby granted without fee, provided that                          ##
##   (1) the above copyright notice and this permission notice appear in ##
##       all copies of the source code, and the above copyright notice   ##
##       appear in clearly visible form on all supporting documentation  ##
##       and distribution media;                                         ##
##   (2) modified versions of this software be accompanied by a complete ##
##       change history describing author, date, and modifications made; ##
##       and                                                             ##
##   (3) any redistribution of the software, in original or modified     ##
##       form, be without fee and subject to these same conditions.      ##
###########################################################################

###########################################################################
##            D O N T  C H A N G E  A N Y T H I N G  !!                  ##
###########################################################################

SHELL    =/bin/sh
VERSION  = 1.4
TARDIR   = "/tmp/"

prefix     = /afs/cad.njit.edu/u/a/l/alexg/BSP
exec_prefix= ${prefix}
mandir     = ${prefix}/man
bindir     = ${exec_prefix}/bin
includedir = ${prefix}/include
libdir     = ${exec_prefix}/lib
top_srcdir = .

PERL             = /usr/bin/perl
BSP_ONLINE_PROCS = 1
INSTALL          = ./install-sh -c
INSTALL_PROGRAM  = ${INSTALL}
INSTALL_DATA     = ${INSTALL} -m 644
NROFF            = /usr/bin/nroff
CATMAN           = /usr/bin/catman
DAVINCI          = 


###########################################################################
all:
	@echo "Starting to build on `uname -a`";        \
	make tools; 					\
        make libs;					\
	make cgprof;					\
	make nearlyfinishedbanner

libs:
	@(cd build;                                     \
         make all);                                     \
	(cd build/`bsparch -arch`/library_shared;	\
	 make build);					\
	if test `bsparch -device` = "MPASS_TCPIP" ||    \
           test `bsparch -device` = "MPASS_UDPIP" ||    \
           test `bsparch -device` = "MPASS_3C905B"; then\
	  (cd build/`bsparch -arch`/library_now;        \
	   make build );                                \
	fi;					        \
	if test `bsparch -device` = "MPASS_TCPIP"; then \
	  (cd build/`bsparch -arch`/library_tcpip;      \
	   make build );                                \
	fi;					        \
	if test `bsparch -device` = "MPASS_UDPIP"; then \
	  (cd build/`bsparch -arch`/library_udpip;      \
	   make build );                                \
	fi;					        \
	if test `bsparch -device` = "MPASS_3C905B"; then\
	  (cd build/`bsparch -arch`/library_udpip;      \
	   make BUILD_EXTRAS="-DMPASS_3C905B" build );  \
	  (cd build/`bsparch -arch`/library_kernel;     \
	   make build );                                \
	fi;					        \
        (cd build/`bsparch -arch`/library_cpr;          \
         make build );					\
	(cd build/`bsparch -arch`/library_core;		\
         make build );                                  \
	(cd build/`bsparch -arch`/library_level1;	\
         make build );
        
     
tools:
	@echo "Installing BSPlib compilation tools";    \
        (cd bin;                              		\
         make clean;                                    \
         make includedir="/`pwd`/../include/"           \
              libdir="/`pwd`/../lib/"                   \
              bindir="/`pwd`/" all)

cgprof:
	@if test -n "${DAVINCI}"; then			\
	  echo "Installing Call graph profiling";       \
          (cd build/`bsparch -arch`/cgprof;		\
	   make clean;					\
	   make build);					\
	fi
    

install: 
	@rm -f ${top_srcdir}/include/.bspinstalled;		\
	touch ${top_srcdir}/include/.bspinstalled;		\
	if [ ! -f ${includedir}/.bspinstalled ]; then		\
	  for i in bspfront_inc ctime.pl bsp_parameters.ascii 	\
		   lit.sty t3d_bsp.cld t3e_bsp.cld 		\
		   bsp.h fbsp.h bsp_level1.h fbsp_level1.h      \
                   cgprof.tcl FSBox.tcl piecrunch.tcl; do	\
	    ${INSTALL_PROGRAM} include/$$i ${includedir}/$$i;	\
	  done;							\
	  if [ ! -d ${includedir}/icons ] ;                     \
          then  mkdir -p ${includedir}/icons; fi;               \
          if test -n "${DAVINCI}"; then				\
	    for i in comm.xbm comp.xbm compress.xbm  		\
	             wait.xbm delete.xbm help.xbm hrel.xbm      \
		     jump.xbm oxpara.xbm percent.xbm            \
                     weightdelta.xbm absolute.xbm absdelta.xbm  \
                     reldelta.xbm sync.xbm time.xbm             \
                     uncompress.xbm undo.xbm; do                \
	      ${INSTALL_DATA} include/icons/$$i                 \
                              ${includedir}/icons/$$i;          \
            done;                                               \
          fi;                                                   \
        fi;							\
        (cd bin; make clean; make install);			\
	rm -f ${top_srcdir}/man/.bspinstalled;			\
	touch ${top_srcdir}/man/.bspinstalled;			\
	if [ ! -f ${mandir}/.bspinstalled ]; then		\
	  make installman;					\
	fi;							\
	rm -f ${top_srcdir}/lib/.bspinstalled;			\
	touch ${top_srcdir}/lib/.bspinstalled;			\
	if [ ! -f ${libdir}/.bspinstalled ]; then		\
	  make installlibs;					\
	fi;                                                     \
        make finishedbanner


tar:
	(cd ..;                                           \
         tar cvfX ${TARDIR}/v${VERSION}_bsplib_toolset.tar \
                BSP/exclude-tar                           \
		BSP/configure                             \
		BSP/install-sh				  \
		BSP/Makefile.in	                          \
		BSP/contrib/programs/bsp_probe		  \
		BSP/contrib/programs/bsplib_progs	  \
                BSP/man                                   \
		BSP/v${VERSION}_bsplib.ANNOUNCE           \
	        BSP/v${VERSION}_bsplib.README.ps.gz       \
		BSP/lib/Makefile 	                  \
		BSP/build/Makefile 	                  \
		BSP/build/install-sh			  \
		BSP/bin 		                  \
		BSP/include		                  \
		BSP/src)

gotar:
	(cd ..;						  \
         tar cvf ${TARDIR}/bsplib_toolset_${VERSION}_`bsparch -arch`.tar \
		BSP/Makefile 	                          \
		BSP/bsplib_${VERSION}.ANNOUNCE            \
	        BSP/bsplib_${VERSION}.README.ps           \
		BSP/lib/Makefile 	                  \
                BSP/lib/`bsparch -arch`                   \
		BSP/build/Makefile 	                  \
		BSP/bin 		                  \
		BSP/include)

installman:
	if test -n "${NROFF}" && test -n "${CATMAN}"; then      \
	  for i in man/man1/*.1; do				\
	    ${INSTALL_DATA} $$i ${mandir}/man1/`basename $$i`;	\
	  done;							\
	  for i in man/man3/*.3; do				\
	    ${INSTALL_DATA} $$i ${mandir}/man3/`basename $$i`;	\
	  done;							\
          if test `bsparch -arch` = "HP"; then	 		\
            (cd ${mandir};catman -m  13;catman -w -m  13);	\
	  else							\
	    (cd ${mandir};catman -M ./ 1 3;catman -w -M ./ 1 3);\
	  fi;						        \
        else                                                    \
          for i in man/cat1/*.1; do				\
	    ${INSTALL_DATA} $$i ${mandir}/cat1/`basename $$i`;	\
	  done;							\
	  for i in man/cat3/*.3; do				\
	    ${INSTALL_DATA} $$i ${mandir}/cat3/`basename $$i`;	\
	  done;                                                 \
        fi;

installlibs:
	if [ ! -d ${libdir}/`bsparch -arch`/`bsparch -device` ];	\
        then mkdir -p ${libdir}/`bsparch -arch`/`bsparch -device`;fi;	\
	touch ${libdir}/`bsparch -arch`/bspfront.dir;			\
	touch ${libdir}/`bsparch -arch`/bspfront.pag;			\
	chmod a+rw ${libdir}/`bsparch -arch`/bspfront.dir;		\
	chmod a+rw ${libdir}/`bsparch -arch`/bspfront.pag;		\
        for i in libbsplevel1_O0.a 					\
		 libbsplevel1_O1.a 					\
		 libbsplevel1_O2.a; do					\
	  ${INSTALL_DATA} $(top_srcdir)/lib/`bsparch -arch`/$$i		\
                          $(libdir)/`bsparch -arch`/$$i;		\
	done;								\
	for i in libbspcore.a 						\
		 libbspcore_G0.a libbspcore_G1.a libbspcore_G2.a	\
		 libbspcore_O0.a libbspcore_O1.a libbspcore_O2.a	\
		 libbspcore_P0.a libbspcore_P1.a libbspcore_P2.a	\
                 libbspcore_g0.a libbspcore_g1.a libbspcore_g2.a; do	\
	  ${INSTALL_DATA} 						\
	    $(top_srcdir)/lib/`bsparch -arch`/`bsparch -device`/$$i	\
            $(libdir)/`bsparch -arch`/`bsparch -device`/$$i;		\
	done;                                                           \
	if test `bsparch -device` = "MPASS_3C905B"; then	        \
           ${INSTALL_DATA}                                              \
              $(top_srcdir)/lib/`bsparch -arch`/libbspudpip3c905b.a     \
              $(libdir)/`bsparch -arch`/libbspudpip3c905b.a;            \
        fi;								\
	if test `bsparch -device` = "MPASS_UDPIP"; then	                \
           ${INSTALL_DATA}                                              \
              $(top_srcdir)/lib/`bsparch -arch`/libbspudpip.a           \
              $(libdir)/`bsparch -arch`/libbspudpip.a;                  \
        fi;								\
	if test `bsparch -device` = "MPASS_TCPIP"; then		        \
           ${INSTALL_DATA}                                              \
              $(top_srcdir)/lib/`bsparch -arch`/libbsptcpip.a           \
              $(libdir)/`bsparch -arch`/libbsptcpip.a;                  \
        fi;

nearlyfinishedbanner:
	@echo "=====================================================";   \
        echo  "== The installation of BSPLib has _nearly_ finished==";   \
        echo  "== To complete the installation type:              ==";   \
        echo  "==                                                 ==";   \
        echo  "==    unix> make install                           ==";   \
        echo  "==                                                 ==";   \
        echo  "== This will change the scripts in BSP/bin so that ==";   \
        echo  "== they have the correct library and directory     ==";   \
        echo  "== information within them. If you have not made   ==";   \
        echo  "== a self-contained installation, it will also     ==";   \
        echo  "== copy the libraries, scripts, and executables    ==";   \
        echo  "== into the appropriate directories.               ==";   \
        echo "=====================================================";

finishedbanner:
	@echo "=====================================================";   \
        echo  "== The installation of BSPLib has now finished. If ==";   \
        echo  "== you havn't already subscribed to the Oxford BSP ==";   \
        echo  "== Toolset mailing list, please send  an email     ==";   \
        echo  "== to bsplib-users-request@comlab.ox.ac.uk         ==";   \
        echo  "==                                                 ==";   \
        echo  "== Information, sample programs, and tutorials on  ==";   \
        echo  "== BSPlib can be found at the following WWW site   ==";   \
        echo  "== http://www.bsp-worldwide.org/implmnts/oxtool/   ==";   \
        echo "=====================================================";

clean:
	@echo "This will not remove the libraries and binaries."	\
	 echo "Use make veryclean to remove the build directory";	\
	(cd src/library_core; make clean);				\
	(cd src/cgprof; make clean);					\
	(cd src/library_tcpip; make clean);				\
	(cd src/library_level1; make clean);				\
	(cd build/`bsparch -arch`/library_core; make clean);		\
	(cd build/`bsparch -arch`/cgprof; make clean);			\
	(cd build/`bsparch -arch`/library_tcpip; make clean);		\
	(cd build/`bsparch -arch`/library_level1; make clean)

veryclean:
	if [ -d build/`bsparch -arch` ];  	\
	then rm -r -f build/`bsparch -arch`; 	\
        fi	

