#### CONFIGURATION SECTION (see also src/config.h and src/Makefile)
#
#... C compiler (pick only one!)
#
# gcc (production version)
CC = gcc -pipe
#
# standard C compiler on your system (may need options)
#CC = cc
#
# AIX xlc compiler:
#CC = xlc -qmaxmem=8192
#
# gcc development version
#CC = gcc -pedantic -Wall
#
# OPTIMIZATION
#
# - debug
#CFLAGS = -g
# - optimized
CFLAGS = -O2
# - profiled
#CFLAGS = -O2 -pg
#LDFLAGS = -pg
#
# Extra libraries
#
LIBS=	-lm -lc
#
# Version
#   change only if you customize it - please send changes to author
#   If you change this, you should normally add something to the end
#   of it, such as "1.2-rru" or "1.2-1-rru".
#
VERSION = -DVERSION=\"1.2.1\"
#
# MAXHITS - max. hits returned (default is 50).
#
MAXHITS = -DMAXHITS=50
#
#### YOU SHOULD NOT HAVE TO CHANGE ANYTHING BELOW HERE

CONFIG_PARAMS = ${VERSION} ${MAXHITS}

OBJS= check.o error.o file.o hash.o index.o list.o mem.o merge.o search.o \
	string.o swish.o

.c.o:
	$(CC) $(CFLAGS) -c $<

all:	swish

swish:	$(OBJS)
	$(CC) ${LDFLAGS} -o swish $(OBJS) $(LIBS)
	chmod 755 swish
#	strip swish

quant:
#	make clean
	make CFLAGS="-g" $(OBJS)
	make quant-link

quant-link:
	quantify $(CC) -o swish -g $(CFLAGS) $(OBJS) $(LIBS)

pure:
#	make clean
	make CFLAGS="-g" $(OBJS)
	make pure-link

pure-link:
	purify $(CC) -o swish -g $(CFLAGS) $(OBJS) $(LIBS)

clean:
	rm -f ./swish *.o .pure swish.pure* *qx *qv ./index.swish
# DO NOT DELETE

check.o: check.c swish.h string.h config.h check.h hash.h
error.o: error.c swish.h string.h config.h error.h
file.o: file.c swish.h string.h config.h file.h error.h hash.h list.h
hash.o: hash.c swish.h string.h config.h hash.h mem.h
index.o: index.c swish.h string.h config.h index.h check.h error.h file.h hash.h list.h mem.h search.h
list.o: list.c swish.h string.h config.h list.h mem.h
mem.o: mem.c swish.h string.h config.h mem.h error.h
merge.o: merge.c swish.h string.h config.h merge.h error.h hash.h index.h mem.h search.h
search.o: search.c swish.h string.h config.h search.h hash.h list.h mem.h merge.h
string.o: string.c swish.h string.h config.h mem.h
swish.o: swish.c swish.h string.h config.h error.h file.h index.h list.h merge.h search.h
	${CC} ${CFLAGS} ${CONFIG_PARAMS} -c swish.c -o swish.o
