Blame Makefile.in

Packit ca9683
# Hspell Makefile
Packit ca9683
# Copyright (C) 2002-2015 Nadav Har'El and Dan Kenigsberg
Packit ca9683
Packit ca9683
# A comment about parallel make:
Packit ca9683
# Unfortunately, parallel make deals with rules with multiple targets in a way
Packit ca9683
# I can only describe as "useless". If one rule has multiple targets, and
Packit ca9683
# more than one of them appear as dependencies in other rules, parallel make
Packit ca9683
# may run the rule more than once concurrently! To work around this problem,
Packit ca9683
# we need to change every rule of the form:
Packit ca9683
#	a b c:
Packit ca9683
#		... create a b and c
Packit ca9683
# to the form:
Packit ca9683
#	a:
Packit ca9683
#		... create a b and c
Packit ca9683
#	b c: a
Packit ca9683
# Now, the real rule will be run just once, because "a" will be created just
Packit ca9683
# once. This workaround is used several times in the Makefile below.
Packit ca9683
Packit ca9683
# Locale override:
Packit ca9683
# Some of the things we do here (like sort), and Perl scripts we run can be
Packit ca9683
# distracted by the user's locale setting, which are irrelevant - Hspell's
Packit ca9683
# source and data are all in ISO-8859-8, and that has nothing to do with the
Packit ca9683
# builder's choice of locale. So we need to override them. The best would
Packit ca9683
# have been to do:
Packit ca9683
#     export LANG=C
Packit ca9683
#     export LC_ALL=C
Packit ca9683
# But the "export" directive is only supported by Gnu make, so let's instead
Packit ca9683
# redfine all the relevant LC_* variables the user might have set... Note that
Packit ca9683
# the following only modified environment variables that were already exported
Packit ca9683
# by the user - which is actually ok (but this makes us have to set all these
Packit ca9683
# different variables).
Packit ca9683
LANG=C
Packit ca9683
LC_ALL=C
Packit ca9683
LC_CTYPE=C
Packit ca9683
LC_COLLATE=C
Packit ca9683
Packit ca9683
# If making one of the intermediate targets failed in the middle delete it,
Packit ca9683
# so the partially built output file doesn't look like a legitimate file
Packit ca9683
# on the next "make" run.
Packit ca9683
.DELETE_ON_ERROR:
Packit ca9683
Packit ca9683
@SET_MAKE@
Packit ca9683
Packit ca9683
# build and installation paths
Packit ca9683
prefix = @prefix@
Packit ca9683
exec_prefix = @exec_prefix@
Packit ca9683
datarootdir = @datarootdir@
Packit ca9683
Packit ca9683
DESTDIR =
Packit ca9683
PREFIX = @prefix@
Packit ca9683
BIN = @bindir@
Packit ca9683
SHARE = @datadir@/hspell
Packit ca9683
LIBEXEC = @libexecdir@/hspell
Packit ca9683
MAN1 = @mandir@/man1
Packit ca9683
MAN3 = @mandir@/man3
Packit ca9683
LIBDIR = @libdir@
Packit ca9683
INCLUDEDIR = @includedir@
Packit ca9683
Packit ca9683
DICTBASE = @DICTBASE@
Packit ca9683
Packit ca9683
PERL=@PERL@
Packit ca9683
CC=@CC@
Packit ca9683
Packit ca9683
DEFS=@DEFS@ -DDICTIONARY_BASE=\"$(DICTBASE)\"
Packit ca9683
CFLAGS=@CFLAGS@
Packit ca9683
LIBS=@LIBS@
Packit ca9683
CPPFLAGS=@CPPFLAGS@
Packit ca9683
LDFLAGS=@LDFLAGS@
Packit ca9683
Packit ca9683
STRIP=strip
Packit ca9683
Packit ca9683
.c.o:
Packit ca9683
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) $<
Packit ca9683
Packit ca9683
# For building a shared library (--enable-shared)
Packit ca9683
%.lo: %.c
Packit ca9683
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) -fPIC -DPIC -o $@ $<
Packit ca9683
Packit ca9683
Packit ca9683
# Our TARGETS variable chooses what to compile. Some things are
Packit ca9683
# optionally compiled depending on --enable-* paramters to configure.
Packit ca9683
TARGETS = @TARGETS@
Packit ca9683
all: $(TARGETS)
Packit ca9683
Packit ca9683
# SEDCMD controls on whether objective-kinuyim - about 130,000 rare verb
Packit ca9683
# forms - are left during build or removed. It is set to the appropriate
Packit ca9683
# strings when "configure" is run (depending on whether --enable-fatverb
Packit ca9683
# is given).
Packit ca9683
SEDCMD=@SEDCMD@
Packit ca9683
Packit ca9683
# EXTRAOBJECTS - for --enable-linginfo
Packit ca9683
EXTRAOBJECTS=@EXTRAOBJECTS@
Packit ca9683
Packit ca9683
clean:
Packit ca9683
	rm -f wunzip wordlist.wgz shemp.dat \
