#******************************************************************************
#
#  This software is distributed as is, without any warranty of any kind,either
#  express or implied as further specified in the GNU Public License.
#  This software may be used and distributed according to the terms of the
#  GNU Public License.
#
#******************************************************************************
#
# SRL makefile
#

#
# Revision History:
#
# When       Who   What
# 09/06/00   DNA   First cut
# 11/01/00   RJT   Second hack
#

MAKE_ECHO= -s	# Suppresses make command echos; comment out for verbose

ifndef CHIP_TYPE
#
# Chip type (pick one)
#
#CHIP_TYPE= UB5805
#CHIP_TYPE= UB5820
CHIP_TYPE= UB582x
endif

export CHIP_TYPE # Pass the chip type on to OS-specific makefile

#
# Driver type (leave defined or comment out) 
#
#DRIVER_TYPE= UBSEC_DEBUG

export DRIVER_TYPE # Pass the driver type on to OS-specific makefile

#
# Try to determine whether or not we're running on an SMP kernel.
# We'll do this by examining the kernel version and release strings from uname.
# Just in case this fails, we define a default SMP status
#

DEFAULT_SMP_STATUS:=0# A UniProcessor kernel

ifeq ($(shell `echo uname -a` | grep -i SMP),$(shell `echo uname -a`))
  SMP_STATUS:=1# uname string contains "smp", set SMP_STATUS
endif

ifndef SMP_STATUS
  SMP_STATUS:=$(DEFAULT_SMP_STATUS)# If no positive ID of SMP machine
endif

export SMP_STATUS # Pass the SMP answer on to OS-specific makefile

#
# Try to positively identify the OS. Keep the first match.
#

# See if OSTYPE contains "bsd" (case insensitive)
ifndef THIS_OSTYPE
  ifneq ($(shell echo $(OSTYPE) | grep -i bsd),)
    THIS_OSTYPE= bsd
    MAKE=gmake
  endif
endif

# See if OSTYPE contains "linux" (case insensitive)
ifndef THIS_OSTYPE
  ifneq ($(shell uname -a | grep -i linux),)
    THIS_OSTYPE= Linux
    MAKE=make
  endif
endif

# See if OSTYPE contains "vxworks" (case insensitive)
ifndef THIS_OSTYPE
  ifneq ($(shell echo $(OSTYPE) | grep -i vxworks),)
    THIS_OSTYPE= vxworks
  endif
endif

# See if uname contains "SunOS" (case insensitive)
ifndef THIS_OSTYPE
  ifneq ($(shell uname -a | grep -i SunOS),)
    THIS_OSTYPE= solaris
    MAKE=gmake
  endif
endif

all clean rebuild:
ifndef THIS_OSTYPE
	@echo Cannot determine OSTYPE
	@exit 1
endif
ifndef CHIP_TYPE
	@echo Cannot determine CHIP_TYPE
	@exit 1
endif
	@$(MAKE) $(MAKE_ECHO) -f Makefile.$(THIS_OSTYPE) $@















