[net.sources] Compress release 3.0 : sample Makefile

ken@turtlevax.UUCP (Ken Turkowski) (01/05/85)

In the compress 3.0 source recently posted to mod.sources, there is a
#define variable which can be set for optimum performance on a machine
with a large amount of memory.  A program (usermem) to calculate the
useable amount of physical user memory is enclosed, as well as a sample
4.2bsd Vax Makefile for compress.

-----------------------------------------------------------------

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# Makefile usermem

echo x - Makefile
cat > "Makefile" << '//E*O*F Makefile//'
# if you have bugs in your C compiler dont use -O
COMFLAGS=-DBSD4_2 -O -DSACREDMEM=256000
BIN=/usr/bin

compress : compress.c USERMEM
	cc $(COMFLAGS) -DUSERMEM=`cat USERMEM` -o compress compress.c

# USERMEM may have to be set by hand.  It should contain the amount of
# available user memory in bytes.  Set it to zero, for physical memory
# less than 1 Meg.
USERMEM:
	sh usermem > USERMEM

install: compress
	cp compress $BIN
	rm -f $BIN/uncompress $BIN/zcat
	ln $BIN/compress $BIN/uncompress
	ln $BIN/compress $BIN/zcat
//E*O*F Makefile//

echo x - usermem
cat > "usermem" << '//E*O*F usermem//'
: This shell script snoops around to find the maximum amount of available
: user memory.  These variables need to be set only if there is no
: /usr/adm/messages.  KMEM, UNIX, and CLICKSIZE can be set on the command
: line, if desired, e.g. UNIX=/unix
KMEM=/dev/kmem		# User needs read access to KMEM
UNIX=
# VAX			CLICKSIZE=512,	UNIX=/vmunix
# PDP-11		CLICKSIZE=64,	UNIX=/unix
# CADLINC 68000		CLICKSIZE=4096,	UNIX=/unix
# Perkin-Elmer 3205	CLICKSIZE=4096,	UNIX=/edition7
# Perkin-Elmer all others, CLICKSIZE=2048, UNIX=/edition7
CLICKSIZE=512
eval $*

SIZE=0
if test -r /usr/adm/messages	# probably the most transportable
then
    SIZE=`grep avail /usr/adm/messages | sed -n '$s/.*[ 	]//p'`
fi

if test 0$SIZE -le 0		# no SIZE in /usr/adm/messages
then
    if test -r $KMEM		# Readable KMEM
    then
	if test -n "$UNIX"
	then
	    : User must have specified it already.
	elif test -r /vmunix
	then
	    UNIX=/vmunix
	    CLICKSIZE=512	# Probably VAX
	elif test -r /edition7
	then
	    UNIX=/edition7
	    CLICKSIZE=2048	# Perkin-Elmer: change to 4096 on a 3205
	elif test -r /unix
	then
	    UNIX=/unix		# Could be anything
	fi
	if test -n "$UNIX"
	then
	    SIZE=`echo maxmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ 	]//p'`
	    if test 0$SIZE -le 0
	    then
		SIZE=`echo physmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ 	]//p'`
	    fi
	    SIZE=`expr 0$SIZE '*' $CLICKSIZE`
	fi
    fi
fi

if test 0$SIZE -le 0
then
    echo 0
else
    echo $SIZE
fi
//E*O*F usermem//

echo Possible errors detected by \'sum\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
14495     1 Makefile
42168     2 usermem
!!!
sum  Makefile usermem | sed 's=[^ ]*/==' | diff -b $temp -
exit 0

--
Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,nsc,spar}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.ARPA
-- 
Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,nsc,spar}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.ARPA