Packit ca9683
	      corlist.o dict_radix.o find_sizes.o gimatria.o \
Packit ca9683
	      hspell.o tclHash.o hebrew.wgz hebrew.wgz.sizes \
Packit ca9683
	      hebrew.wgz.prefixes shemp.hif shemp.dat \
Packit ca9683
	      nouns.hif verbs.hif hspell find_sizes \
Packit ca9683
	      prefixes.c libhspell.o libhspell.a hspell.exe \
Packit ca9683
	      hebrew.wgz.desc hebrew.wgz.stems he_affix.dat \
Packit ca9683
	      he.wl mk_he_affix linginfo.o mk_he_affix.o \
Packit ca9683
	      hebrew.wgz.lingsizes.tmp dmask.c \
Packit ca9683
	      spell-he.xpi he.dic he.aff README-he.txt \
Packit ca9683
	      README_he_IL.txt he_IL.dic he_IL.aff he_IL.zip \
Packit ca9683
	      specfilter.o specfilter he.rws libhspell.so.0 libhspell.so \
Packit ca9683
	      dict_radix.lo gimatria.lo corlist.lo libhspell.lo linginfo.lo \
Packit ca9683
	      he.xpi misc/dictionaries/he.dic misc/dictionaries/he.aff \
Packit ca9683
	      misc/dictionaries/license.txt misc/dictionaries/README-he.txt
Packit ca9683
Packit ca9683
distclean: clean
Packit ca9683
	rm -f Makefile config.log config.status
Packit ca9683
Packit ca9683
# On Windows, this would typically be set to hspell.exe
Packit ca9683
HSPELL_EXECUTABLE=hspell
Packit ca9683
Packit ca9683
install: all
Packit ca9683
	test -d $(DESTDIR)$(BIN) || mkdir -m 755 -p $(DESTDIR)$(BIN)
Packit ca9683
	$(STRIP) $(HSPELL_EXECUTABLE)
Packit ca9683
	-rm -f $(DESTDIR)$(BIN)/$(HSPELL_EXECUTABLE)
Packit ca9683
	cp $(HSPELL_EXECUTABLE) $(DESTDIR)$(BIN)/$(HSPELL_EXECUTABLE)
Packit ca9683
	chmod 755 $(DESTDIR)$(BIN)/$(HSPELL_EXECUTABLE)
Packit ca9683
	cp multispell $(DESTDIR)$(BIN)/multispell
Packit ca9683
	chmod 755 $(DESTDIR)$(BIN)/multispell
Packit ca9683
	test -d $(DESTDIR)$(SHARE) || mkdir -m 755 -p $(DESTDIR)$(SHARE)
Packit ca9683
	cp hebrew.wgz hebrew.wgz.prefixes hebrew.wgz.sizes $(DESTDIR)$(SHARE)/
Packit ca9683
	gzip -9n < spellinghints > $(DESTDIR)$(SHARE)/hebrew.wgz.hints
Packit ca9683
	(cd $(DESTDIR)$(SHARE); chmod 644 hebrew.wgz hebrew.wgz.prefixes hebrew.wgz.sizes hebrew.wgz.hints)
Packit ca9683
	test ! -f hebrew.wgz.stems || cp hebrew.wgz.stems hebrew.wgz.desc $(DESTDIR)$(SHARE)/
