ROOTDIR=../..
CFLAGS=-g  `xml2-config --cflags` -I$(ROOTDIR)/C++/include
CXXFLAGS=-g  `xml2-config --cflags` -I$(ROOTDIR)/C++/include
LDFLAGS=`xml2-config --libs`
SRC=example.cc

all: example
	./example ../demo.xml

test: test-parser

test-parser: example
	for f in ($ROOTDIR)/tests/parser/*.xml ; do ./example $$f ; done

example: example.o
	g++ $(LDFLAGS) -o example example.o

%.o: %.cc
	g++ $(CXXFLAGS) -Dtmpdebug -c $< -o $@

# automatic dependencies
%.d: %.cc
	$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
	| sed -e '\''s@$*\.o[ :]*@$@ &@g'\'' > $@'

include $(SRC:.cc=.d) 

clean:
	rm -f $(SRC:.cc=.d) $(SRC:.cc=.o) $(SRC:.cc=)
