1#-------------------------------------------------------------------------
2#
3# Makefile for src/backend/snowball
4#
5# src/backend/snowball/Makefile
6#
7#-------------------------------------------------------------------------
8
9PGFILEDESC = "snowball - natural language stemmers"
10PGAPPICON = win32
11
12subdir = src/backend/snowball
13top_builddir = ../../..
14include $(top_builddir)/src/Makefile.global
15
16override CPPFLAGS := -I$(top_srcdir)/src/include/snowball \
17	-I$(top_srcdir)/src/include/snowball/libstemmer $(CPPFLAGS)
18
19OBJS = \
20	$(WIN32RES) \
21	api.o \
22	dict_snowball.o \
23	utilities.o
24
25OBJS += \
26	stem_ISO_8859_1_basque.o \
27	stem_ISO_8859_1_catalan.o \
28	stem_ISO_8859_1_danish.o \
29	stem_ISO_8859_1_dutch.o \
30	stem_ISO_8859_1_english.o \
31	stem_ISO_8859_1_finnish.o \
32	stem_ISO_8859_1_french.o \
33	stem_ISO_8859_1_german.o \
34	stem_ISO_8859_1_indonesian.o \
35	stem_ISO_8859_1_irish.o \
36	stem_ISO_8859_1_italian.o \
37	stem_ISO_8859_1_norwegian.o \
38	stem_ISO_8859_1_porter.o \
39	stem_ISO_8859_1_portuguese.o \
40	stem_ISO_8859_1_spanish.o \
41	stem_ISO_8859_1_swedish.o \
42	stem_ISO_8859_2_hungarian.o \
43	stem_ISO_8859_2_romanian.o \
44	stem_KOI8_R_russian.o \
45	stem_UTF_8_arabic.o \
46	stem_UTF_8_armenian.o \
47	stem_UTF_8_basque.o \
48	stem_UTF_8_catalan.o \
49	stem_UTF_8_danish.o \
50	stem_UTF_8_dutch.o \
51	stem_UTF_8_english.o \
52	stem_UTF_8_finnish.o \
53	stem_UTF_8_french.o \
54	stem_UTF_8_german.o \
55	stem_UTF_8_greek.o \
56	stem_UTF_8_hindi.o \
57	stem_UTF_8_hungarian.o \
58	stem_UTF_8_indonesian.o \
59	stem_UTF_8_irish.o \
60	stem_UTF_8_italian.o \
61	stem_UTF_8_lithuanian.o \
62	stem_UTF_8_nepali.o \
63	stem_UTF_8_norwegian.o \
64	stem_UTF_8_porter.o \
65	stem_UTF_8_portuguese.o \
66	stem_UTF_8_romanian.o \
67	stem_UTF_8_russian.o \
68	stem_UTF_8_serbian.o \
69	stem_UTF_8_spanish.o \
70	stem_UTF_8_swedish.o \
71	stem_UTF_8_tamil.o \
72	stem_UTF_8_turkish.o \
73	stem_UTF_8_yiddish.o
74
75# first column is language name and also name of dictionary for not-all-ASCII
76# words, second is name of dictionary for all-ASCII words
77# Note order dependency: use of some other language as ASCII dictionary
78# must come after creation of that language
79LANGUAGES=  \
80	arabic		arabic		\
81	armenian	armenian	\
82	basque		basque		\
83	catalan		catalan		\
84	danish		danish		\
85	dutch		dutch		\
86	english		english		\
87	finnish		finnish		\
88	french		french		\
89	german		german		\
90	greek		greek		\
91	hindi		english		\
92	hungarian	hungarian	\
93	indonesian	indonesian	\
94	irish		irish		\
95	italian		italian		\
96	lithuanian	lithuanian	\
97	nepali		nepali		\
98	norwegian	norwegian	\
99	portuguese	portuguese	\
100	romanian	romanian	\
101	russian		english		\
102	serbian		serbian		\
103	spanish		spanish		\
104	swedish		swedish		\
105	tamil		tamil		\
106	turkish		turkish		\
107	yiddish		yiddish
108
109
110SQLSCRIPT= snowball_create.sql
111DICTDIR=tsearch_data
112
113VPATH += $(srcdir)/libstemmer
114
115NAME := dict_snowball
116rpath =
117
118all: all-shared-lib $(SQLSCRIPT)
119
120include $(top_srcdir)/src/Makefile.shlib
121
122$(SQLSCRIPT): Makefile snowball_func.sql.in snowball.sql.in
123	echo '-- Language-specific snowball dictionaries' > $@
124	cat $(srcdir)/snowball_func.sql.in >> $@
125	@set -e; \
126	set $(LANGUAGES) ; \
127	while [ "$$#" -gt 0 ] ; \
128	do \
129		lang=$$1; shift; \
130		nonascdictname=$$lang; \
131		ascdictname=$$1; shift; \
132		if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \
133			stop=", StopWords=$${lang}" ; \
134		else \
135			stop=""; \
136		fi; \
137		cat $(srcdir)/snowball.sql.in | \
138			sed -e "s#_LANGNAME_#$$lang#g" | \
139			sed -e "s#_DICTNAME_#$${lang}_stem#g" | \
140			sed -e "s#_CFGNAME_#$$lang#g" | \
141			sed -e "s#_ASCDICTNAME_#$${ascdictname}_stem#g" | \
142			sed -e "s#_NONASCDICTNAME_#$${nonascdictname}_stem#g" | \
143			sed -e "s#_STOPWORDS_#$$stop#g" ; \
144	done >> $@
145
146install: all installdirs install-lib
147	$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
148	@set -e; \
149	set $(LANGUAGES) ; \
150	while [ "$$#" -gt 0 ] ; \
151	do \
152		lang=$$1; shift; shift; \
153		if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \
154			$(INSTALL_DATA) $(srcdir)/stopwords/$${lang}.stop '$(DESTDIR)$(datadir)/$(DICTDIR)' ; \
155		fi \
156	done
157
158installdirs: installdirs-lib
159	$(MKDIR_P) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'
160
161uninstall: uninstall-lib
162	rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
163	@set -e; \
164	set $(LANGUAGES) ; \
165	while [ "$$#" -gt 0 ] ; \
166	do \
167		lang=$$1; shift; shift;  \
168		if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \
169		    rm -f '$(DESTDIR)$(datadir)/$(DICTDIR)/'$${lang}.stop ; \
170		fi \
171	done
172
173clean distclean maintainer-clean: clean-lib
174	rm -f $(OBJS) $(SQLSCRIPT)
175