include ../Definition

MODULE	= Linter
NAME 	= Linter


CFLAGS = -c $(CFLAGS_DEPS) $(CPICFLAG) $(CFLAGS_PERL) \
	 -I. -I../intlib -I../odbc -I../odbc/INCLUDE -I$(PERL_AUTODBI) \
         $(SYSTEMS) $(OS) $(PACKING) $(VERSION) -DLINDBD

LDFLAGS	= $(LDSHLIBFLAG) $(LDKEY)../bin/$(MODULE).so

DBD_OBJS =  \
dbdasn.o \
dbderr.o \
dbdmem.o \
linter.o \
lindbd.o

SH_LIBS= ../perl/linstab.a ../intlib/linapi.la

OBJ = $(DBD_OBJS)

.SUFFIXES:  .c .o


TARGETS	= support ../bin/Linter.so  ../bin/DBD/Linter.pm

all:	$(TARGETS) result.dps

result.dps:	$(TARGETS)
	$(MK_DEPS)

../bin/DBD/Linter.pm:	Linter.pm
			cp Linter.pm ../bin/DBD/Linter.pm

lnlsutf.o:	../intlib/lnlsutf.c
	$(CC) $(CFLAGS) ../intlib/lnlsutf.c

../bin/Linter.so:	$(OBJ)
	if test ! -d ../bin/DBD ; then \
	    mkdir ../bin/DBD; fi
	$(LD) $(LDFLAGS) $(OBJ) $(SH_LIBS) \
 $(PERLIBS) $(LIBRARY)


support:
	@if [ ! "$(SUPPORT_DBI)" = "1" ]; then \
	    echo "DBI non configured or not installed in this system"; \
	    "DBI non configured or not installed in this system"; \
	fi

linter.o:	linter.c
			$(CC) $(CFLAGS) linter.c

linter.c : 		linter.xs
			$(PERL) $(XSUBPP) linter.xs > linter.c

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

#########################################################################
install:
	[ -d $(PERL_DBD) ] || mkdir $(PERL_DBD)
	cp ../bin/DBD/Linter.pm $(PERL_DBD)
	[ -d $(PERL_AUTODBD) ] || mkdir $(PERL_AUTODBD)
	[ -d $(PERL_AUTODBD)/Linter ] || mkdir $(PERL_AUTODBD)/Linter
	cp ../bin/Linter.so $(PERL_AUTODBD)/Linter

plinstall:	Linter.pm	../bin/Linter.so
	rm -rf module
	mkdir -p module/lib/DBD
	ln Linter.pm module/lib/DBD
	ln ../bin/Linter.so module/lib
	ln Makefile.PL module
	ln MANIFEST module
	cd module; \
	$(PERL) Makefile.PL; \
	make install; \
	make realclean; \
	rm -rf module

clean:
	rm -f *.o >/dev/null
	rm -f ../bin/Linter.so ../bin/DBD/Linter.pm >/dev/null
	rm -f linter.c >/dev/null
	rm -f *.d *.dps *.tmp >/dev/null
	rm -rf ../bin/DBD >/dev/null
	
cleansrc___:
	    rm -f *.c *.h *.pm *.so *.xs typemap *.def
