-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
59 lines (44 loc) · 1.29 KB
/
Makefile
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
EXTENSION = italian_fts
DOCFILES = README.rst LEGGIMI.rst COPYING CHANGES \
META.json $(EXTENSION).control
SRCFILES = Makefile $(EXTENSION).sql uninstall_$(EXTENSION).sql
DICTFILES = italian_ispell.dict italian_ispell.affix italian_ispell.stop
TESTFILES = $(patsubst src/%,%,$(wildcard src/test/sql/*.sql) $(wildcard src/test/expected/*.out))
DISTFILES = $(addprefix build/, $(SRCFILES) $(DOCFILES) $(DICTFILES) $(TESTFILES))
VERSION := $(shell cat VERSION)
VERSION_SPLIT := $(subst ., ,$(VERSION))
VERSION_MINOR := $(word 1,$(VERSION_SPLIT)).$(word 2,$(VERSION_SPLIT))
PKGNAME = $(EXTENSION)-$(VERSION)
PKGFILE = dist/$(PKGNAME).tar.gz
ifndef DATE
DATE = $(shell date +%Y-%m-%d)
endif
ICONV = iconv -f latin1 -t utf8
.PHONY : dict package clean
sdist : dict $(PKGFILE)
dict :
$(MAKE) -C dict $@
package: $(PKGFILE)
FILTER_VAR = \
sed 's,VERSION_MINOR,$(VERSION_MINOR),g' \
| sed 's,VERSION,$(VERSION),g' \
| sed 's,DATE,$(DATE),g'
build/% : src/%.in
cat $< | $(FILTER_VAR) > $@
build/% : src/%
@mkdir -p $(dir $@)
cat < $< > $@
build/% : %
@mkdir -p build
cat < $< > $@
build/% : dict/%
cat $< | $(ICONV) > $@
$(PKGFILE) : $(DISTFILES)
mkdir -p dist
ln -s build $(PKGNAME)
rm -rf $@
tar czvf $@ $(patsubst build/%,$(PKGNAME)/%,$^)
rm $(PKGNAME)
clean:
rm -rf build
$(MAKE) -C dict $@