SRCS=	calloc.c	cfree.c		free.c		gmalloc-head.c	\
	malloc.c			mcheck.c	memalign.c	\
	mstats.c	realloc.c	valloc.c	morecore.c

ifndef COFF
SRCS	:= $(SRCS) mcheck-init.c
endif

# name of the output library
LIBRARY	= libmalloc

##########################################################################
# At this point, no further changes should be required.

ASMS	= $(SRCS:.c=.s)
OBJS	= $(SRCS:.c=.o)

include	../Makerules
include	../Makeconfig


ifndef ELF
all:	../libs/$(LIBRARY).a
else
all:	../libs/$(LIBRARY).a ../elf/$(LIBRARY).o
endif

../libs/$(LIBRARY).a:	$(LIBRARY).a
	$(CP) $(LIBRARY).a ../libs

$(LIBRARY).a: $(OBJS)
	$(AR) $(ARFLAGS) $(LIBRARY).a $(OBJS)
	$(RANLIB) $(LIBRARY).a

../elf/$(LIBRARY).o: $(LIBRARY).o
	$(CP) $(LIBRARY).o ../elf

$(LIBRARY).o: $(OBJS)
	$(LD) -o $(LIBRARY).o -r $(OBJS)

dep:
	$(CPP) $(CFLAGS) -M $(SRCS) > .depend

dummy:

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
