# %%% copyright-cmetz-98
# This software is Copyright 1998 by Craig Metz, All Rights Reserved.
# The Inner Net License Version 2 applies to this software.
# You should have received a copy of the license with this software. If
# you didn't get a copy, you may request one from <license@inner.net>.
#
DOTS=../
include $(DOTS)GNUmakefile.inc

CFLAGS+=-I. $(DINET6) $(DNETSEC) $(DFASTCTO) -DINNER_NOSHORT=1

OBJS=dump_sockaddr.o free.o getpeer.o getvalue.o lprintf.o \
	putvalue.o readnetline.o realloc.o writenetline.o \
	myname.o debug.o

TARGETS=libinner.a

all: $(TARGETS)

.c.o:
	${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
	@ld -x -r $*.o
	@mv a.out $*.o

libinner.a: $(OBJS)
	@rm -f libinner.a
	@ar rulv libinner.a $(OBJS)
	@ranlib libinner.a

clean: 
	@rm -f $(TARGETS) *~ $(OBJS)

install: libinner.a
	@echo "libinner.a -> $(DESTDIR)$(LIBDIR)/libinner.a"
	@install -c -m 644 libinner.a $(DESTDIR)$(LIBDIR)
	@for i in 1 3 5 8; \
	do \
		F=`find . -name \*.$$i -print | sed s:^\./::g`; \
		if [ ! -z "$$F" ]; \
		then \
			for j in $$F; \
			do \
				echo "$$j -> $(DESTDIR)$(MANDIR)/man$$i/$$j"; \
				install -c -m 644 $$j $(DESTDIR)$(MANDIR)/man$$i/$$j; \
			done \
		fi; \
	done

