# $Copyright: $
# Copyright (c) 1995 by Steve Baker
# All Rights reserved
#
# This software is provided as is without any express or implied
# warranties, including, without limitation, the implied warranties
# of merchantability and fitness for a particular purpose.
#

CC=gcc

DEST=sac
RAW_DEST=rawtmp
BINDIR=/usr/local/bin
MANS=sac.8 rawtmp.1
MANDIR=/usr/man

all:	sac.o
	$(CC) -o $(DEST) sac.o -s

sac.o:	sac.c

rawtmp:	rawtmp.o
	$(CC) -o $(RAW_DEST) rawtmp.o -s

raw.o:	raw.c

clean:
	if [ -e $(DEST) ]; then rm $(DEST); fi
	if [ -e $(RAW_DEST) ]; then rm $(RAW_DEST); fi
	if [ -e sac.o -o -e raw.o ]; then rm *.o; fi

install:
	if [ -e $(DEST) ]; then \
		install $(DEST) $(BINDIR)/$(DEST); \
	fi
	if [ -e $(RAW_DEST) ]; then \
		install $(RAW_DEST) $(BINDIR)/$(RAW_DEST); \
	fi
	for man in $(MANS); do \
		m=`expr match $$man '.*\(.\)'`; \
		install $$man $(MANDIR)/man$$m/$$man; \
	done
