#
#	Makefile for rbak
#
SHELL	= /bin/sh
MAKE	= make

BINMODE	= 4755
BINUID	= root
#BINGID	= staff
BINGID	= bin
BINDIR	= /usr/local/bin

MANMODE	= 644
MANUID	= root
#MANGID	= staff
MANGID	= bin
MANSEC	= 1
#MANDIR	= /usr/local/man/man$(MANSEC)
MANDIR	= /usr/share/catman/local/cat$(MANSEC)

DOCDIR	= ../doc
INCLDIR	= ../include

OPTIONS	= -O	# -g
INCLUDES= -I$(INCLDIR)
DEFINES	= # -DDEBUGSWAP -DDEBUGTYPE -DDEBUGDUMP
CFLAGS	= $(OPTIONS) $(DEFINES) $(INCLUDES)

LDFLAGS	=	# -g
LIBS	=

LINT	= lint
LINTFLAGS = $(INCLUDES)

SRC	= rbak.c ansitape.c remote.c remove.c sio.c error.c
OBJ	= rbak.o ansitape.o remote.o remove.o sio.o error.o

all:	rbak

netbsd:
	$(MAKE) "CC = gcc" "OPTIONS = -O2 -m486 -Wall"

rbak:	$(OBJ)
	$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o rbak

rbak.o:		$(INCLDIR)/lang.h
rbak.o:		$(INCLDIR)/std.h
rbak.o:		$(INCLDIR)/sio.h
rbak.o:		$(INCLDIR)/char.h
rbak.o:		$(INCLDIR)/str.h
rbak.o:		$(INCLDIR)/order.h
rbak.o:		$(INCLDIR)/lim.h
rbak.o:		$(INCLDIR)/dio.h
rbak.o:		$(INCLDIR)/finfo.h
rbak.o:		$(INCLDIR)/pathnames.h
rbak.o:		$(INCLDIR)/timestamp.h
rbak.o:		$(INCLDIR)/format.h
rbak.o:		$(INCLDIR)/rbak.h
rbak.o:		$(INCLDIR)/ansitape.h
rbak.o:		$(INCLDIR)/remove.h
rbak.o:		$(INCLDIR)/error.h

ansitape.o:	$(INCLDIR)/lang.h
ansitape.o:	$(INCLDIR)/std.h
ansitape.o:	$(INCLDIR)/sio.h
ansitape.o:	$(INCLDIR)/char.h
ansitape.o:	$(INCLDIR)/str.h
ansitape.o:	$(INCLDIR)/order.h
ansitape.o:	$(INCLDIR)/lim.h
ansitape.o:	$(INCLDIR)/dio.h
ansitape.o:	$(INCLDIR)/timestamp.h
ansitape.o:	$(INCLDIR)/tape.h
ansitape.o:	$(INCLDIR)/format.h
ansitape.o:	$(INCLDIR)/ansitape.h
ansitape.o:	$(INCLDIR)/remote.h
ansitape.o:	$(INCLDIR)/error.h

remote.o:	$(INCLDIR)/lang.h
remote.o:	$(INCLDIR)/std.h
remote.o:	$(INCLDIR)/var.h
remote.o:	$(INCLDIR)/sio.h
remote.o:	$(INCLDIR)/char.h
remote.o:	$(INCLDIR)/str.h
remote.o:	$(INCLDIR)/lim.h
remote.o:	$(INCLDIR)/dio.h
remote.o:	$(INCLDIR)/pathnames.h
remote.o:	$(INCLDIR)/sig.h
remote.o:	$(INCLDIR)/sock.h
remote.o:	$(INCLDIR)/net.h
remote.o:	$(INCLDIR)/passwd.h
remote.o:	$(INCLDIR)/remote.h
remote.o:	$(INCLDIR)/error.h

remove.o:	$(INCLDIR)/lang.h
remove.o:	$(INCLDIR)/std.h
remove.o:	$(INCLDIR)/char.h
remove.o:	$(INCLDIR)/str.h
remove.o:	$(INCLDIR)/lim.h
remove.o:	$(INCLDIR)/dio.h
remove.o:	$(INCLDIR)/finfo.h
remove.o:	$(INCLDIR)/remove.h
remove.o:	$(INCLDIR)/error.h

sio.o:		$(INCLDIR)/lang.h
sio.o:		$(INCLDIR)/std.h
sio.o:		$(INCLDIR)/var.h
sio.o:		$(INCLDIR)/sio.h

error.o:	$(INCLDIR)/lang.h
error.o:	$(INCLDIR)/std.h
error.o:	$(INCLDIR)/sio.h
error.o:	$(INCLDIR)/error.h

install:	installbin installman

installbin:	rbak
#	install -c -s -m $(BINMODE) -o $(BINUID) -g $(BINGID) rbak $(BINDIR)
	install -m $(BINMODE) -u $(BINUID) -g $(BINGID) -F $(BINDIR) rbak

#installman:	$(DOCDIR)/rbak.man
#	install -c -m $(MANMODE) -o $(MANUID) -g $(MANGID) $(DOCDIR)/rbak.man $(MANDIR)/rbak.$(MANSEC)

$(DOCDIR)/rbak.z:
	cp $(DOCDIR)/rbak.txt $(DOCDIR)/rbak
	rm -f $(DOCDIR)/rbak.z
	pack $(DOCDIR)/rbak
installman:	$(DOCDIR)/rbak.z
	install -O -m $(MANMODE) -u $(MANUID) -g $(MANGID) -F $(MANDIR) -src $(DOCDIR)/rbak.z rbak.z
	rm -f $(DOCDIR)/rbak.z

lint:
	$(LINT) $(LINTFLAGS) $(DEFINES) $(SRC)

clean:
	rm -f $(OBJ) rbak core

realclean:	clean
veryclean:	clean
spotless:	clean
clobber:	clean
