ifdef SQLFLAG
all: txt-converter
else
all: 
endif

COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o
COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/lock.h ../common/nullpo.h ../common/malloc.h

ifeq ($(findstring MINGW32,$(shell uname)), MINGW32)
LIBS = -lwsock32
else
LIBS = 
endif

ifdef SQLFLAG
	LIBS += -L$(MYSQL_LIBS) -lmysqlclient
endif

ifneq ($(findstring LOCALZLIB,$(CFLAGS)), LOCALZLIB)
	LIBS += -lz
endif

txt-converter: converter.o login-converter.o char-converter.o $(COMMON_OBJ)
	$(CC) -o ../../bin/$@ $> $(LIBS)

converter.o: converter.c
login-converter.o: login-converter.c
char-converter.o:  char-converter.c
clean:
	rm -f *.o
	rm -f GNUmakefile

ifeq ($(findstring CYGWIN,$(shell uname)), CYGWIN)
		rm -f ../../bin/txt-converter.exe
else
		rm -f ../../bin/txt-converter
endif

