#
# Copyright (c) 1992 Michael A. Cooper.
# This software may be freely distributed provided it is not sold for 
# profit and the author is credited appropriately.
#
# $Header: /src/common/usc/bin/sysinfo/RCS/Makefile.ultrix4,v 1.1 1992/07/07 23:56:57 mcooper Exp mcooper $
#
# Sysinfo Makefile for Ultrix 4.*
#

#
# Location of your Kernel specific directory.
# This is usually only for SunOS.  If you don't have
# one, set this to nothing
#
KVM		=

#
# The bin directory that user's will run the program from.
# For systems with a $(KVM) (above), a symlink will be put 
# in $(BIN) pointing to ${KVM}/sysinfo.  On systems without 
# a $(KVM), the program will be copied to $(BIN).
#
# A good place is something like /usr/local/bin.
#
BIN 		= /usr/local/bin

#
# Directory to install man page in.
#
MAN 		= /usr/local/man/man1

#
# The name of the kvm library to use.
# For SunOS this should be "-lkvm".  If you don't have one, add
# "kvm.o" to MISSINGFILES below and leave LIBKVM blank.
#
LIBKVM		=

#
# SunOS 4.0 -> 4.0.3 requires using the System V cc and libc
# in order to get uname().
#
#CC		= /usr/5bin/cc
#LIBS 		= /usr/5lib/libc.a

#
# Defines.
#
# SunOS needs:
#	-D`/bin/arch -k`
#	define XYLOGICS_IPI if you have their SV-{6,7}8xx IPI controller
#
DEFINES		=

#
# Optimization or debugging flag
#
OPT		= -g

#
# Include directories
#
INCLUDES	= -I.

CFLAGS 		= ${OPT} ${INCLUDES} ${DEFINES}

NETIFFILES	= netif.o info-netif.o
#MACHFILES	= os-mach.o info-mach.o

#
# Select the OS specific files to compile
#
# SunOS
#OSFILES	= os-sunos.o info-sunos.o ${NETIFFILES}
# Ultrix
OSFILES		= os-ultrix.o info-ultrix.o ${NETIFFILES}
# NeXT
#OSFILES	= os-next.o info-next.o ${MACHFILES} ${NETIFFILES}
# Alliant
#OSFILES	= os-alliant.o info-alliant.o
# AIX
#OSFILES	= os-aix.o info-aix.o
# HP300's running 4.3BSD (MORE/bsd)
#OSFILES	= os-bsd43.o info-bsd43.o

#
# Missing files
#
# List of files of things your system may not have.
# This may include strcasecmp.o, strdup.o, and strerror.o.
# It may also include kvm.o if your system doesn't have an -lkvm.
#
MISSINGFILES	= strdup.o kvm.o

#
# Installation options
#
# Sysinfo needs to be able to read your unix image (/vmunix usually),
# /dev/kmem, and device files in /dev for things like disk drives and tapes.
# Under SunOS, /dev/kmem is owned by group "kmem", but the disk files
# (e.g. /dev/rsd0a) are owned by group "operator".  Therefor, you usually
# can't make setgid to a group, but need it setuid root.
#
# You should set the INSTALLOPTS appropriately to allow sysinfo to read
# everything it needs to.  Try running "sysinfo -debug" to find out the
# special files it reads.
#
INSTALLOPTS 	= -m 4555 -o root -g wheel

BASE 		= sysinfo
PROG 		= ${BASE}
OBJS 		= ${BASE}.o devices.o memory.o kernel.o run.o KVM.o options.o \
			${MISSINGFILES} ${OSFILES}

all: ${PROG}

${PROG}: ${OBJS}
	${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} ${LIBKVM}

install: ${PROG}
	@if [ "${KVM}" ]; then \
		echo "install -c ${INSTALLOPTS} ${PROG} ${KVM}/${BASE}"; \
		install -c ${INSTALLOPTS} ${PROG} ${KVM}/${BASE}; \
		echo "cd ${BIN} && rm -f ${BASE} && ln -s ${KVM}/${BASE} ${BASE}"; \
		(cd ${BIN} && rm -f ${BASE} && ln -s ${KVM}/${BASE} ${BASE}); \
	else \
		echo install -c ${INSTALLOPTS} ${PROG} ${BIN}/${BASE}; \
		install -c ${INSTALLOPTS} ${PROG} ${BIN}/${BASE}; \
	fi

install.man: ${BASE}.man
	install -c -m 444 -o bin -g bin ${BASE}.man ${MAN}/${BASE}.1

install.compat:
	install -c -m 555 -o bin -g bin cpumodel.sh /usr/lsd/etc/cpumodel
	rm -f $MAN/${BASE}.8 $MAN/cpumodel.1
	(cd /usr/usc/bin; rm -f sysinfo; ln -s ${BIN}/sysinfo)

clean:
	rm -f *.o ${PROG} *~ *% \#* core a.out sysinfo.tar sysinfo.tar.Z

${OBJS}: system.h defs.h
