## Include this file to lexc directory to build lexical automata ## Copyright (C) 2011 Samediggi ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . ########### Variables: ########### HFST_LEXC_FLAGS=$(HFST_LEXC_LOCAL_FLAGS) # Hyperminimisation using autogenerated flag diacritics, off by default: if WANT_HYPERMINIMISATION HFST_LEXC_FLAGS+= --withFlags endif # WANT_HYPERMINIMISATION # Foma-like hyperminimisation by aligning symbols, off by default: if WANT_LEXC_ALIGNMENT HFST_LEXC_FLAGS+= --alignStrings endif # WANT_LEXC_ALIGNMENT ####### Source file defs: ######## #! @param GT_LEXC_ROOT required, define name of file holding root lexicon #! @param GT_LEXC_SRCS optional, space separated list of file names holding #! supplementary lexicon data #! @param GENERATED_LEXC_SRCS optional, space separated list of file names #! holding supplementary lexicon data generated from xml files. #! @param GT_XML_SRCS optional, space separated list of xml source file names # Shared source files GT_SHARED_SRCS=url.lexc GT_LEXC_ALLSRC=$(GT_LEXC_ROOT) $(GT_LEXC_SRCS_L1_L2) $(L1) $(L2) \ $(GENERATED_LEXC_SRCS) $(GT_XML_SRCS) $(GT_LOCAL_SRCS) \ $(GT_SHARED_SRCS) $(GT_DISTRO_SRCS) # All sources need to be included in the tarball EXTRA_DIST=$(GT_LEXC_ALLSRC) ####### Automake targets: ######## # The transducers we build and don't distribute depend on the configuration: GT_LEXICAL= if CAN_HFST GT_LEXICAL+=lexicon.hfst if WANT_REVERSED_INTERSECT GT_LEXICAL+=lexicon.rev.hfst endif # WANT_REVERSED_INTERSECT endif # CAN_HFST if CAN_XFST GT_LEXICAL+=lexicon.xfst endif # CAN_XFST if CAN_FOMA GT_LEXICAL+=lexicon.foma endif # CAN_FOMA # Define variable before using it: GIELLA_LOCAL_SRC_TARGETS= # Generate the filter targets from the source filenames: if CAN_HFST GIELLA_LOCAL_SRC_TARGETS+=\ $(patsubst %.lexc,%.hfst,$(GT_LOCAL_SRCS) $(GT_SHARED_SRCS)) GIELLA_LOCAL_SRC_TARGETS+=$(patsubst %.xfscript,%.hfst,$(GT_LOCAL_XFSCRIPT_SRCS)) endif # CAN_HFST if CAN_XFST GIELLA_LOCAL_SRC_TARGETS+=\ $(patsubst %.lexc,%.xfst,$(GT_LOCAL_SRCS) $(GT_SHARED_SRCS)) GIELLA_LOCAL_SRC_TARGETS+=$(patsubst %.xfscript,%.xfst,$(GT_LOCAL_XFSCRIPT_SRCS)) endif # CAN_XFST if CAN_FOMA GIELLA_LOCAL_SRC_TARGETS+=\ $(patsubst %.lexc,%.foma,$(GT_LOCAL_SRCS) $(GT_SHARED_SRCS)) GIELLA_LOCAL_SRC_TARGETS+=$(patsubst %.xfscript,%.foma,$(GT_LOCAL_XFSCRIPT_SRCS)) endif # CAN_FOMA if WANT_L2 if CAN_HFST GT_LEXICAL+=lexicon-L2.hfst endif # CAN_HFST if WANT_REVERSED_INTERSECT GT_LEXICAL+=lexicon-L2.rev.hfst endif # WANT_REVERSED_INTERSECT if CAN_XFST GT_LEXICAL+=lexicon-L2.xfst endif # CAN_XFST if CAN_FOMA GT_LEXICAL+=lexicon-L2.foma endif # CAN_FOMA endif # WANT_L2 noinst_DATA=$(GT_LEXICAL) $(GIELLA_LOCAL_SRC_TARGETS) $(GIELLA_LOCAL_TARGETS) ####### XML2LEXC build rules: #### XSLDIR = $(GTCORE)/scripts/xsl if CAN_SAXON $(srcdir)/stems/%.lexc: stems/%.xml $(XSLDIR)/generate_lex-fileVM.xsl $(AM_V_SAXON)$(SAXON) -xsl:$(XSLDIR)/generate_lex-fileVM.xsl \ $(abs_srcdir)/$< inFile=$(abs_builddir)/$< > $@ else if CAN_JAVA MF = -Xmx1024m #EF = -it main # Saxon-B compatible version EF = -it:main # Saxon-HE compatible version XSLPROC = net.sf.saxon.Transform # This target will convert each individual xml file to lexc: $(srcdir)/stems/%.lexc: stems/%.xml $(XSLDIR)/generate_lex-fileVM.xsl $(AM_V_XSLPROC)$(JV) $(MF) \ -cp $$(@CYGWINJAVAPATH@ "@SAXONJAR@") $(XSLPROC) \ $(EF) $$(@CYGWINJAVAPATH@ "$(XSLDIR)/generate_lex-fileVM.xsl") \ inFile=$$(@CYGWINJAVAPATH@ "$(abs_builddir)/$<") > $@ endif endif ####### Concatenate all lexc files - Xerox lexc doesn't quit on fail, and ####### Xerox xfst can only read one lexc file (we prefer to get an error ####### when something doesn't work); hfst does the concatenation automatically ####### but by doing it explicitly we have a source file to relate line numbers ####### in error messages to. Foma can only read a single lexc file. lexicon.tmp.lexc: $(GT_LEXC_ROOT) $(GT_LEXC_SRCS) $(GENERATED_LEXC_SRCS) $(AM_V_GEN)cat $^ > $@ lexicon-L2.tmp.lexc: $(GT_LEXC_ROOT) $(GT_LEXC_L2_SRCS) $(GENERATED_LEXC_SRCS) $(AM_V_GEN)cat $^ > $@ # Copy shared files to local dir before building: %.lexc: $(GIELLA_SHARED)/all_langs/src/morphology/%.lexc $(AM_V_CP)cp -f $< $@ ####### If reversed compose-intersect is enabled, reverse it here: ####### %.rev.hfst: %.hfst $(AM_V_REVERSE)$(HFST_REVERSE) $< > $@ ####### TMP files to allow local overrides - copy by default: ####### DEPGEN=$(AM_V_CP)cp -f $< $@ %.foma: %.tmp.foma ; $(DEPGEN) %.hfst: %.tmp.hfst ; $(DEPGEN) %.xfst: %.tmp.xfst ; $(DEPGEN) ####### Other targets: ########### clean-local: -rm -f *.all.* *fst *.script generated_files/*.lexc lexicon.* maintainer-clean-local: -rm -f $(GENERATED_LEXC_SRCS) include $(top_srcdir)/am-shared/lexc-include.am include $(top_srcdir)/am-shared/xfscript-include.am include $(top_srcdir)/am-shared/hfst-format-include.am include $(top_srcdir)/am-shared/silent_build-include.am # vim: set ft=automake: