-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.in
101 lines (88 loc) · 3.58 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Lemmatizer makefile:
# - build libs and executables
# - generate binary dicts
# - simple regression test
# - install with conjunction in ldconfig
#
# Kisel Jan, [email protected]
#
RML=`pwd`
RMLROOT=@RMLROOT@
ENVCMD=env RML=$(RML) LD_LIBRARY_PATH=$(RML)/Bin:$(LD_LIBRARY_PATH)
CPPHDR_FIND_MASK=-type f -a \( -name '*.hpp' -o -name '*.hxx' -o -name '*.h' \)
SOURCES=Source/MorphGen Source/Interfaces/cpp Source/Interfaces/c Source/RegressionTest
COMPAT_DIR=@COMPAT_DIR@
# special meaning of _STATIC env for lemmatizer install
SKIPBINS=
ifeq "$(_STATIC)" "1"
SKIPBINS:=yes
endif
all: src.all dicts test
@echo Ready to install
# last target should give a fastest variant since it will be used
# for dictionary building
src.all:
@for lib in shared static; do \
echo "=============================================="; \
echo BUILD LIBRARIES: $$lib; \
echo "=============================================="; \
$(MAKE) $(MAKE_FLAGS) RML=$(RML) mode=release libmode=$$lib src; \
done
@cd Bin;\
unlink libclemmatiser.a >/dev/null 2>&1; \
ln -s libclemmatiserrst.a libclemmatiser.a; \
unlink libclemmatiser.so >/dev/null 2>&1; \
ln -s libclemmatiserrsh.so libclemmatiser.so
src:
for d in ${SOURCES}; do ${MAKE} -C $$d $(MAKE_FLAGS); done
dicts: do_dictc_dir Dicts/SrcMorph/Rus.mwz Dicts/SrcMorph/Eng.mwz
$(ENVCMD) Source/MorphGen/MorphGen Dicts/SrcMorph/Eng.mwz Dicts/Morph/Eng 5 3
$(ENVCMD) Source/MorphGen/MorphGen Dicts/SrcMorph/Rus.mwz Dicts/Morph/Rus 5 3
do_dictc_dir:
for d in Eng Rus; do \
mkdir -p Dicts/Morph/$$d 2>&1 >/dev/null || true; \
done
test:
$(ENVCMD) Source/RegressionTest/RegressionTest | diff -q -B -w Test/RegressionTest.out -
@echo "Test(s) passed, lemmatizer seems to be OK"
dictclean: clean
rm -rf Dicts/Morph/Rus Dicts/Morph/Eng
clean:
@for lib in shared static; do \
for t in ${SOURCES}; do \
$(MAKE) -C $$t $(MAKE_FLAGS) RML=$(RML) mode=release libmode=$$lib clean; \
done; \
done
@find Bin/ -type f \! -name '.exists' -delete
@find Bin/ -type l -delete
install:
@echo installing to ${RMLROOT}...
@test `id -u` -eq 0 && echo "installing as system-wide" || echo "installing as local"
@mkdir -p ${RMLROOT} >/dev/null 2>&1 || true
@$(RM) -rf ${RMLROOT}/Bin ${RMLROOT}/lib && if [ -z ${SKIPBINS} ]; then cp -R Bin ${RMLROOT}; (cd ${RMLROOT}; ln -s Bin lib); fi
@$(RM) -rf ${RMLROOT}/Dicts && mkdir ${RMLROOT}/Dicts && cp -R Dicts/Morph ${RMLROOT}/Dicts
@echo copying header files...
@$(RM) -rf ${RMLROOT}/Source ${RMLROOT}/include
@(find . -type f -and \( -name '*.h' -o -name '*.hpp' \) | tar -T - -cf - ) | (tar -C ${RMLROOT} -xf -)
@(cd ${RMLROOT}; ln -s Source include)
@cp rml.ini ${RMLROOT}/
@if [ `id -u` -eq 0 ]; then \
PKGCONFDIR=`pkg-config --debug 2>&1 | sed -ne "/Scanning directory /{s///;s/'//gp;q;}"`; \
echo installing pkgconfigs to $$PKGCONFDIR; \
install -v pkgconfig/*.pc $$PKGCONFDIR/ || exit 1; \
echo trying to register library; \
if [ -d /etc/ld.so.conf.d ]; then \
echo ${RMLROOT}/Bin >/etc/ld.so.conf.d/lemmatizer.conf && /sbin/ldconfig; \
elif [ -e /etc/ld.so.conf ]; then \
echo ${RMLROOT}/Bin >>/etc/ld.so.conf && /sbin/ldconfig; \
else \
echo ld.so.conf not found, please add library path ${RMLROOT}/Bin manually; \
fi; \
if [ ! ${COMPAT_DIR} -ef ${RMLROOT} ]; then \
rm -rf ${COMPAT_DIR}; ln -s ${RMLROOT} ${COMPAT_DIR} && echo "!!! ${COMPAT_DIR} created for compatibility"; \
fi; \
fi
@echo
@echo SUCCESSFULLY installed to ${RMLROOT}
distclean: clean dictclean
-rm -f Makefile pkgconfig/*.pc