diff --git a/Makefile b/Makefile index a30b53f..97272fe 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,6 @@ all: $(TARGETS) .PHONY: components components: cd $(SRC_DIR)/lib && make; cd $(CUR_DIR) - @for cmp in $(COMPONENTS); do\ cd $(SRC_DIR)/$$cmp && make; cd $(CUR_DIR); \ done @@ -29,6 +28,7 @@ documentation: .PHONY: configuration configuration: + cd $(CUR_DIR)/conf && make; cd $(CUR_DIR) .PHONY: libraries libraries: @@ -40,7 +40,7 @@ share: # cleanup section # ------------------------------------------------------------------ .PHONY: clean -clean: clean_components clean_documentation +clean: clean_components clean_documentation clean_config @echo "All files cleaned successfully!" .PHONY: clean_components @@ -54,12 +54,16 @@ clean_components: clean_documentation: cd $(CUR_DIR)/doc && make clean; cd $(CUR_DIR) +.PHONY: clean_config +clean_config: + cd $(CUR_DIR)/conf && make clean; cd $(CUR_DIR) + # ------------------------------------------------------------------ # install section # ------------------------------------------------------------------ .PHONY: install install: all install_dirs install_components install_configuration install_libraries install_documentation install_share - + .PHONY: install_dirs install_dirs: install -d $(PREFIX) \ diff --git a/conf/Makefile b/conf/Makefile index cd9f265..931e5cc 100644 --- a/conf/Makefile +++ b/conf/Makefile @@ -1,5 +1,16 @@ include ../config.mak +.PHONY: all +all: compiledic.conf cor.conf dgc.conf dgp.conf gph.conf grp.conf gue.conf kor.conf lem.conf mar.conf ser.conf utt.conf + +%.conf: %.conf.m4 + m4 --define=LANG_DIR=${LANG_DIR} --define=LIB_DIR=${LIB_DIR} $< > $@ + + +.PHONY: clean +clean: + rm *.conf + .PHONY: install install: ifdef CONF_DIR diff --git a/conf/compiledic.conf.m4 b/conf/compiledic.conf.m4 new file mode 100644 index 0000000..2ff6982 --- /dev/null +++ b/conf/compiledic.conf.m4 @@ -0,0 +1,13 @@ +# ************************************************************ +# * This file was created automatically during installation. * +# * If you don't need do not change it. * +# * * +# * UAM Text Tools * +# * Adam Mickiewicz University, Poland * +# * http://utt.amu.edu.pl * +# ************************************************************ +# +# All lines must looks like: +# parameter_name [=] value +# +symbols = LANG_DIR/pl_PL.ISO-8859-2/pl_PL.ISO-8859-2.sym diff --git a/conf/gue.conf b/conf/cor.conf.m4 similarity index 93% rename from conf/gue.conf rename to conf/cor.conf.m4 index 044cdd4..010c3a4 100644 --- a/conf/gue.conf +++ b/conf/cor.conf.m4 @@ -10,5 +10,5 @@ # All lines must looks like: # parameter_name [=] value # -dictionary-home = PATH_PREFIX/share/utt +dictionary-home = LANG_DIR process = W diff --git a/conf/dgc.conf b/conf/dgc.conf deleted file mode 100644 index 11a3bcf..0000000 --- a/conf/dgc.conf +++ /dev/null @@ -1,15 +0,0 @@ -# ************************************************************ -# * This file was created automatically during installation. * -# * If you don't need do not change it. * -# * * -# * UAM Text Tools * -# * Adam Mickiewicz University, Poland * -# * http://utt.amu.edu.pl * -# ************************************************************ -# -# All lines must looks like: -# parameter_name [=] value -# -categories = PATH_PREFIX/share/utt/cats.dgc -grammar = PATH_PREFIX/share/utt/gram.dgc -outputfile = PATH_PREFIX/share/utt/gram.dgp diff --git a/conf/compiledic.conf b/conf/dgc.conf.m4 similarity index 86% rename from conf/compiledic.conf rename to conf/dgc.conf.m4 index a7e7574..647bd7e 100644 --- a/conf/compiledic.conf +++ b/conf/dgc.conf.m4 @@ -10,4 +10,6 @@ # All lines must looks like: # parameter_name [=] value # -symbols = PATH_PREFIX/share/utt/pl_PL.ISO-8859-2/pl_PL.ISO-8859-2.sym +categories = LANG_DIR/cats.dgc +grammar = LANG_DIR/gram.dgc +outputfile = LANG_DIR/gram.dgp diff --git a/conf/dgp.conf b/conf/dgp.conf.m4 similarity index 93% rename from conf/dgp.conf rename to conf/dgp.conf.m4 index 938affa..370a31a 100644 --- a/conf/dgp.conf +++ b/conf/dgp.conf.m4 @@ -11,7 +11,7 @@ # parameter_name [=] value # -grammar = PATH_PREFIX/share/utt/gram.dgp +grammar = LANG_DIR/gram.dgp process = W process = BOS process = EOS diff --git a/conf/gph.conf b/conf/gph.conf.m4 similarity index 100% rename from conf/gph.conf rename to conf/gph.conf.m4 diff --git a/conf/mar.conf b/conf/grp.conf.m4 similarity index 93% rename from conf/mar.conf rename to conf/grp.conf.m4 index 4fdf0f0..56b1182 100644 --- a/conf/mar.conf +++ b/conf/grp.conf.m4 @@ -10,6 +10,6 @@ # All lines must looks like: # parameter_name [=] value # -macros = PATH_PREFIX/lib/utt/terms.m4 +macros = LIB_DIR/terms.m4 tags=uam diff --git a/conf/cor.conf b/conf/gue.conf.m4 similarity index 93% rename from conf/cor.conf rename to conf/gue.conf.m4 index 044cdd4..010c3a4 100644 --- a/conf/cor.conf +++ b/conf/gue.conf.m4 @@ -10,5 +10,5 @@ # All lines must looks like: # parameter_name [=] value # -dictionary-home = PATH_PREFIX/share/utt +dictionary-home = LANG_DIR process = W diff --git a/conf/kor.conf b/conf/kor.conf.m4 similarity index 87% rename from conf/kor.conf rename to conf/kor.conf.m4 index e4b9315..593976f 100644 --- a/conf/kor.conf +++ b/conf/kor.conf.m4 @@ -10,7 +10,7 @@ # All lines must looks like: # parameter_name [=] value # -dictionary-home = PATH_PREFIX/share/utt -weights = PATH_PREFIX/share/utt/weights.kor +dictionary-home = LANG_DIR +weights = LANG_DIR/weights.kor threshold = 1.0 process=W diff --git a/conf/lem.conf b/conf/lem.conf.m4 similarity index 93% rename from conf/lem.conf rename to conf/lem.conf.m4 index 044cdd4..010c3a4 100644 --- a/conf/lem.conf +++ b/conf/lem.conf.m4 @@ -10,5 +10,5 @@ # All lines must looks like: # parameter_name [=] value # -dictionary-home = PATH_PREFIX/share/utt +dictionary-home = LANG_DIR process = W diff --git a/conf/grp.conf b/conf/mar.conf.m4 similarity index 93% rename from conf/grp.conf rename to conf/mar.conf.m4 index 4fdf0f0..56b1182 100644 --- a/conf/grp.conf +++ b/conf/mar.conf.m4 @@ -10,6 +10,6 @@ # All lines must looks like: # parameter_name [=] value # -macros = PATH_PREFIX/lib/utt/terms.m4 +macros = LIB_DIR/terms.m4 tags=uam diff --git a/conf/ser.conf b/conf/ser.conf deleted file mode 100644 index 3e52657..0000000 --- a/conf/ser.conf +++ /dev/null @@ -1,15 +0,0 @@ -# ************************************************************ -# * This file was created automatically during installation. * -# * If you don't need do not change it. * -# * * -# * UAM Text Tools * -# * Adam Mickiewicz University, Poland * -# * http://utt.amu.edu.pl * -# ************************************************************ -# -# All lines must looks like: -# parameter_name [=] value -# -macros = PATH_PREFIX/lib/utt/terms.m4 -flex-template = PATH_PREFIX/lib/utt/ser.l.template -tags=uam diff --git a/conf/ser.conf.m4 b/conf/ser.conf.m4 new file mode 100644 index 0000000..ea1589e --- /dev/null +++ b/conf/ser.conf.m4 @@ -0,0 +1,15 @@ +# ************************************************************ +# * This file was created automatically during installation. * +# * If you don't need do not change it. * +# * * +# * UAM Text Tools * +# * Adam Mickiewicz University, Poland * +# * http://utt.amu.edu.pl * +# ************************************************************ +# +# All lines must looks like: +# parameter_name [=] value +# +macros = LIB_DIR/terms.m4 +flex-template = LIB_DIR/ser.l.template +tags=uam diff --git a/conf/utt.conf b/conf/utt.conf.m4 similarity index 100% rename from conf/utt.conf rename to conf/utt.conf.m4 diff --git a/src/common/common.cc b/src/common/common.cc index 6803139..c7f4a57 100644 --- a/src/common/common.cc +++ b/src/common/common.cc @@ -108,6 +108,7 @@ extern void process_config_files(gengetopt_args_info* args, char* argv0) // obsluga systemowego pliku konfiguracyjnego dla programu sprintf(config_file, "%s/%s.conf", SYSTEM_CONFIG_DIR, program_name); + if (file_accessible(config_file) == 0) { if (cmdline_parser_configfile(config_file, args, diff --git a/src/common/common.d b/src/common/common.d index e69de29..577e416 100644 --- a/src/common/common.d +++ b/src/common/common.d @@ -0,0 +1,2 @@ +common.o: ../common/common.cc ../common/common.h ../common/../lib/const.h \ + ../common/../dgp/cmdline.h diff --git a/src/lem/Makefile b/src/lem/Makefile index 64fceb4..b3a0a98 100644 --- a/src/lem/Makefile +++ b/src/lem/Makefile @@ -1,3 +1,5 @@ +include ../../config.mak + LDFLAGS += -static CXXFLAGS += -O2 -fpermissive @@ -39,7 +41,14 @@ clean: clean.cmdline clean.cmdline: rm cmdline.* || true -copy: -ifdef UTT_BIN_DIR - cp lem $(UTT_BIN_DIR) +.PHONY: install +install: +ifdef BIN_DIR + install -m 0755 lem $(BIN_DIR) +endif + +.PHONY: uninstall +uninstall: +ifdef BIN_DIR + rm $(BIN_DIR)/lem endif diff --git a/src/lem/main.cc b/src/lem/main.cc index a963aff..e2897d4 100644 --- a/src/lem/main.cc +++ b/src/lem/main.cc @@ -32,7 +32,7 @@ int main(int argc, char** argv) { else if(strcmp(dictionary+strlen(dictionary)-4,".dic")==0) lem = new AuxLem(dictionary); else - fprintf(stderr,"lem: Invalid dictionary file extension.\n"); + fprintf(stderr,"lem: Dictionary file not found.\n"); Words tab; // Segment seg; diff --git a/src/lib/const.h b/src/lib/const.h index 36d9399..acdcd35 100644 --- a/src/lib/const.h +++ b/src/lib/const.h @@ -20,5 +20,5 @@ #define GUESS_DICT_FILE "slownik.fsa" // katalogi z plikami konfiguracyjnymi -#define SYSTEM_CONFIG_DIR "/usr/local/etc/utt" +#define SYSTEM_CONFIG_DIR "/etc/utt" #define USER_CONFIG_DIR "~/.utt"