#
# $Id: Makefile.in,v 1.18.12.1 2000/09/01 04:21:13 lha Exp $
#

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@

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

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

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

#PICFLAGS = # @PICFLAGS@
 
LIBNAME = $(LIBPREFIX)roken
#LIBEXT = @LIBEXT@ Always build archive library and don't install!
LIBEXT = a
#LIBPREFIX = @LIBPREFIX@
LIBPREFIX = lib
#SHLIBEXT = @SHLIBEXT@
#LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)

include_HEADERS = base64.h			\
		  getarg.h			\
		  parse_bytes.h			\
		  parse_time.h			\
		  parse_units.h			\
		  resolve.h			\
		  rtbl.h			\
		  roken.h

SOURCES =					\
	base64.c				\
	chown.c					\
	concat.c				\
	copy_basename.c				\
	copy_dirname.c				\
	daemon.c				\
	eefile.c				\
	efile.c					\
	emalloc.c				\
	epopen.c				\
	erealloc.c				\
	err.c					\
	errx.c					\
	estrdup.c				\
	fchown.c				\
	flock.c					\
	get_window_size.c			\
	getcwd.c				\
	getdtablesize.c				\
	getarg.c				\
	getopt.c				\
	getusershell.c				\
	hstrerror.c				\
	inaddr2str.c				\
	inet_aton.c				\
	initgroups.c				\
	k_getpwnam.c				\
	k_getpwuid.c				\
	lstat.c					\
	memmove.c				\
	mini_inetd.c				\
	mkstemp.c				\
	net_read.c				\
	net_write.c				\
	parse_bytes.c				\
	parse_time.c				\
	parse_units.c				\
	putenv.c				\
	rcmd.c					\
	readv.c					\
	resolve.c				\
	rtbl.c					\
	setegid.c				\
	setenv.c				\
	seteuid.c				\
	signal.c				\
	snprintf.c				\
	str2inaddr.c				\
	strcasecmp.c				\
	strcollect.c				\
	strdup.c				\
	strerror.c				\
	strftime.c				\
	strlwr.c				\
	strlcat.c				\
	strlcpy.c				\
	strmatch.c				\
	strnlen.c				\
	strptime.c				\
	strsep.c				\
	strsep_copy.c				\
	strsplit.c				\
	strtok_r.c				\
	strtrim.c				\
	strupr.c				\
	tm2time.c				\
	unsetenv.c				\
	verify.c				\
	verr.c					\
	verrx.c					\
	vsyslog.c				\
	vwarn.c					\
	vwarnx.c				\
	warn.c					\
	warnerr.c				\
	warnx.c

OBJECTS =					\
	base64.o				\
	concat.o				\
	copy_basename.o				\
	copy_dirname.o				\
	eefile.o				\
	efile.o					\
	emalloc.o				\
	epopen.o				\
	erealloc.o				\
	estrdup.o				\
	get_window_size.o			\
	getarg.o				\
	inaddr2str.o				\
	k_getpwnam.o				\
	k_getpwuid.o				\
	mini_inetd.o				\
	net_read.o				\
	net_write.o				\
	parse_bytes.o				\
	parse_time.o				\
	parse_units.o				\
	resolve.o				\
	rtbl.o					\
	strcollect.o				\
	signal.o				\
	snprintf.o				\
	str2inaddr.o				\
	strmatch.o				\
	strsplit.o				\
	strtrim.o				\
	tm2time.o				\
	verify.o				\
	warnerr.o				\
	@LIBOBJS@

all: $(LIB)

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) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
	$(INSTALL_DATA) $(LIB) $(DESTDIR)$(libdir)/$(LIB)
	for x in $(include_HEADERS); do \
		$(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(includedir)/$$x; \
	done

uninstall:
	rm -f $(DESTDIR)$(libdir)/$(LIB)
	for x in $(include_HEADERS); do \
		rm -f $(DESTDIR)$(includedir)/$$x; \
	done

TAGS: $(SOURCES)
	etags $(SOURCES)

check:

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

mostlyclean: clean

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

realclean: distclean
	rm -f TAGS

Makefile: ../../config.status Makefile.in
	cd ../.. ; CONFIG_FILES=lib/roken/Makefile CONFIG_HEADERS= $(SHELL) config.status

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)

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