Packit ca9683
	(cd $(DESTDIR)$(SHARE); test ! -f hebrew.wgz.stems || chmod 644 hebrew.wgz.stems hebrew.wgz.desc)
Packit ca9683
	-rm -f $(DESTDIR)$(BIN)/hspell-i
Packit ca9683
	-ln -s $(HSPELL_EXECUTABLE) $(DESTDIR)$(BIN)/hspell-i
Packit ca9683
	test -d $(DESTDIR)$(MAN1) || mkdir -m 755 -p $(DESTDIR)$(MAN1)
Packit ca9683
	cp hspell.1 $(DESTDIR)$(MAN1)/
Packit ca9683
	chmod 644 $(DESTDIR)$(MAN1)/hspell.1
Packit ca9683
	test -d $(DESTDIR)$(MAN3) || mkdir -m 755 -p $(DESTDIR)$(MAN3)
Packit ca9683
	cp hspell.3 $(DESTDIR)$(MAN3)/
Packit ca9683
	chmod 644 $(DESTDIR)$(MAN3)/hspell.3
Packit ca9683
	test -d $(DESTDIR)$(LIBDIR) || mkdir -m 755 -p $(DESTDIR)$(LIBDIR)
Packit ca9683
	cp libhspell.a $(DESTDIR)$(LIBDIR)/
Packit ca9683
	chmod 644 $(DESTDIR)$(LIBDIR)/libhspell.a
Packit ca9683
	test -d $(DESTDIR)$(INCLUDEDIR) || mkdir -m 755 -p $(DESTDIR)$(INCLUDEDIR)
Packit ca9683
	cp hspell.h linginfo.h $(DESTDIR)$(INCLUDEDIR)/
Packit ca9683
	chmod 644 $(DESTDIR)$(INCLUDEDIR)/hspell.h $(DESTDIR)$(INCLUDEDIR)/linginfo.h
Packit ca9683
	test -f libhspell.so.0 && cp libhspell.so.0 $(DESTDIR)$(LIBDIR)/
Packit ca9683
	test -f libhspell.so.0 && chmod 755 $(DESTDIR)$(LIBDIR)/libhspell.so.0
Packit ca9683
	test -f libhspell.so.0 && ln -sf libhspell.so.0 $(DESTDIR)$(LIBDIR)/libhspell.so
Packit ca9683
Packit ca9683
Packit ca9683
################################################
Packit ca9683
# for creating an hspell distribution tar
Packit ca9683
PACKAGE = hspell
Packit ca9683
VERSION = 1.4
Packit ca9683
DISTFILES = COPYING INSTALL LICENSE README WHATSNEW \
Packit ca9683
	Makefile.in stats wunzip.c wzip \
Packit ca9683
	hspell.1 \
Packit ca9683
	wolig.pl wolig.dat biza-nouns.hif milot.hif extrawords.hif \
Packit ca9683
	woo woo.dat biza-verbs.hif \
Packit ca9683
	likelyerrors spellinghints \
Packit ca9683
	corlist.c dict_radix.c \
Packit ca9683
	dict_radix.h find_sizes.c gimatria.c hspell.c \
Packit ca9683
	hspell.h libhspell.c gzbuffered.h \
Packit ca9683
	pmerge PrefixBits.pl genprefixes.pl \
Packit ca9683
	hash.h tclHash.c tclHash.h \
Packit ca9683
        binarize-desc.pl pack-desc.pl linginfo.c linginfo.h \
Packit ca9683
	multispell hspell.3 mk_he_affix.c configure.in configure \
Packit ca9683
	misc/install.rdf.pre specfilter.c \
Packit ca9683
	doc/niqqudless.odt test/test1 test/test1.dat
Packit ca9683
Packit ca9683
DISTDIR = $(PACKAGE)-$(VERSION)
Packit ca9683
Packit ca9683
distdir:
Packit ca9683
	rm -rf ./$(DISTDIR)
Packit ca9683
	mkdir -m 755 $(DISTDIR)
Packit ca9683
	cp -a --parents $(DISTFILES) $(DISTDIR)
