#
# Makefile for the HTML postprocessor.
# 

OBJ = yodl2html-post.o usage.o lex.yy.o parser.tab.o \
      init.o cleanup.o \
      yyerror.o stringtabsetstr.o stringtabreset.o stringtabaddstr.o \
      chapterlinks.o outputfilename.o \
      ../lib/xrealloc.o ../lib/xstrdup.o ../lib/strconcat.o \
        ../lib/strtabadd.o ../lib/error.o ../lib/errorsetprogname.o \
        ../lib/output.o ../lib/openfile.o ../lib/closefile.o \
	../lib/warning.o \
      handletag.o documenttype.o tableofcontents.o lastnumber.o \
        tocentry.o unknowntag.o label.o ref.o newfile.o bodytagopt.o \
        title.o solvelink.o

all: yodl2html-post

install: $(STD_INCLUDE)/yodl2html-post

clean::
	rm -f $(OBJ) yodl2html-post

$(STD_INCLUDE)/yodl2html-post: yodl2html-post
	-mkdir -p $(STD_INCLUDE)
	$(INSTALL) yodl2html-post $(STD_INCLUDE)
        
lexer: lexer.in ../../Makefile
	sed "s/__TAGSTART__/$(TAGSTART)/g"  < lexer.in | \
	sed "s/__TAGEND__/$(TAGEND)/g"      > lexer

yodl2html-post: $(OBJ)
	$(CC) -o yodl2html-post $(OBJ)

.c.o:
	$(CC) -c $(CFLAGS) -o $@ -DVER=\"$(VER)\" -DYEARS=\"$(YEARS)\" $<
        

lex.yy.c: lexer parser.tab.h
	flex lexer
        
lex.yy.o: lex.yy.c
	@echo 'Ignore warnings in the compilation of lex.yy.c...'
	$(CC) -c $<

parser.tab.h: parser
	bison -d parser
        
parser.tab.c: parser
	bison parser

# extra deps
yodl2html-post.o: yodl2html-post.c yodl2html-post.h
usage.o: usage.c ../../Makefile

