###
###  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 SMake.
###
###
###  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
###

TIME=TimeMem TimeMem.sas TimeMem.ixemul TimeMem.libnix TimeProg

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

OBJS=calloc.o free.o init.o malloc.o realloc.o strdup.o \
     MemPoolPuddleSize.o MemPoolThreshSize.o MemPoolFlags.o

LIBS=mempools.lib libmempools.a

DIST=Makefile SMakefile COPYING MemPools.readme \
     TimeMem.c TimeProg.c mempools.h my_alib_protos.h\
     SCOPTIONS

CFLAGS=\
    PARAMETERS=BOTH ANSI NOSTACKCHECK NOSTACKEXTEND OPTIMIZE STRICT


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

all: mempools.lib

dist: distall dodist

distall: mempools.lib libmempools.a
	-Delete libmempoolsd.a mempoolsd.a \#?.(o|lnk) $(TIME) quiet

dodist:
	execute <<
	cd /
	Delete MemPools.lha quiet
	lha a -x MemPools.lha MemPools/ $(SRCS) $(LIBS) $(DIST)
	copy MemPools/MemPools.readme "" clone
	cd mempools
<

mempools.lib: $(OBJS)
	oml $@ r $(OBJS)
	-Delete \#?.o quiet

libmempools.a:
	-Delete \#?.o quiet
	make libmempools.a

libmempoolsd.a:
	-Delete \#?.o quiet
	make libmempoolsd.a

clean:
	-delete \#?.o \#?.lib lib\#?.a all quiet

check: TimeMem
	@avail flush
	@TimeMem VERBOSE
	@avail flush
	-Delete TimeMem TimeMem.o quiet

time: $(TIME)
	@echo You'd better get a cup of coffee now ...
	@echo
	@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"

TimeMem: TimeMem.c mempools.lib
	sc LINK $(CFLAGS) PROGRAMNAME TimeMem TimeMem.c LIB mempools.lib

TimeMem.sas: TimeMem.c
	sc LINK $(CFLAGS) PROGRAMNAME TimeMem.sas TimeMem.c

TimeMem.ixemul: TimeMem.c
	make TimeMem.ixemul

TimeMem.libnix: TimeMem.c
	make TimeMem.libnix

TimeProg: TimeProg.c
	sc LINK $(CFLAGS) PROGRAMNAME TimeProg TimeProg.c
