diff --git a/GNUmakefile b/GNUmakefile index 5cb2179..7a2881a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,6 +3,7 @@ # After changing this, run `make update_version` to update various sources # which hard-code it. SNOWBALL_VERSION = 2.1.0 +MAJOR_VERSION := $(shell echo $(SNOWBALL_VERSION) | cut -d. -f1) c_src_dir = src_c @@ -162,10 +163,23 @@ C_OTHER_OBJECTS = $(C_OTHER_SOURCES:.c=.o) JAVA_CLASSES = $(JAVA_SOURCES:.java=.class) JAVA_RUNTIME_CLASSES=$(JAVARUNTIME_SOURCES:.java=.class) -CFLAGS=-O2 -W -Wall -Wmissing-prototypes -Wmissing-declarations -CPPFLAGS=-Iinclude +CFLAGS+=-fPIC -W -Wall -Wmissing-prototypes -Wmissing-declarations +CPPFLAGS+=-Iinclude -all: snowball libstemmer.o stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS) +all: snowball libstemmer.o libstemmer.so libstemmer.a stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS) +libstemmer.o: libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS) + $(AR) -cru $@ $^ + +libstemmer.so: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS) + $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname,$@.$(MAJOR_VERSION),-version-script,libstemmer/symbol.map -o $@.$(SNOWBALL_VERSION) $^ + ln -s $@.$(SNOWBALL_VERSION) $@.$(MAJOR_VERSION) + ln -s $@.$(SNOWBALL_VERSION) $@ + +libstemmer.a: libstemmer.o + $(AR) -crs $@ $^ + +stemwords: $(STEMWORDS_OBJECTS) libstemmer.o + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ clean: rm -f $(COMPILER_OBJECTS) $(RUNTIME_OBJECTS) \ --- /dev/null +++ b/libstemmer/symbol.map @@ -0,0 +1,6 @@ +SB_STEMMER_0 { + global: + sb_stemmer_*; + local: + *; +};