Packit ca9683
	#cp -a $(DISTFILES) $(DISTDIR)
Packit ca9683
# Note that Oron Peled suggested a more eleborate version that makes hard
Packit ca9683
# links instead of copies:
Packit ca9683
#	for file in $(DISTFILES); do \
Packit ca9683
#		if test -d $$file; then \
Packit ca9683
#			cp -pr $$file $(distdir)/$$file; \
Packit ca9683
#		else \
Packit ca9683
#			test -f $(distdir)/$$file \
Packit ca9683
#			|| ln $$file $(distdir)/$$file 2> /dev/null \
Packit ca9683
#			|| cp -p $$file $(distdir)/$$file || :; \
Packit ca9683
#		fi; \
Packit ca9683
#	done
Packit ca9683
Packit ca9683
dist: distdir
Packit ca9683
	tar zcvf $(DISTDIR).tar.gz $(DISTDIR)
Packit ca9683
	rm -rf ./$(DISTDIR)
Packit ca9683
Packit ca9683
############################################################################
Packit ca9683
Packit ca9683
LIBOBJS=dict_radix.o gimatria.o corlist.o libhspell.o $(EXTRAOBJECTS)
Packit ca9683
libhspell.a: $(LIBOBJS)
Packit ca9683
	-rm -f $@
Packit ca9683
	ar cr $@ $^
Packit ca9683
	-ranlib $@
Packit ca9683
Packit ca9683
# For building a shared library (--enable-shared)
Packit ca9683
libhspell.so.0: $(LIBOBJS:.o=.lo)
Packit ca9683
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -shared -Wl,-soname,libhspell.so.0 $^ -lz
Packit ca9683
	ln -sf libhspell.so.0 libhspell.so
Packit ca9683
Packit ca9683
HSPELL_LIB = @HSPELL_LIB@
Packit ca9683
$(HSPELL_EXECUTABLE): hspell.o tclHash.o $(HSPELL_LIB)
Packit ca9683
	$(CC) $(CFLAGS) $(LDFLAGS) -o $(HSPELL_EXECUTABLE) hspell.o tclHash.o $(HSPELL_LIB) $(LIBS)
Packit ca9683
Packit ca9683
# remember to update this dependency list once in a while...
Packit ca9683
libhspell.o dict_radix.o find_sizes.o: dict_radix.h
Packit ca9683
dict_radix.o linginfo.o: gzbuffered.h
Packit ca9683
libhspell.o mk_he_affix.o: prefixes.c
Packit ca9683
hspell.o: hash.h tclHash.h
Packit ca9683
tclHash.o: tclHash.h
Packit ca9683
corlist.o gimatria.o hspell.o libhspell.o: hspell.h
Packit ca9683
hspell.o libhspell.o linginfo.o: linginfo.h hspell.h
Packit ca9683
linginfo.o: dmask.c
Packit ca9683
specfilter.o: prefixes.c
Packit ca9683
Packit ca9683
libhspell.lo: prefixes.c
Packit ca9683
Packit ca9683
prefixes.c: genprefixes.pl PrefixBits.pl
Packit ca9683
	$(PERL) -w ./genprefixes.pl >prefixes.c
Packit ca9683
Packit ca9683
find_sizes: find_sizes.o dict_radix.o
Packit ca9683
	$(CC) $(CFLAGS) $(LDFLAGS) -o find_sizes find_sizes.o dict_radix.o $(LIBS)
Packit ca9683
Packit ca9683
# *.hif, "hspell inflection format" files, list all the possible inflections
Packit ca9683
# and information on how each word was derived. Some are the outputs of the
Packit ca9683
# various word-list generators with the -d (derivation) option, and others are
Packit ca9683
# pre-prepared files for exceptional inflections.
Packit ca9683
# These files are pretty big - totalling over 16 MB - and can be easily
Packit ca9683
# kept compressed. However, on modern computers, 16 MB temporary disk usage
Packit ca9683
# is nothing to worry about, so we don't.
Packit ca9683
HIFS=milot.hif extrawords.hif biza-verbs.hif biza-nouns.hif \
Packit ca9683
	nouns.hif verbs.hif shemp.hif
