#  TLKTools - TLK<->XML generation tools
#  Makefile
#
#  Copyright (C) 2004-2005 Guido Imperiale
#  This code is released under the terms of the GNU GPL.
#  Please refer to tlktools.h for more info.
 
.default: all
.PHONY: all clean dist pack

LIBS   = `xml2-config --libs`
CFLAGS = -Wall `xml2-config --cflags`

VERSION = 1.0.3

## CONFIGURATION

#uncomment these to enable debug
CFLAGS += -g

#uncomment these to enable optimizations
#LIBS += -s
#CFLAGS += -O2 -fomit-frame-pointer

## END OF CONFIGURATION


OBJ2  = functions.o gff.o xmlrw.o tlkrw.o
OBJ   = $(OBJ2) tlktools.o tlk2xml.o xml2tlk.o
HEADS = tlktools.h

all: $(OBJ)
	gcc -o tlktools $(OBJ2) tlktools.o $(LIBS)
	gcc -o tlk2xml  $(OBJ2) tlk2xml.o $(LIBS)
	gcc -o xml2tlk  $(OBJ2) xml2tlk.o $(LIBS)

clean:
	rm -f *.o tlktools tlk2xml xml2tlk tlktools.exe tlk2xml.exe xml2tlk.exe

dist: all
	rm -f *.o

pack: clean
	cd ../../ && tar -czf tlktools-$(VERSION).tar.gz tlktools --exclude tlktools/linux --exclude tlktools/windows
	cd ../../ && tar -czf tlktools-$(VERSION)-i386.tgz tlktools --exclude tlktools/windows
	cd ../../ && zip -r -9 tlktools-$(VERSION)-win32.zip tlktools
	
$(OBJ): $(HEADS)
