# Makefile for the Sherlock Parsers (c) 2001 Martin Mares <mj@ucw.cz>

DIRS+=gather/format

LIBGATH_MODS+=$(addprefix format/,format)

LIBPARSE_MODS=$(addprefix format/,parse text zlib unlzw robots sink validate external fb-textpacker alloc)
LIBPARSE_LIBS=
LIBPARSE_INCLUDES=parsers.h
PROGS+=$(o)/gather/format/ps-parse

ifdef CONFIG_DEBUG_TOOLS
PROGS+=$(o)/gather/format/parser-test
endif

ifdef CONFIG_IMAGES
LIBPARSE_MODS+=format/image
LIBPARSE_LIBS+=$(LIBIMAGES) $(LIBSH) $(LIBIMAGES_LIBS)
endif

ifdef CONFIG_PDF
include $(s)/gather/format/pdf/Makefile
endif

include $(s)/gather/format/html/Makefile

ifneq ($(CONFIG_MP3)$(CONFIG_OGG),)
LIBPARSE_MODS+=format/audio
endif

$(o)/gather/libparse.a: $(addsuffix .o,$(addprefix $(o)/gather/,$(LIBPARSE_MODS)))
$(o)/gather/libparse.so: $(addsuffix .oo,$(addprefix $(o)/gather/,$(LIBPARSE_MODS)))

INCLUDES+=$(o)/gather/format/.include-stamp
$(o)/gather/format/.include-stamp: $(addprefix $(s)/gather/format/,$(LIBPARSE_INCLUDES))
	$(s)/build/install-includes $(s)/gather/format run/include/gather/format $(?F)
	touch $(o)/gather/format/.include-stamp

$(o)/gather/format/fb-textpacker-t: $(LIBSH) $(LIBCHARSET)
$(o)/gather/format/parser-test: $(LIBPARSE) $(LIBGATH) $(LIBCUSTOM) $(LIBSH)
$(o)/gather/format/parser-test: LIBS+=$(LIBPARSE_LIBS) $(LIBGATH_LIBS)
