##
## Process this file with automake to produce Makefile.in
##
## CVS ID: "$Id: Makefile.am,v 1.31 2005/12/07 10:43:19 marcs Exp $"
##
CC = $(CXX)

bin_PROGRAMS = agfl-lexer

INCLUDES = -I$(top_srcdir)/liblexicon/src \
	   -I$(top_srcdir)/libabase/src

##
## Sources and flags for agfl_lexer
##
agfl_lexer_SOURCES = lexgen.cc \
        affixtab.cc affixtab.h \
        avltrie.cc avltrie.h \
        datparser.cc datparser.h \
        entry.cc entry.h \
        field.cc field.h \
        globals.h \
	globlexafflists.h globsetafftable.h globtables.h \
        id.cc id.h \
        insout.h \
        key.h \
        lexaffixnamelist.cc lexaffixnamelist.h \
        lexentrylist.cc lexentrylist.h \
        lexentrylistidx.cc lexentrylistidx.h \
        lexfileio.cc \
        lexfileio.h \
        lexintaffixlist.cc lexintaffixlist.h \
        lexnontermlist.cc lexnontermlist.h \
        lextextaffixlist.cc lextextaffixlist.h \
        lifparser.cc lifparser.h \
        nonttab.h \
        options.cc options.h \
        paramtab.cc paramtab.h \
        parser.y \
        parserinterface.cc parserinterface.h \
        scanner.l

agfl_lexer_LDADD = $(top_builddir)/liblexicon/src/liblexicon.la \
	           $(top_builddir)/libabase/src/libabase.la
agfl_lexer_DEPENDENCIES = $(top_builddir)/liblexicon/src/liblexicon.la \
		          $(top_builddir)/libabase/src/libabase.la

agfl_lexer_CXXFLAGS = @DBG_OPT@ -Wall -fno-exceptions -fno-rtti $(AM_CXXFLAGS)
agfl_lexer_CFLAGS = @DBG_OPT@ -Wall $(AM_CFLAGS)

#CFLAGS += -DCMP_DEBUG
#CFLAGS += -DDEBUG_TRIE
#CFLAGS += -DDEBUG_LIF

##
## The same for findtrie and dumptrie
## Note that these two are only compiled on request
##
EXTRA_PROGRAMS = dumptrie findtrie
findtrie_SOURCES = findtrie.c
dumptrie_SOURCES = dumptrie.cc
findtrie_CFLAGS = @DBG_OPT@ -Wall $(AM_CFLAGS)
dumptrie_CFLAGS = @DBG_OPT@ -Wall $(AM_CFLAGS)
dumptrie_CXXFLAGS = @DBG_OPT@ -Wall -fno-exceptions -fno-rtti $(AM_CXXFLAGS)

test: $(EXTRA_PROGRAMS)
##
## Special rules for parser and lexer; the rules can be improved
##
AM_YFLAGS = -d
AM_LFLAGS =
#AM_YFLAGS += -v -t
#AM_LFLAGS += -d

SUFFIXES = .y .c
%.c %.h: %.y
	@YACC@ $(AM_YFLAGS) -o parser.c $<

scanner.c: scanner.l parser.c parser.h parser.y parser.o
	@LEX@ $(AM_LFLAGS) -o$@ $<

CLEANFILES = parser.h parser.c parser.output scanner.c
EXTRA_DIST = Makefile.cygwin
