summaryrefslogtreecommitdiffstats
path: root/src/backend/snowball/Makefile
blob: 50b9199910c5b05eb4e99e69c94661b505eadfe5 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#-------------------------------------------------------------------------
#
# Makefile for src/backend/snowball
#
# src/backend/snowball/Makefile
#
#-------------------------------------------------------------------------

PGFILEDESC = "snowball - natural language stemmers"
PGAPPICON = win32

subdir = src/backend/snowball
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global

override CPPFLAGS := -I$(top_srcdir)/src/include/snowball \
	-I$(top_srcdir)/src/include/snowball/libstemmer $(CPPFLAGS)

OBJS = \
	$(WIN32RES) \
	api.o \
	dict_snowball.o \
	utilities.o

OBJS += \
	stem_ISO_8859_1_basque.o \
	stem_ISO_8859_1_catalan.o \
	stem_ISO_8859_1_danish.o \
	stem_ISO_8859_1_dutch.o \
	stem_ISO_8859_1_english.o \
	stem_ISO_8859_1_finnish.o \
	stem_ISO_8859_1_french.o \
	stem_ISO_8859_1_german.o \
	stem_ISO_8859_1_indonesian.o \
	stem_ISO_8859_1_irish.o \
	stem_ISO_8859_1_italian.o \
	stem_ISO_8859_1_norwegian.o \
	stem_ISO_8859_1_porter.o \
	stem_ISO_8859_1_portuguese.o \
	stem_ISO_8859_1_spanish.o \
	stem_ISO_8859_1_swedish.o \
	stem_ISO_8859_2_hungarian.o \
	stem_ISO_8859_2_romanian.o \
	stem_KOI8_R_russian.o \
	stem_UTF_8_arabic.o \
	stem_UTF_8_armenian.o \
	stem_UTF_8_basque.o \
	stem_UTF_8_catalan.o \
	stem_UTF_8_danish.o \
	stem_UTF_8_dutch.o \
	stem_UTF_8_english.o \
	stem_UTF_8_finnish.o \
	stem_UTF_8_french.o \
	stem_UTF_8_german.o \
	stem_UTF_8_greek.o \
	stem_UTF_8_hindi.o \
	stem_UTF_8_hungarian.o \
	stem_UTF_8_indonesian.o \
	stem_UTF_8_irish.o \
	stem_UTF_8_italian.o \
	stem_UTF_8_lithuanian.o \
	stem_UTF_8_nepali.o \
	stem_UTF_8_norwegian.o \
	stem_UTF_8_porter.o \
	stem_UTF_8_portuguese.o \
	stem_UTF_8_romanian.o \
	stem_UTF_8_russian.o \
	stem_UTF_8_serbian.o \
	stem_UTF_8_spanish.o \
	stem_UTF_8_swedish.o \
	stem_UTF_8_tamil.o \
	stem_UTF_8_turkish.o \
	stem_UTF_8_yiddish.o

# first column is language name and also name of dictionary for not-all-ASCII
# words, second is name of dictionary for all-ASCII words
# Note order dependency: use of some other language as ASCII dictionary
# must come after creation of that language
LANGUAGES=  \
	arabic		arabic		\
	armenian	armenian	\
	basque		basque		\
	catalan		catalan		\
	danish		danish		\
	dutch		dutch		\
	english		english		\
	finnish		finnish		\
	french		french		\
	german		german		\
	greek		greek		\
	hindi		english		\
	hungarian	hungarian	\
	indonesian	indonesian	\
	irish		irish		\
	italian		italian		\
	lithuanian	lithuanian	\
	nepali		nepali		\
	norwegian	norwegian	\
	portuguese	portuguese	\
	romanian	romanian	\
	russian		english		\
	serbian		serbian		\
	spanish		spanish		\
	swedish		swedish		\
	tamil		tamil		\
	turkish		turkish		\
	yiddish		yiddish


SQLSCRIPT= snowball_create.sql
DICTDIR=tsearch_data

VPATH += $(srcdir)/libstemmer

NAME := dict_snowball
rpath =

all: all-shared-lib $(SQLSCRIPT)

include $(top_srcdir)/src/Makefile.shlib

$(SQLSCRIPT): Makefile snowball_func.sql.in snowball.sql.in
	echo '-- Language-specific snowball dictionaries' > $@
	cat $(srcdir)/snowball_func.sql.in >> $@
	@set -e; \
	set $(LANGUAGES) ; \
	while [ "$$#" -gt 0 ] ; \
	do \
		lang=$$1; shift; \
		nonascdictname=$$lang; \
		ascdictname=$$1; shift; \
		if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \
			stop=", StopWords=$${lang}" ; \
		else \
			stop=""; \
		fi; \
		cat $(srcdir)/snowball.sql.in | \
			sed -e "s#_LANGNAME_#$$lang#g" | \
			sed -e "s#_DICTNAME_#$${lang}_stem#g" | \
			sed -e "s#_CFGNAME_#$$lang#g" | \
			sed -e "s#_ASCDICTNAME_#$${ascdictname}_stem#g" | \
			sed -e "s#_NONASCDICTNAME_#$${nonascdictname}_stem#g" | \
			sed -e "s#_STOPWORDS_#$$stop#g" ; \
	done >> $@

install: all installdirs install-lib
	$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
	@set -e; \
	set $(LANGUAGES) ; \
	while [ "$$#" -gt 0 ] ; \
	do \
		lang=$$1; shift; shift; \
		if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \
			$(INSTALL_DATA) $(srcdir)/stopwords/$${lang}.stop '$(DESTDIR)$(datadir)/$(DICTDIR)' ; \
		fi \
	done

installdirs: installdirs-lib
	$(MKDIR_P) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)'

uninstall: uninstall-lib
	rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
	@set -e; \
	set $(LANGUAGES) ; \
	while [ "$$#" -gt 0 ] ; \
	do \
		lang=$$1; shift; shift;  \
		if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \
		    rm -f '$(DESTDIR)$(datadir)/$(DICTDIR)/'$${lang}.stop ; \
		fi \
	done

clean distclean maintainer-clean: clean-lib
	rm -f $(OBJS) $(SQLSCRIPT)