Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 08 Jan 2010 22:18:46 +0200
changeset 21 d4b27e5b7a4b
parent 20 9f5eedd08178
child 22 0616adf6e983
permissions -rw-r--r--
Added per user install target.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
     2
# On Debian Etch 'stardict-tools' package not placed tools in any system bin dir.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
export PATH := $(PATH):/usr/lib/stardict-tools
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
DICSETNAME = gavenkoa-dicts
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
prefix = /usr/local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
datarootdir = $(prefix)/share
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
datadir = $(datarootdir)/stardict
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
dicdir = $(datadir)/dic/$(DICSETNAME)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    12
# Per user dictionaries hold in user HOME directory.
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    13
dicdir-local = $(HOME)/.stardict/dic/$(DICSETNAME)
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    14
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    15
F_TAB_ = $(wildcard *.tab_)
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    16
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    17
F_TAB = $(patsubst %.tab_,%.tab,$(F_TAB_))
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
FNAME = $(patsubst %.tab,%,$(F_TAB))
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
F_DICT = $(patsubst %.tab,%.dict.dz,$(F_TAB))
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
F_IFO = $(patsubst %.tab,%.ifo,$(F_TAB))
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
all: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
verify: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
	@echo
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
	@for dic in $(F_IFO); do \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
		stardict_verify $$dic; \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
	done
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
dist: $(F_DICT)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    32
%.tab: %.tab_
20
9f5eedd08178 Filter lines beginning with # from .tab_ file (for purpose use they as comment lines).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 13
diff changeset
    33
	sed -e '/^#/d' -e 's_\\n _\\n_g' > $@ < $<
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    34
9
976f8876799d Added forgotten dependence.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 3
diff changeset
    35
%.dict.dz: %.tab %.descr
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
	tabfile $<
3
cc5593c28a4b Update .ifo file with author/date/description info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1
diff changeset
    37
	/bin/sh update-ifo.sh $*.ifo
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
install: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
	mkdir -p $(dicdir)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
	for dic in $(FNAME); do \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
		install -m 644 $$dic.dict.dz $(dicdir); \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
		install -m 644 $$dic.idx $(dicdir); \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
		install -m 644 $$dic.ifo $(dicdir); \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
	done
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
uninstall:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
	rm -r -f $(dicdir)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    50
.PHONY: install-local
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    51
install-local:
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    52
	mkdir -p $(dicdir-local)
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    53
	for dic in $(FNAME); do \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    54
		install -m 644 $$dic.dict.dz $(dicdir-local); \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    55
		install -m 644 $$dic.idx $(dicdir-local); \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    56
		install -m 644 $$dic.ifo $(dicdir-local); \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    57
	done
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
    58
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    59
.PHONY: uninstall-local
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    60
uninstall-local:
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    61
	rm -f -r $(HOME)/.stardict/dic/$(DICSETNAME)
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
    62
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
	for dic in $(FNAME); do \
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    65
		rm -f $$dic.dict.dz $$dic.idx $$dic.ifo $$dic.tab; \
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
	done