#DESTDIR =
INSTALLDIR=$(DESTDIR)/usr/lib/serpento

PYTHON_INCLUDE=/usr/include/python2.4/

CFLAGS = -g -W -Wall -I$(PYTHON_INCLUDE) $(DEFINES)
LDFLAGS =

all: searchingmodule.so

searchingmodule.o: searchingmodule.c
	$(CC) $(CFLAGS) -fpic -c searchingmodule.c 

searchingmodule.so: searchingmodule.o metaphone.o levenshtein.o soundex.o
	$(CC) $(CFLAGS) $(LDFLAGS) -fpic -shared \
        metaphone.o levenshtein.o soundex.o \
        searchingmodule.o -o searchingmodule.so

metaphone.o: metaphone.c metaphone.h
	$(CC) $(CFLAGS) -fpic -c metaphone.c

soundex.o: soundex.c soundex.h
	$(CC) $(CFLAGS) -fpic -c soundex.c

levenshtein.o: levenshtein.c levenshtein.h
	$(CC) $(CFLAGS) -fpic -c levenshtein.c

clean:
	rm -f *~ *.o searchingmodule.so *.pyc

install:
	mkdir -p $(INSTALLDIR)
	cp -f searchingmodule.so *.py $(INSTALLDIR)
	cp -f serpento $(DESTDIR)/usr/sbin
	cp -f serpento-inetd $(DESTDIR)/usr/sbin
        
