CPP = g++
RM = rm

CPPSRCS=parse.cc
WINSRCS=$(CPPSRCS:.cc=.cpp)
CPPOBJS=$(CPPSRCS:.cc=.o)
CPPHDRS=$(CPPSRCS:.cc=.h)

SRCS=$(CPPSRCS)
HDRS=$(CPPHDRS)
OBJS=$(CPPOBJS)

.cc:
	$(CPP) $(CPPFLAGS) -o$@ $<

all: dom

dom: test.o $(OBJS)
	$(CPP) $(CPPFLAGS) -o$@ test.o $(OBJS)


$(OBJS): $(HDRS)

clean:
	$(RM) *.o 

convert: $(WINSRCS)
	for f in $(WINSRCS); do nkf -ed $$f > "`basename $$f '.cpp'`.cc"; done
	for f in $(CPPHDRS); do nkf -ed $$f > tmp; cp tmp $$f; done

test: dom
	for f in sample/*.xml; do ./dom $$f; done
