###############################################################
# Makefile for SQUID's testsuite
# CVS $Id: Makefile,v 3.1 2006/03/07 19:40:23 yzizhen Exp $
#
# Note: The autoconf variables in this file must be coordinated
#       with HMMER, if you change them, because HMMER will 
#       create a Makefile from this Makefile.in using its own
#       configure script, not SQUID's.
#
###########
#    This copyrighted source code is freely distributed 
#    under the terms of the GNU General Public License. See
#    the files COPYRIGHT and LICENSE for details.
###########

SHELL  = /bin/sh
CC     = gcc
CFLAGS = -g -O2
MDEFS  =  -DHAVE_CONFIG_H
LIBS   = -lsquid  -lm

TESTPROGS = iospeed rndspeed

X-BASE = x-base-afetch\
	x-base-alistat\
	x-base-seqstat\
	x-base-sfetch\
	x-base-shuffle\
	x-base-sindex\
	x-base-sreformat

BUGLIST = bug-1-sfetch-paths

################################################################
# Targets for building the test programs.
#
all: sqdconfig $(TESTPROGS) 

$(TESTPROGS): %: %_main.o 
	$(CC) $(CFLAGS) -L../ -I../ $(MDEFS) -o $@ $@_main.o $(LIBS)

sqdconfig: %: %_main.o 
	$(CC) $(CFLAGS) -L../ -I../ $(MDEFS) -o $@ $@_main.o $(LIBS)

.c.o:
	$(CC) $(CFLAGS) $(MDEFS) -L../ -I../ -c $<		

################################################################


################################################################
# 'make check' actually runs the tests.
#
check: $(TESTPROGS) sqdconfig
	@for testprog in $(TESTPROGS); do\
	   if ./$$testprog; then\
	      echo $$testprog: ok;\
	   else\
	      echo $$testprog: FAILED;\
	   fi;\
        done
	@for xprog in $(X-BASE); do\
	   ./$$xprog;\
	done        
	@for bugprog in $(BUGLIST); do\
	   ./$$bugprog;\
	done        
  
#######
## Miscellaneous
#######

clean:
	-rm -f *.o *~ Makefile.bak core $(TESTPROGS) TAGS gmon.out sqdconfig

distclean:
	make clean
	-rm -f Makefile

TAGS:
	etags -t *.c *.h Makefile.in


