#
# $Id: Makefile.in,v 1.5 1997/12/08 14:25:04 bg Exp $
#

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@

CC = @CC@
AR = ar
RANLIB = @RANLIB@
LN_S = @LN_S@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
LD_FLAGS = @LD_FLAGS@
EXECSUFFIX=@EXECSUFFIX@

AWK = @AWK@

INSTALL = @INSTALL@
INSTALL_DATA	= @INSTALL_DATA@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
bindir = @bindir@

PICFLAGS = @PICFLAGS@
 
PROGS = compile_et
LIBNAME = $(LIBPREFIX)com_err
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
LIBPREFIX = @LIBPREFIX@
LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)

SOURCES = error.c com_err.c
OBJECTS = error.o com_err.o

all: $(LIB) $(PROGS)

Wall:
	make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"

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

install: all
	$(MKINSTALLDIRS) $(libdir)
	$(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
	$(MKINSTALLDIRS) $(bindir)
	$(INSTALL_DATA) -m 0555 $(PROGS) $(bindir)

uninstall:
	rm -f $(libdir)/$(LIB)

TAGS: $(SOURCES)
	etags $(SOURCES)

clean:
	rm -f $(LIB) *.o *.a krb_err.c krb_err.h $(PROGS)  $(EXTRA_SOURCE)

mostlyclean: clean

distclean: clean
	rm -f Makefile *.tab.c *~

realclean: distclean
	rm -f TAGS

dist: $(DISTFILES)
	for file in $(DISTFILES); do \
	  ln $$file ../`cat ../.fname`/lib \
	    || cp -p $$file ../`cat ../.fname`/lib; \
	done

$(LIBNAME).a: $(OBJECTS)
	rm -f $@
	$(AR) cr $@ $(OBJECTS)
	-$(RANLIB) $@

$(LIBNAME).$(SHLIBEXT): $(OBJECTS) $(LDOBJ)
	rm -f $@
	$(LDSHARED) -o $@ $(OBJECTS) $(LDOBJ) $(LIBDES)

compile_et: $(srcdir)/compile_et.in
	sed -e 's/@awk@/$(AWK)/' -e "/#awksrc/r $(srcdir)/compile_et.awk" $(srcdir)/compile_et.in > compile_et
	chmod +x compile_et
