# $Id: makefile.,v 1.4 1991/01/30 17:33:42 apratt Exp $
# Copyright (C) 1982, 1988, 1989 Walter Tichy
#   Copyright 1990 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 1, 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
#
#               INSTRUCTIONS
#               ============


#	Figure out where to put the RCS commands; define RCSDIR accordingly.

RCSDIR  = /net/acae127/home/bammi/bin
#RCSDIR = /usr/local/bin


#	Define INSTALL_SETID_FLAGS as needed to install RCS setgid or setuid.
#	This makes sense only when setegid() and seteuid() work
#	Setgid is better than setuid because it mixes with nonstrict locking.
#INSTALL_SETID_FLAGS = ${INSTALL_NORMAL_FLAGS}
#INSTALL_SETID_FLAGS = -g rcs -o root -m 2555
 INSTALL_SETID_FLAGS = ${INSTALL_NORMAL_FLAGS}


#	Define RCSPREFIX to be empty if you want RCS to search the PATH for
#	subsidiary RCS commands like co.  This lets you move RCS commands
#	after building them, and permits multiple instances of setgid RCS
#	commands on the same host for different groups.
#
#	Define RCSPREFIX to a path followed by / if you want RCS to look in
#	just one place.  This makes execution faster.  Also, if your host's
#	execvp() system call does not understand the BSD #!/bin/sh convention
#	for starting shell files, you must use a nonempty RCSPREFIX, because
#	in this case rcsmerge invokes `/bin/sh ${RCSPREFIX}merge'.

#RCSPREFIX =
#RCSPREFIX = ${RCSDIR}/
 RCSPREFIX = ${RCSDIR}/

#	Define DIFF and DIFF3 to be the name of your diff and diff3 programs.
#	DIFF must be an absolute path name if setgid or setuid is used.
#	Define DIFF_FLAGS to be diff's options for RCS format output.
#	If available, use the -a option for comparing arbitrary files.
#	Define DIFF_L to be 1 if your diff understands GNU diff's -L option.
#	Set DIFF3_TYPE=lib for traditional diff, =bin otherwise.
#	If DIFF3_type=bin, make sure your diff3 understands -a, -L, and and -m.
#	If DIFF3_type=lib, avoid the diff3 program visible to users, and
#	use the one in /usr/lib instead; it may be called /usr/lib/diff3prog.

# Traditional diff
#DIFF = /bin/diff
#DIFF_FLAGS = -n
#DIFF_L = 0
#DIFF3 = /usr/lib/diff3
#DIFF3_TYPE = lib

# GNU diff -- must be version 1.15 or later
DIFFPREFIX = ${RCSDIR}/
DIFF = ${DIFFPREFIX}diff
DIFF_FLAGS = -an
DIFF_L = 1
DIFF3 = ${DIFF}3
DIFF3_TYPE = bin

# DIFF = /bin/diff
# DIFF_FLAGS = -n
# DIFF_L = 0
# DIFF3 = /usr/lib/diff3
# DIFF3_TYPE = lib


#	Set SENDMAIL to be a comma-separated list of strings that are a command
#	to send mail.  The first string should be an absolute pathname.
#	The name of the addressee will be appended as a separate argument,
#	and the standard input will be the message (first line "Subject: xxxx",
#	second line empty).

#SENDMAIL = "/bin/mail"
#SENDMAIL = "/etc/delivermail", "-w"
#SENDMAIL = "/usr/lib/sendmail"
 SENDMAIL = "/bin/mail"


#	Decide what loader libraries you need.
#	Some older hosts need -lBSD, -ljobs, or -lPW.

LDLIBS =


#	Decide what C compiler flags you need.

# Optimize.  Put in options that work well for your compiler.
# Options to try with GCC include -fdelayed-branch, -finline-functions,
# -fomit-frame-pointer, and -fstrength-reduce.
CC_O = -O -fstrength-reduce # -finline-functions

# Make all initialized data read-only (not just string literals).
# This option can improve performance by making initialized data shared.
# It's not worth worrying about if your compiler supports the `const' keyword.
# 4.3BSD-based compilers
#CC_R = -R
# most other compilers
#CC_R =
 CC_R =

# Add this for SunOS 4.1 + GCC 1.37.1.
#COMPILE.c = ${CC} ${CFLAGS} ${CPPFLAGS} -c


# for GCC
CC = gcc
CC_W = -Wall -Wpointer-arith -Wwrite-strings
CFLAGS = ${CC_O} ${CC_R} ${CC_W}

# for traditional C compilers
#CC = cc
#CFLAGS = ${CC_O} ${CC_R}

# CC = cc
# CFLAGS = ${CC_O} ${CC_R}


LINT = lint

# For traditional and BSD lint, use
#LINTFLAGS = -abchx
# For USG lint, use
#LINTFLAGS =
 LINTFLAGS = -abchx


#	If you have version 2 RCS files around, define COMPAT2 to be 1.
#	(Version 2 became obsolete in 1982.)  This assures that version 2
#	RCS files can still be read.  After all version 2 RCS files have
#	been updated with later versions of ci or rcs, you can remake RCS with
#	COMPAT2=0.
COMPAT2 = 0
#	When you have RCS installed, rename old version 2 RCS files as follows
#	(if you have any).  If the working file was "f.c" and the RCS file
#	"f.c.v", rename the RCS file to "f.c,v". If the working file was "f.c"
#	and the RCS file "f.v", rename the RCS file "f.c,v". Thus, suffixes
#	are no longer dropped and RCS files end in ",v" rather than ".v".


