###
###  MemPools:  malloc() replacement using standard Amiga pool functions.
###  Copyright  (C)  1994    Jochen Wiedmann
###
###  This program is free software; you can redistribute it and/or modify
###  it under the terms of the GNU General Public License as published by
###  the Free Software Foundation; either version 2 of the License, or
###  (at your option) any later version.
###
###  This program 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 General Public License for more details.
###
###  You should have received a copy of the GNU General Public License
###  along with this program; if not, write to the Free Software
###  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
###
###
###  This is the Makefile for DMake.
###
###
###  Computer:  Amiga 1200
###
###  Compilers: Dice 3.01
###             SAS/C 6.50
###             gcc 2.6.1
###
###
###  Author:    Jochen Wiedmann
###             Am Eisteich 9
###       72555 Metzingen
###             Germany
###
###             Phone: (0049) 7123 14881
###             Internet: jochen.wiedmann@uni-tuebingen.de
###


SRCS=calloc.c free.c init.c malloc.c realloc.c strdup.c \
     MemPoolPuddleSize.c MemPoolThreshSize.c MemPoolFlags.c

LIBS=mempools.lib mempoolss.lib mempoolssr.lib libmempools.a

DIST=Makefile SMakefile DMakefile lib.def COPYING MemPools.readme \
     TimeMem.c TimeProg.c mempools.h Pools.c

CFLAGS=-proto

############################################################################
###
###  Targets: all clean dist check time
###
############################################################################

all: mempoolss.lib mempoolssr.lib mempoolsl.lib mempoolsrl.lib \
     mempoolsds.lib mempoolsdsr.lib mempoolsdl.lib mempoolsdrl.lib

dist: distall dodist

distall: mempoolss.lib mempoolssr.lib mempools.lib libmempools.a
	@Delete #?.o quiet

dodist:
	@cd /
	@Delete MemPools.lha quiet
	lha a -x MemPools.lha $(SRCS:*:MemPools/%1) $(LIBS:*:MemPools/%1) \
			      $(DIST:*:MemPools/%1)
	@cd mempools

mempoolss.lib:
	lbmake mempools s

mempoolssr.lib:
	lbmake mempools s r

mempoolsl.lib:
	lbmake mempools l

mempoolsrl.lib:
	lbmake mempools l r

mempoolsds.lib:
	lbmake mempools d s

mempoolsdsr.lib:
	lbmake mempools d s r

mempoolsdl.lib:
	lbmake mempools d l

mempoolsdrl.lib:
	lbmake d l r

mempools.lib:
	smake mempools.lib

libmempools.a:
	gmake libmempools.a

clean:
	@Delete #?.o #?.lib lib#?.a dtmp:comp? all quiet

check: TimeMem
	@avail flush
	@TimeMem VERBOSE
	@avail flush

time: TimeMem TimeMem.dice TimeMem.sas TimeMem.ixemul TimeMem.libnix TimeProg
	@echo You'd better get a cup of coffee now ...
	@echo
	@echo Timing Dice functions:
	@TimeProg "TimeMem.dice"
	@echo Timing SAS/C functions
	@TimeProg "TimeMem.sas"
	@echo Timing ixemul functions
	@TimeProg "TimeMem.ixemul"
	@echo Timing libnix functions
	@TimeProg "TimeMem.libnix"
	@echo Timing MemPool functions
	@TimeProg "TimeMem"

TestMem: TimeMem.c mempoolsds.lib
	dcc $(CFLAGS) -DDEBUG -s -d1 -o TestMem TimeMem.c -lmempoolsd -ldebug

TimeMem: TimeMem.c rand.c mempoolss.lib
	dcc $(CFLAGS) -o TimeMem TimeMem.c -lmempools

TimeMem.dice: TimeMem.c rand.c
	dcc $(CFLAGS) -o TimeMem.dice TimeMem.c -lmempools

TimeMem.sas: TimeMem.c
	smake TimeMem.sas

TimeMem.ixemul: TimeMem.c
	gmake TimeMem.ixemul

TimeMem.libnix: TimeMem.c
	gmake TimeMem.libnix

TimeProg: TimeProg.c
	dcc $(CFLAGS) -o TimeProg TimeProg.c
