# Makefile for library files used by GNU CVS.
# Do not use this makefile directly, but only from `../Makefile'.
# Copyright (C) 1986, 1988-1994 Free Software Foundation, Inc.

# This program 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.

# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# $CVSid: @(#)Makefile.in 1.21 94/09/24 $
srcdir     = @srcdir@
top_srcdir = @top_srcdir@
VPATH      = @srcdir@

SHELL = /bin/sh

prefix = /usr/local
exec_prefix = $(prefix)

SOURCES = \
    alloca.c \
    argmatch.c \
    error.c \
    fnmatch.c \
    ftruncate.c \
    getdate.y \
    getopt.c \
    getopt1.c \
    getwd.c \
    hostname.c \
    md5.c \
    memmove.c \
    mkdir.c \
    regex.c \
    rename.c \
    sighandle.c \
    strdup.c \
    strerror.c \
    strippath.c \
    stripslash.c \
    waitpid.c \
    yesno.c 

OBJECTS = \
    @ALLOCA@ @LIBOBJS@ \
    argmatch.o \
    error.o \
    fnmatch.o \
    getopt.o \
    getopt1.o \
    md5.o \
    sighandle.o \
    strippath.o \
    stripslash.o \
    yesno.o \
    getdate.o

DISTFILES = Makefile.in getopt.h fnmatch.h regex.h system.h wait.h $(SOURCES) \
    md5.h

DEFS = @DEFS@
RANLIB = @RANLIB@

CC       = @CC@
CFLAGS = -g
CPPFLAGS=

YACC = @YACC@

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

all: libcvs.a
.PHONY: all

install: all
.PHONY: install

tags: $(DISTFILES)
	ctags `for i in $(DISTFILES); do echo $(srcdir)/$$i; done`

TAGS: $(DISTFILES)
	etags `for i in $(DISTFILES); do echo $(srcdir)/$$i; done`

ls:
	@echo $(DISTFILES)
.PHONY: ls

clean:
	rm -f *.a *.o
.PHONY: clean

distclean: clean
	rm -f tags TAGS Makefile
.PHONY: distclean

realclean: distclean
	rm -f *.tab.c getdate.c
.PHONY: realclean

dist:
	ln $(DISTFILES) ../`cat ../.fname`/lib
.PHONY: dist

libcvs.a: $(OBJECTS)
	$(AR) cr $@ $(OBJECTS)
	-$(RANLIB) $@

getdate.c: getdate.y
	@echo expect 10 shift/reduce conflicts
	$(YACC) $(srcdir)/getdate.y
	-@if test -f y.tab.c; then \
	   mv y.tab.c getdate.c ;\
	else \
	   if test -f getdate.tab.c ; then \
	       mv getdate.tab.c getdate.c ; \
	   else \
	       echo '*** Unable to create getdate.c' ;\
	   fi ;\
	fi

fnmatch.o: fnmatch.h
getopt1.o: getopt.h
regex.o: regex.h
getwd.o: system.h
md5.o: md5.h

Makefile: Makefile.in
	cd .. ; $(SHELL) config.status

../config.status: ../configure
	cd .. ; $(SHELL) config.status --recheck

../configure: ../configure.in
	cd $(top_srcdir) ; autoconf
