# Copyright (C) 1991 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB.  If
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.

# Makefile for standalone distribution of malloc.

A_SUFFIX=a
O_SUFFIX=o

srcdir = .
VPATH = .:$(srcdir)

all: libmalloc.$(A_SUFFIX)

sources = calloc.c cfree.c free.c malloc.c mcheck.c morecore.c \
	  memalign.c mstats.c mtrace.c realloc.c valloc.c
objects = calloc.$(O_SUFFIX) cfree.$(O_SUFFIX) free.$(O_SUFFIX) malloc.$(O_SUFFIX) mcheck.$(O_SUFFIX) morecore.$(O_SUFFIX) \
	  memalign.$(O_SUFFIX) mstats.$(O_SUFFIX) mtrace.$(O_SUFFIX) realloc.$(O_SUFFIX) valloc.$(O_SUFFIX)
headers = malloc.h getpagesize.h

libmalloc.$(A_SUFFIX): $(objects)
	$(AR) crv $@ $(objects)
	ranlib $@

.c.$(O_SUFFIX):
	$(CC) $(CFLAGS) $(CPPFLAGS) -I. -c $< $(OUTPUT_OPTION)

.PHONY: clean realclean malloc-clean malloc-realclean
clean malloc-clean:
	-rm -f libmalloc.$(A_SUFFIX) $(objects) core
realclean malloc-realclean: clean
	-rm -f TAGS tags *~

calloc.$(O_SUFFIX): malloc.h
free.$(O_SUFFIX): malloc.h
malloc.$(O_SUFFIX): malloc.h
mcheck.$(O_SUFFIX): malloc.h
memalign.$(O_SUFFIX): malloc.h
mstats.$(O_SUFFIX): malloc.h
mtrace.$(O_SUFFIX): malloc.h
realloc.$(O_SUFFIX): malloc.h
valloc.$(O_SUFFIX): malloc.h getpagesize.h
