##
##  Copyright 1989 BBN Systems and Technologies Corporation.
##  All Rights Reserved.
##  This is free software, and may be distributed under the terms of the
##  GNU Public License; see the file COPYING for more details.
##
##  Makefile for CODA server and BSD client.
##  This is the master Makefile.
##  $Header: Makefile,v 2.0 90/04/02 16:46:30 rsalz Exp $
##
SHELL	= /bin/sh
DEFS	= -DBSD
CFLAGS	= -g $(DEFS)

##  Server files.
S_SRC	= server.c version.c gram.c lex.c adt.c log.c file.c
S_OBJ	= server.o version.o gram.o lex.o adt.o log.o file.o

##  Client files.
C_SRC	= client.c version.c libbsd.c
C_OBJ	= client.o version.o libbsd.o


##  Generic targets.
all:		codaserver coda

install:	all
	@echo Install according to local convention

clean:
	rm -f *.o y.* foo core lint? tags a.out codaserver coda SHAR0?
realclean:	clean
	rm -f lex.c gram.c gram.h


##  Lint.
lint:		lints lintc

lintc:		coda
	lint $(DEFS) -a -h -z $(C_SRC) | fgrep -v 'pointer alignment' >lintc
lints:		codaserver
	lint $(DEFS) -a -h -z $(S_SRC) | fgrep -v 'pointer alignment' >lints


##  Publication.
shar:
	makekit -n SHAR -m
	@rm -f MANIFEST.BAK

##  Server.
codaserver:	$(S_OBJ)
	@rm -f codaserver
	$(CC) $(CFLAGS) -o codaserver $(S_OBJ)

$(S_OBJ):	server.h

lex.c:			lex.l
lex.o gram.o:		gram.h
gram.h gram.c:		gram.y
	@rm -f y.tab.c y.tab.h gram.c gram.h
	yacc -d gram.y
	@mv y.tab.c gram.c
	@mv y.tab.h gram.h


##  Client.
coda:		$(C_OBJ)
	@rm -f coda
	$(CC) $(CFLAGS) -o coda $(C_OBJ)

$(C_OBJ):	client.h

version.o:	patchlevel.h


##  Saber
.SUFFIXES:		.c .src
.c.src:
	#load $(CFLAGS) $<
sabers:			$(S_SRC)
	#load $(CFLAGS) $(S_SRC)
saberc:			$(C_SRC)
	#load $(CFLAGS) $(C_SRC)
