# $Id: Makefile,v 5.16.0.1 1993/03/25 04:36:22 eggert Exp $
# Copyright (C) 1982, 1988, 1989 Walter Tichy
# Copyright 1990, 1991 by Paul Eggert
#   Distributed under license by the Free Software Foundation, Inc.
#
# This file is part of RCS.
#
# RCS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# RCS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with RCS; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Report problems and direct all questions to:
#
#    rcs-bugs@cs.purdue.edu
#

#### Start of system configuration section. ####

VPATH =		@srcdir@
srcdir =	@srcdir@

# Common prefix for machine-independent installed files.

prefix =	/gnu

# Common prefix for machine-dependent installed files.

exec_prefix =	$(prefix)

# Directory to install executables in.

bindir =	$(exec_prefix)/bin

# Program to install executables.

INSTALL_PROGRAM = @INSTALL_PROGRAM@

# Program to install data like man pages.

INSTALL_DATA =	@INSTALL_DATA@

# Generic install program.

INSTALL =	@INSTALL@

CC =		@CC@
DEFS =		@DEFS@
CFLAGS =	@CFLAGS@
LDFLAGS =	@LDFLAGS@
LIBS =		@LIBS@

SHELL =		/bin/sh
LINT =		lint -abchx# traditional and BSD lint
MAKE =		make
REMOVE =	rm -f

#### End of system configuration section. ####

SOURCE=		ci.c co.c ident.c maketime.c merge.c merger.c partime.c \
		rcs.c rcsclean.c rcsdiff.c rcsedit.c rcsfcmp.c rcsfnms.c \
		rcsgen.c rcskeep.c rcskeys.c rcslex.c rcsmap.c rcsmerge.c \
		rcsrev.c rcssyn.c rcsutil.c rlog.c

OBJECT=		ci.o co.o ident.o maketime.o merge.o merger.o partime.o \
		rcs.o rcsclean.o rcsdiff.o rcsedit.o rcsfcmp.o rcsfnms.o \
		rcsgen.o rcskeep.o rcskeys.o rcslex.o rcsmap.o rcsmerge.o \
		rcsrev.o rcssyn.o rcsutil.o rlog.o

CI_OBJ =	ci.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o \
		rcsmap.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o \
		rcskeep.o rcsfcmp.o $(OTHER_OBJECT)

CO_OBJ =	co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o \
		rcsmap.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o \
		rcskeep.o $(OTHER_OBJECT)

IDENT_OBJ =	ident.o rcsmap.o $(OTHER_OBJECT)

MERGE_OBJ =	merge.o merger.o rcsfnms.o rcslex.o rcsmap.o rcsrev.o \
		rcssyn.o rcsutil.o rcskeep.o rcskeys.o $(OTHER_OBJECT)

RLOG_OBJ =	rlog.o rcslex.o rcsmap.o rcssyn.o rcsrev.o rcsutil.o \
		partime.o maketime.o rcsfnms.o rcskeep.o rcskeys.o \
		$(OTHER_OBJECT)

RCS_OBJ =	rcs.o rcslex.o rcssyn.o rcsrev.o rcsutil.o rcsgen.o \
		rcsedit.o rcskeys.o rcsmap.o rcsfnms.o rcskeep.o \
		$(OTHER_OBJECT)

RCSCLEAN_OBJ =	rcsclean.o rcsedit.o rcsfcmp.o rcsfnms.o rcsgen.o \
		rcskeys.o rcslex.o rcsmap.o rcsrev.o rcssyn.o rcsutil.o \
		rcskeep.o $(OTHER_OBJECT)

RCSDIFF_OBJ =	rcsdiff.o rcsutil.o rcsfnms.o rcsmap.o rcsrev.o rcssyn.o \
		rcslex.o maketime.o partime.o rcskeep.o rcskeys.o \
		$(OTHER_OBJECT)

RCSMERGE_OBJ =	rcsmerge.o merger.o rcsutil.o rcsfnms.o rcsmap.o rcsrev.o \
		rcssyn.o rcslex.o rcskeep.o rcskeys.o $(OTHER_OBJECT)

RCSCOMMANDS =	ci co ident merge rcs rcsdiff rcsmerge rlog

RCSTEST =	PATH=$(RCSDIR):$(bindir)/.:$$PATH sh $(TESTPREFIX)rcstest

# "-I." is needed to find conf.h in the build directory.

.c.o:
		$(CC) -c -I. -I$(srcdir) $(DEFS) $(CFLAGS) $< $(OUTPUT_OPTION)

default ::	all

all ::		$(RCSCOMMANDS)

ci :		$(CI_OBJ)
		$(CC) $(LDFLAGS) $(CI_OBJ) $(LIBS) -o $@

co :		$(CO_OBJ)
		$(CC) $(LDFLAGS) $(CO_OBJ) $(LIBS) -o $@

ident :		$(IDENT_OBJ)
		$(CC) $(LDFLAGS) $(IDENT_OBJ) $(LIBS) -o $@

merge :		$(MERGE_OBJ)
		$(CC) $(LDFLAGS) $(MERGE_OBJ) $(LIBS) -o $@

rlog :		$(RLOG_OBJ)
		$(CC) $(LDFLAGS) $(RLOG_OBJ) $(LIBS) -o $@

rcs :		$(RCS_OBJ)
		$(CC) $(LDFLAGS) $(RCS_OBJ) $(LIBS) -o $@

rcsclean :	$(RCSCLEAN_OBJ)
		$(CC) $(LDFLAGS) $(RCSCLEAN_OBJ) $(LIBS) -o $@

rcsdiff :	$(RCSDIFF_OBJ)
		$(CC) $(LDFLAGS) $(RCSDIFF_OBJ) $(LIBS) -o $@

rcsmerge :	$(RCSMERGE_OBJ)
		$(CC) $(LDFLAGS) $(RCSMERGE_OBJ) $(LIBS) -o $@

lint ::		conf.h
		$(LINT) $(CC_D) -Dlint=1 $(SOURCE)

$(OBJECT) : 	conf.h rcsbase.h

install :: all
		$(INSTALL_PROGRAM) ci $(bindir)/ci
		$(INSTALL_PROGRAM) co $(bindir)/co
		$(INSTALL_PROGRAM) ident $(bindir)/ident
		$(INSTALL_PROGRAM) merge $(bindir)/merge
		$(INSTALL_PROGRAM) rcs $(bindir)/rcs
		$(INSTALL_PROGRAM) rcsdiff $(bindir)/rcsdiff
		$(INSTALL_PROGRAM) rcsmerge $(bindir)/rcsmerge
		$(INSTALL_PROGRAM) rlog $(bindir)/rlog

# Install RCS and (if applicable) GNU diff before running these tests.
# To test RCS before installing it, see README.

installtest ::
		$(RCSTEST)

installdebug ::
		$(RCSTEST) -v

clean ::
		$(REMOVE) a.* *.o conf.h conf.error
		$(REMOVE) $(RCSCOMMANDS) rcsclean

