#
# STD* make up some of the functions from the ANSI-C standard and BSD libraries.
# If you've got them already, comment out the definitions
#
NEEDED		= strtod strtol strtoul strerror strsignal memmove \
		  random utimes setenv
STDOBJS		= $(NEEDEDOBJS) getopt.o
STDSRCS		= strtod.c strtol.c strtoul.c strerror.c strsignal.c \
		  memmove.c random.c utimes.c getopt.c setenv.c
OBJS 		= buf.o hash.o list.o option.o sys.o \
		  emalloc.o enomem.o $(STDOBJS) 
SRCS 		= buf.c hash.c list.c option.c sys.c \
		  emalloc.c enomem.c $(STDSRCS)
HDRS		= ../include/*.h

#include	<makelib.mk>
#include	<po.mk>

#if exists($(.CURDIR)/../../config.mk)
#include	"$(.CURDIR)/../../config.mk"
#endif

CC		?= cc
MACHFLAGS	?=
OPTIMIZE	?= -g -O

#ifdef SYSV
MACHFLAGS	+= -DSYSV
#endif

INCLUDES	= -I$(.CURDIR)/../include
CFLAGS		= $(OPTIMIZE) $(MACHFLAGS) $(INCLUDES)

NEEDEDOBJS	!= ${.CURDIR}/../../etc/needed.sh "$(CC)" $(NEEDED)

all:		libsprite.a

libsprite.a: libsprite.a($(OBJS)) MAKELIB .EXPORTSAME
libsprite_p.a: libsprite_p.a($(OBJS:S/.o$/.po/g)) MAKELIB .EXPORTSAME

tags		: $(HDRS) $(SRCS)
	cd $(.CURDIR); ctags $(HDRS) $(SRCS)

dirs		:
	test -d $(.CURDIR)/$(MAKEOBJDIR) || mkdir $(.CURDIR)/$(MAKEOBJDIR)

needed		:
	@echo "Needed objects: $(NEEDEDOBJS)"

#
# This should be unnecessary.
#
clean		:: .NOEXPORT
	rm -f *.o *.po libsprite.a libsprite_p.a