Packit ca9683
hif: $(HIFS)
Packit ca9683
Packit ca9683
nouns.hif: wolig.pl wolig.dat
Packit ca9683
	$(PERL) -w wolig.pl -d wolig.dat > $@
Packit ca9683
verbs.hif: woo woo.dat
Packit ca9683
	$(PERL) -w woo -d woo.dat | sed "$(SEDCMD)" > $@
Packit ca9683
shemp.dat: verbs.hif
Packit ca9683
shemp.hif: shemp.dat wolig.pl
Packit ca9683
	$(PERL) -w wolig.pl -d shemp.dat > $@
Packit ca9683
Packit ca9683
# hebrew.wgz contains all the words without any allowed-prefix hints.
Packit ca9683
# hebrew.wgz.prefixes is the prefix hints (one byte per word, compressed).
Packit ca9683
# hebrew.wgz.sizes contains the memory sizes that reading hebrew.wgz will
Packit ca9683
#   require (this makes it easier for hspell to preallocate the needed sizes).
Packit ca9683
hebrew.wgz: pmerge PrefixBits.pl $(HIFS)
Packit ca9683
	cat $(HIFS) | ./pmerge -p hebrew.wgz.tmp | ./wzip | gzip -9n > hebrew.wgz
Packit ca9683
	-rm -f hebrew.wgz.prefixes
Packit ca9683
	gzip -9n < hebrew.wgz.tmp >hebrew.wgz.prefixes
Packit ca9683
	-rm -f hebrew.wgz.tmp
Packit ca9683
hebrew.wgz.prefixes: hebrew.wgz
Packit ca9683
hebrew.wgz.sizes: hebrew.wgz find_sizes
Packit ca9683
	gzip -dc hebrew.wgz | ./find_sizes >hebrew.wgz.sizes
Packit ca9683
Packit ca9683
###################################### optional linginfo stuff ##############
Packit ca9683
dolinginfo: linginfo_data $(HSPELL_EXECUTABLE)
Packit ca9683
Packit ca9683
# In the following long rule, the complete list of all words with linguistic
Packit ca9683
# details is concatanated and sent to binarize-desc.pl, which converts the
Packit ca9683
# detailed information of each word into bitmap (called dmask), produces a
Packit ca9683
# specifier that tells which prefixes are accepted with the word, and writes its
Packit ca9683
# stem. Then the words list is sorted, packed (a-la uniq), and the output files
Packit ca9683
# are written.
Packit ca9683
# TODO: make pack-desc.pl/binarize-desc.pl and pmerge into just one script
Packit ca9683
# (with options on whether to generate stems, etc.), and then we won't have
Packit ca9683
# this ugliness of two different rules generating hebrew.wgz in two ways
Packit ca9683
# (this is not only ugly, it's unsafe. If we use linginfo (--enable-linginfo
Packit ca9683
# and change, say, "extrawords", and run "make hebrew.wgz" we will get the
Packit ca9683
# wrong program run. A bare "make" does work properly because we stick an
Packit ca9683
# extra target in front of the default targets.
Packit ca9683
Packit ca9683
linginfo_data: hebrew.wgz.stems
Packit ca9683
hebrew.wgz.stems: binarize-desc.pl PrefixBits.pl pack-desc.pl $(HIFS) find_sizes
Packit ca9683
	for hif in $(HIFS); do \
Packit ca9683
	cat $$hif; echo ---; done | \
Packit ca9683
	$(PERL) binarize-desc.pl | \
Packit ca9683
		sort -u | $(PERL) pack-desc.pl -p hebrew.wgz.prefixes.tmp \
Packit ca9683
		-d hebrew.wgz.desc.tmp -s hebrew.wgz.stems.tmp \
Packit ca9683
		-l hebrew.wgz.lingsizes.tmp | \
Packit ca9683
		./wzip | gzip -9n > hebrew.wgz
Packit ca9683
	gzip -dc hebrew.wgz | ./find_sizes >hebrew.wgz.sizes
Packit ca9683
	cat hebrew.wgz.lingsizes.tmp >> hebrew.wgz.sizes
