##
## Process this file with automake to produce Makefile.in
##
## CVS ID: "$Id: Makefile.am,v 1.64 2006/10/10 12:25:43 marcs Exp $"
##
bin_PROGRAMS	   = agfl agflmaint agfl-coder

nodist_include_HEADERS	   = machdep.h

##
## Flags and dependencies for agfl_coder
##
agfl_coder_SOURCES = $(CDL3SRC) $(CSRC) $(LSRC)
agfl_coder_CFLAGS  = @DBG_OPT@ -Wall $(AM_CFLAGS)
agfl_coder_LDADD   = $(top_builddir)/liblexicon/src/liblexicon.la \
		     $(top_builddir)/libabase/src/libabase.la
agfl_coder_LDFLAGS      = @CDLLIBFLAG@ @CDLRTS@
agfl_coder_DEPENDENCIES = $(agfl_coder_LDADD)

##
## For agflmaint/agfl:
##
agflmaint_SOURCES = gen.c
agfl_SOURCES = gen.c
agfl_CFLAGS = @DBG_OPT@ -Wall -DGENBASE="\"$(prefix)\"" $(AM_CFLAGS)
agflmaint_CFLAGS = $(agfl_CFLAGS) -DMAINTAINER_MODE

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

MACHDEP_HOST	= @MACHDEPHOSTVAL@

EXTRA_DIST = pattern.c pattern.h dfa.h regex.c regex.h imatrix.h util.h warshall.h \
    machdep.i386-linux machdep.sparc-solaris machdep.dos machdep.common \
    machdep.irix Makefile.cygwin machdep.i386-freebsd machdep.ppc-darwin \
    machdep.alpha-netbsd  machdep.amd64-netbsd  machdep.i386-netbsd \
    machdep.amd64-freebsd machdep.amd64-linux

##
## Introduce CDL3 suffix and dependency
##
SUFFIXES = .k3
%.o: %.k3
	@CDLBINPATH@/cdlc -L @CDLINCPATH@/ $<

CDL3SRC = \
    affix.k3 \
    agfl.k3 \
    code.k3 \
    globals.k3 \
    heap.k3 \
    icoptimize.k3 \
    id.k3 \
    instructions.k3 \
    intermediate.k3 \
    io.k3 \
    lexer.k3 \
    list.k3 \
    modules.k3 \
    optimize.k3 \
    options.k3 \
    parser.k3 \
    properties.k3 \
    rule.k3 \
    set.k3 \
    textstorage.k3 \
    tokens.k3 \
    transduction.k3

CSRC = util.c warshall.c imatrix.c agflpattern.c dfa.c

agfl-coder$(EXEEXT): $(CDL3SRC:.k3=.o) $(CSRC:.c=.o)
	@LIBTOOL@ $(CC) -o $@ $^ $(agfl_coder_LDADD) $(agfl_coder_LDFLAGS) 

machdep.h: $(srcdir)/$(MACHDEP_HOST) $(srcdir)/machdep.common Makefile
	cat $(srcdir)/$(MACHDEP_HOST) $(srcdir)/machdep.common > $@

agflpattern.o: $(srcdir)/pattern.c

#
# CDL3 does not yet generate dependencies, so:
#
affix.o: affix.k3 globals.k3 io.k3 id.k3 set.k3 rule.k3 list.k3 textstorage.k3
agfl.o: agfl.k3 globals.k3 options.k3 affix.k3 set.k3 rule.k3 io.k3 id.k3 code.k3 \
        optimize.k3 properties.k3 parser.k3 modules.k3 transduction.k3 \
        intermediate.k3 icoptimize.k3 textstorage.k3
code.o: code.k3 globals.k3 io.k3 rule.k3 id.k3 transduction.k3 intermediate.k3 \
	instructions.k3 set.k3 textstorage.k3 affix.k3 optimize.k3
globals.o: globals.k3 io.k3
heap.o: heap.k3
icoptimize.o: icoptimize.k3 id.k3 rule.k3 intermediate.k3 optimize.k3
id.o: id.k3 globals.k3 set.k3 io.k3 rule.k3 properties.k3
instructions.o: instructions.k3 io.k3 set.k3 id.k3 rule.k3 intermediate.k3 textstorage.k3
intermediate.o: globals.k3 intermediate.k3 io.k3 rule.k3 id.k3 set.k3 \
		properties.k3 textstorage.k3 transduction.k3 optimize.k3
io.o: io.k3 globals.k3
lexer.o: lexer.k3 globals.k3 tokens.k3 id.k3 io.k3 rule.k3 properties.k3
list.o: list.k3
modules.o: modules.k3 globals.k3 io.k3
optimize.o: optimize.k3 globals.k3 rule.k3 properties.k3 io.k3 id.k3 \
	    list.k3 textstorage.k3 transduction.k3
options.o: options.k3 globals.k3 io.k3
parser.o: parser.k3 globals.k3 tokens.k3 io.k3 id.k3 lexer.k3 set.k3 \
	  affix.k3 rule.k3 properties.k3 modules.k3 textstorage.k3 transduction.k3
properties.o: properties.k3 globals.k3 rule.k3 io.k3 heap.k3 \
	      list.k3 textstorage.k3 transduction.k3 id.k3
rule.o: rule.k3 globals.k3 io.k3 id.k3 affix.k3 set.k3 properties.k3 \
	list.k3 optimize.k3 textstorage.k3 transduction.k3
set.o: set.k3 globals.k3 io.k3
textstorage.o: textstorage.k3 io.k3 id.k3
tokens.o: tokens.k3
transduction.o: transduction.k3 globals.k3 io.k3 properties.k3 rule.k3 id.k3 \
		textstorage.k3 intermediate.k3
