#
# $Id: Makefile.in,v 1.32 1997/12/06 05:48:36 joda Exp $
#

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@

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

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

COMPILE_ET = ../com_err/compile_et

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

top_builddir = ../..

includedir = @includedir@

incdir = $(includedir)
inc_DATA = kadm_err.h
idir = $(top_builddir)/include

PICFLAGS = @PICFLAGS@

LIBNAME = $(LIBPREFIX)kadm
LIBEXT = @LIBEXT@
LIBPREFIX = @LIBPREFIX@
EXECSUFFIX = @EXECSUFFIX@
SHLIBEXT = @SHLIBEXT@
LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)

SOURCES = kadm_cli_wrap.c kadm_err.c kadm_stream.c kadm_supp.c

OBJECTS = kadm_cli_wrap.o kadm_err.o kadm_stream.o kadm_supp.o

all: $(LIB) all-local

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

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

install: all
	$(MKINSTALLDIRS) $(libdir)
	$(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
	$(MKINSTALLDIRS) $(includedir)
	@for i in $(inc_DATA); do \
	echo "  $(INSTALL_DATA) -m 0555 $$i $(incdir)";\
	$(INSTALL_DATA) -m 0555 $$i $(incdir); done

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

TAGS: $(SOURCES)
	etags $(SOURCES)

check:

clean:
	rm -f $(LIB) *.o *.a kadm_err.c kadm_err.h

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)
	rm -f $@
	$(LDSHARED) -o $@ $(OBJECTS)

kadm_err.c kadm_err.h: kadm_err.et
	test -r kadm_err.et || (rm -f kadm_err.et && $(LN_S) $(srcdir)/kadm_err.et .)
	$(COMPILE_ET) kadm_err.et

$(OBJECTS): ../../include/config.h
$(OBJECTS): kadm_err.h kadm_locl.h

all-local: $(inc_DATA)
	@for i in $(inc_DATA); do \
		if cmp -s  $$i $(idir)/$$i 2> /dev/null ; then :; else\
			echo " $(INSTALL_DATA) $$i $(idir)/$$i"; \
			$(INSTALL_DATA) $$i $(idir)/$$i; \
		fi ; \
	done