Packit ca9683
	-rm -f hebrew.wgz.lingsizes.tmp
Packit ca9683
	-rm -f hebrew.wgz.prefixes
Packit ca9683
	gzip -9n < hebrew.wgz.prefixes.tmp >hebrew.wgz.prefixes
Packit ca9683
	-rm -f hebrew.wgz.prefixes.tmp
Packit ca9683
	-rm -f hebrew.wgz.desc
Packit ca9683
	gzip -9n < hebrew.wgz.desc.tmp >hebrew.wgz.desc
Packit ca9683
	-rm -f hebrew.wgz.desc.tmp
Packit ca9683
	-rm -f hebrew.wgz.stems
Packit ca9683
	gzip -9n < hebrew.wgz.stems.tmp >hebrew.wgz.stems
Packit ca9683
	-rm -f hebrew.wgz.stems.tmp
Packit ca9683
hebrew.wgz.desc hebrew.wgz.lingsizes.tmp dmask.c: hebrew.wgz.stems
Packit ca9683
Packit ca9683
############################################################################
Packit ca9683
# The following targets build packages of Hspell's word list in formats
Packit ca9683
# required for other spell-checkers like Aspell and Hunspell. They are not
Packit ca9683
# necessary for building the native Hspell spell-checker.
Packit ca9683
############################################################################
Packit ca9683
Packit ca9683
mk_he_affix.o: prefixes.c hspell.h
Packit ca9683
Packit ca9683
# The "he_affix.dat" and "he.wl" files are the two files basic files which
Packit ca9683
# together form an Aspell 0.6 dictionary.
Packit ca9683
.PHONY: aspell
Packit ca9683
aspell: he_affix.dat he.wl
Packit ca9683
he.wl: mk_he_affix wunzip hebrew.wgz hebrew.wgz.prefixes specfilter
Packit ca9683
	./mk_he_affix 0 he_affix.dat he.wl
Packit ca9683
he_affix.dat: he.wl
Packit ca9683
Packit ca9683
# Aspell runtime prefers a hash-table dump which can be mmapped, instead of
Packit ca9683
# the textual word format:
Packit ca9683
he.rws: he.wl
Packit ca9683
	aspell --lang=he create master ./he.rws < he.wl
Packit ca9683
Packit ca9683
# The "he.dic" and "he.aff" files are the two files basic files which
Packit ca9683
# form a Hunspell dictionary; Hunspell is the multilingual spellchecker used
Packit ca9683
# by Firefox, OpenOffice, and many other projects. The format of these files
Packit ca9683
# is almost identical to the aspell format above, with only minor variations,
Packit ca9683
# so the same "mk_he_affix" program generates both.
Packit ca9683
.PHONY: hunspell
Packit ca9683
hunspell: he.dic he.aff
Packit ca9683
he.dic: mk_he_affix wunzip hebrew.wgz hebrew.wgz.prefixes specfilter
Packit ca9683
	./mk_he_affix 1 he.aff he.dic
Packit ca9683
he.aff: he.dic
Packit ca9683
Packit ca9683
.PHONY: firefox
Packit ca9683
firefox: he.xpi
Packit ca9683
misc/install.rdf: misc/install.rdf.pre
Packit ca9683
	sed 's/%VERSION%/$(VERSION)/' $< > $@
Packit ca9683
Packit ca9683
he.xpi: misc/install.rdf he.dic he.aff
Packit ca9683
	-mkdir misc/dictionaries
Packit ca9683
	ln -f he.dic he.aff misc/dictionaries
Packit ca9683
	ln -f COPYING misc/dictionaries/license.txt
Packit ca9683
	ln -f README misc/dictionaries/README-he.txt
Packit ca9683
	cd misc; zip ../$@ dictionaries/he.dic dictionaries/he.aff dictionaries/license.txt dictionaries/README-he.txt install.rdf
Packit ca9683
Packit ca9683
############################################################################
Packit ca9683
Packit ca9683
# A (very small number of) automated tests
Packit ca9683
.PHONY: test
Packit ca9683
test: hspell hebrew.wgz.sizes he.rws hunspell
Packit ca9683
	test/test1