SQLANLZ_OBJS = html.o sqllib.o util.o registry.o sqlanalyze.o
SQLUP_OBJS = html.o sqllib.o util.o registry.o sqlupload.o
SQLDP_OBJS = html.o sqllib.o util.o registry.o sqlsamdump.o
SQLBD_OBJS = html.o sqllib.o util.o registry.o sqlbackdoor.o

#LIBS = -lnsl -lrpcsvc -lsocket
LDFLAGS =  freetds-0.52/src/tds/.libs/libtds.a

all: 
	$(CC) -Iinclude $(CFLAGS) -c html.c -o html.o
	$(CC) -Iinclude $(CFLAGS) -c sqllib.c -o sqllib.o
	$(CC) -Iinclude $(CFLAGS) -c util.c -o util.o
	$(CC) -Iinclude $(CFLAGS) -c registry.c -o registry.o
	$(CC) -Iinclude $(CFLAGS) -c sqlanalyze.c -o sqlanalyze.o
	$(CC) -Iinclude $(CFLAGS) -c sqldict.c
	$(CC) -Iinclude $(CFLAGS) -c sqlquery.c
	$(CC) -Iinclude $(CFLAGS) -c sqlupload.c
	$(CC) -Iinclude $(CFLAGS) -c sqldirtree.c
	$(CC) -Iinclude $(CFLAGS) -c sqlregenumkey.c
	$(CC) -Iinclude $(CFLAGS) -c util.c
	$(CC) -Iinclude $(CFLAGS) -c sqldumplogins.c
	$(CC) -Iinclude $(CFLAGS) -c sqlreggetvalue.c
	$(CC) -Iinclude $(CFLAGS) -c sqlbackdoor.c
	$(CC) -Iinclude $(CFLAGS) -c sqlsamdump.c
	$(CC)  -o ../../bin/sqlanlz $(SQLANLZ_OBJS) $(LIBS) $(LDFLAGS)
	$(CC)  -o ./sqlupload $(SQLUP_OBJS) $(LIBS) $(LDFLAGS)
	$(CC)  -o ./sqlsamdump $(SQLDP_OBJS) $(LIBS) $(LDFLAGS) 
	$(CC)  -o ./sqlbackdoor $(SQLBD_OBJS) $(LIBS) $(LDFLAGS)
#html.o            sqldict.o         sqlquery.o        sqlupload.o
#registry.o        sqldirtree.o      sqlregenumkey.o   util.o
#sqlanalyze.o      sqldumplogins.o   sqlreggetvalue.o
#sqlbackdoor.o     sqllib.o          sqlsamdump.o

clean:
	rm -f ../../bin/sqlanlz
	rm -f sqlupload sqlsamdump sqlbackdoor
	rm -f *.o
distclean: clean
	rm -rf config.log config.h config.status 
	cd freetds-0.52/src/tds; rm -f *.o *.lo
