#-----------------------------------------------------------------------------
# Makefile - baseline make, drives others
#
# Copyrighted as an unpublished work.
# (c) Copyright 1991 SBE, Inc. and by other vendors under license agreements.
# All Rights Reserved.
#-----------------------------------------------------------------------------
# RCS info:
# RCS revision: $Revision: 1.1 $
# Last changed on $Date: 92/08/24 09:36:34 $
# Changed by $Author: vimal $
#-----------------------------------------------------------------------------
# $Log:	Makefile,v $
# Revision 1.1  92/08/24  09:36:34  vimal
# added x25trace and x25map in the utils list.
# 
# Revision 1.0  92/08/20  11:36:27  root
# Initial revision
# 
#-----------------------------------------------------------------------------
# 

##############################################################################
# SPECIAL SYSTEM / INSTALLATION SPECIFIC INFORMATION
#
# A specific system will have any special parameters defined via the following
# variables.  (Special kernel generation parameters will not be included herein
# but will exist in "io/Makefile".)

### The PRODUCT1 and PRODUCT2, if they exist, specify which product the generic
### driver is to support.  Current choices are "SBE_TCPIP" and/or "SBE_X25".

PRODUCT1=SBE_TCPIP
PRODUCT2=SBE_X25

### The "SYSTEM" variable is passed to every file so that system specific
### code and structures are correct.

SYSTEM=VPU30

### Collect the above parameters into the DPARMS parameter.  DPARMS is
### passed into most of the following 'make's.

DPARMS="-D$(SYSTEM) -D$(PRODUCT1) -D$(PRODUCT2)"

### Different choices may exist for the utility installation directories.
### These are passed down via the "TCPDIRS" variable from this Makefile.

### Standard TCP library location
LIBDIR="/usr/lib"
### Standard Daemon location only
TCPDDIR="/etc"
### Standard utilities location only
TCPUDIR="/usr/bin"

TCPDIRS=TCPDDIR=$(TCPDDIR) TCPUDIR=$(TCPUDIR)

##############################################################################
# The exhastive set of utilities and demonstration programs for this system.

UTILS = tcputils \
	x25utils/lib \
	x25utils/pad \
	x25utils/vcomdl \
	x25utils/x25stat \
	x25utils/x25trace \
	x25utils/x25map \
	x25utils/xcf \
	vcutils/getmjr \
	vcutils/vld \
	vcutils/vcom

DEMO  = x25utils/x25demo/lapb \
	x25utils/x25demo/wan \
	x25utils/x25demo/x25

MISC  = etc \
	stand \
	mkdev

all:  driver utils demo

#=============================================================================
# INSTALLATION SECTION
# NOTE: demo programs are NOT installed ...

install: all misc
	@echo ">> Installing VCOM driver and utilities ..."
	@cd io ; make install DPARMS=$(DPARMS) ; cd ..
	@for TARGET in $(UTILS) ; \
	do \
		if [ -d $$TARGET ] ; \
		then \
			echo "$$TARGET: " ; \
			(cd $$TARGET ; make DPARMS=$(DPARMS) $(TCPDIRS) install); \
		fi \
	done
	@echo ">> Installation script completed."

misc:
	@echo ">> Installing Miscellaneous files ..."
	@for TARGET in $(MISC) ; \
	do \
		echo "$$TARGET: " ; \
		(cd install ; \
			export LIBDIR TCPDDIR TCPUDIR ; \
			LIBDIR=$(LIBDIR) ; TCPDDIR=$(TCPDDIR) ; TCPUDIR=$(TCPUDIR) ; \
			sh install.sh $$TARGET); \
	done


#=============================================================================
# Special section for recompilation of kernel.  Remakes SBE Network Driver
# libraries, copies them up to kernel build area and fires off a 'sysgen'
# to create a new kernel.  Note that 'make all install' or 'sbe_instal'
# must have been run at some time prior to using 'make kernel' so that
# devices have been installed and enabled for the 'sysgen' mechanism.
#
# The following adheres to SBE's sbe-ux R3V1 system generation mechanism.

kernel: driver
	@cd io ; make DPARMS=$(DPARMS) install ; cd ..
	@cd /usr/src/uts/m68k ; make unix unixnm
	@echo ">> Kernel generation completed."


#=============================================================================
# COMPILATION SECTION

driver:
	@echo ">> Compiling VCOM driver ..."
	@cd io ; make DPARMS=$(DPARMS) ; cd ..

# Note that presence of a directory is checked.  Not all utilities
# may be available on all platforms or purchase agreements.
utils:
	@echo ">> Compiling VCOM utilities ..."
	@for TARGET in $(UTILS) ; \
	do \
		echo "$$TARGET: " ; \
		if [ -d $$TARGET ] ; \
		then \
			(cd $$TARGET ; make DPARMS=$(DPARMS) all) ; \
		else \
			echo "    $$TARGET not available." ; \
		fi \
	done

# Note that presence of a directory is checked.  Not all demo programs
# may be available on all platforms or purchase agreements.
demo:
	@echo ">> Compiling VCOM demonstration programs ..."
	@for TARGET in $(DEMO) ; \
	do \
		echo "$$TARGET: " ; \
		if [ -d $$TARGET ] ; \
		then \
			(cd $$TARGET ; make DPARMS=$(DPARMS) all) ; \
		else \
			echo "    $$TARGET not available." ; \
		fi \
	done

#=============================================================================
# CLEAN and CLOBBER SECTION

clean:
	@echo ">> Cleaning ..."
	@echo "driver: " ; (cd io ; make clean)
	@for TARGET in $(UTILS) $(DEMO) ; \
	do \
		if [ -d $$TARGET ] ; \
		then \
			echo "$$TARGET: " ; \
			(cd $$TARGET ; make clean) ; \
		fi \
	done

clobber:
	@echo ">> Clobbering ..."
	@echo "driver: " ; (cd io ; make clobber)
	@for TARGET in $(UTILS) $(DEMO) ; \
	do \
		if [ -d $$TARGET ] ; \
		then \
			echo "$$TARGET: " ; \
			(cd $$TARGET ; make clobber) ; \
		fi \
	done

#=============================================================================

# --- End-of-file --- #