#	Now you are ready.  Try to make "conf.h".
#	Check the resulting conf.h for plausibility.
#	If it's wrong, there is a bug in conf.sh; please report it.
#	You can patch conf.h if you're in a hurry, but it's better to fix it;
#	look at a.h and conf.error for ideas.
#	If all else fails, copy conf.heg to conf.h and edit it by hand.

#	Make "all".
#	If all went well, make "install".
#	If installation succeeds, make "installtest";
#	if this fails, make "installdebug" for detailed info.

#	If you want to maintain RCS with itself, be sure you preserve the
#	original revision numbers, dates, etc. by checking the
#	files in with the -k option.

# Avoid brain damage in some versions of 'make'.
SHELL = /bin/sh

# binary commands
BCOMMANDS   =   ci.ttp ident.ttp rcs.ttp rcsdiff.ttp rlog.ttp co.ttp # rcsmerge.ttp 

# all commands
RCSCOMMANDS = ${BCOMMANDS} # merge 

all :: ${RCSCOMMANDS}

INSTALL = install -c
INSTALL_NORMAL_FLAGS = 

install :: all
	${INSTALL} ${INSTALL_SETID_FLAGS} ci ${RCSDIR}
	${INSTALL} ${INSTALL_SETID_FLAGS} co ${RCSDIR}
	${INSTALL} ${INSTALL_SETID_FLAGS} rcsdiff ${RCSDIR}
	${INSTALL} ${INSTALL_SETID_FLAGS} rcsmerge ${RCSDIR}
	${INSTALL} ${INSTALL_SETID_FLAGS} rlog ${RCSDIR}
	${INSTALL} ${INSTALL_NORMAL_FLAGS} ident ${RCSDIR}
	${INSTALL} ${INSTALL_NORMAL_FLAGS} rcs ${RCSDIR}
	${INSTALL} ${INSTALL_NORMAL_FLAGS} merge ${RCSDIR}

installtest ::
	sh rcstest

installdebug ::
	sh rcstest -v

clean ::
	rm -f a.* *.o conf.h conf.error ${RCSCOMMANDS}

conf.h : conf.sh # Makefile
	C='${CC} ${CFLAGS}' \
	COMPAT2='${COMPAT2}' \
	DIFF='${DIFF}' \
	DIFF_L='${DIFF_L}' \
	DIFF_FLAGS='${DIFF_FLAGS}' \
	RCSPREFIX='${RCSPREFIX}' \
	SENDMAIL='${SENDMAIL}' \
	L='${LDLIBS}' \
	sh -x conf.sh 2>conf.error
	mv a.h $@
	rm -f a.*

CIFILES = 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
ci.ttp : ${CIFILES} system.o
	${CC} ${CFLAGS} ${CIFILES} system.o ${LDLIBS} -o $@

COFILES = co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsmap.o \
	rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o
co.ttp : ${COFILES} system.o
	${CC} ${CFLAGS} ${COFILES} system.o ${LDLIBS} -o $@

ident.ttp : ident.o rcsmap.o
	${CC} ${CFLAGS} ident.o rcsmap.o ${LDLIBS} -o $@

merge : merge.sh
	DIFF=${DIFF} DIFF3=${DIFF3} DIFF3_TYPE=${DIFF3_TYPE} sh $@.sh >$@.o
	chmod +x $@.o
	mv $@.o $@

RLOG = rlog.o rcslex.o rcsmap.o rcssyn.o rcsrev.o rcsutil.o partime.o \
	maketime.o rcsfnms.o
rlog.ttp : ${RLOG} system.o
	${CC} ${CFLAGS} ${RLOG} system.o ${LDLIBS} -o $@

RCS = rcs.o rcslex.o rcssyn.o rcsrev.o rcsutil.o rcsgen.o rcsedit.o rcskeys.o \
	rcsmap.o rcsfnms.o
rcs.ttp : ${RCS} system.o
	${CC} ${CFLAGS} ${RCS} system.o ${LDLIBS} -o $@

RCSDIFF = rcsdiff.o rcsutil.o rcsfnms.o rcsmap.o rcsrev.o rcssyn.o rcslex.o \
	maketime.o partime.o
rcsdiff.ttp : ${RCSDIFF} system.o
	${CC} ${CFLAGS} ${RCSDIFF} system.o ${LDLIBS} -o $@

RCSMERGE = rcsmerge.o rcsutil.o rcsfnms.o rcsmap.o rcsrev.o rcssyn.o rcslex.o
rcsmerge.ttp : ${RCSMERGE} system.o 
	${CC} ${CFLAGS} ${RCSMERGE} system.o ${LDLIBS} -o $@

PAIRTEST = pairtest.o rcslex.o rcssyn.o rcsrev.o rcsutil.o rcsgen.o rcsedit.o rcskeys.o \
	rcsmap.o 
pairtest.ttp: ${PAIRTEST} system.o
	gcc -o pairtest.ttp ${CFLAGS} ${PAIRTEST} system.o ${LDLIBS}
pairtest.o: rcsfnms.c
	gcc -o pairtest.o $(CFLAGS) -DPAIRTEST -c rcsfnms.c

SOURCE=	ci.c co.c ident.c maketime.c partime.c rcs.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 partime.o rcs.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

lint : conf.h
	${LINT} ${LINTFLAGS} -Dlint=1 ${SOURCE}

${OBJECT} : conf.h rcsbase.h
