Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 07 Aug 2011 23:42:39 +0300
changeset 36 6fee90eb2d85
parent 28 6bab39ff1663
child 56 ee149b4fd006
permissions -rw-r--r--
Add default Makefile settings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     1
# Available target:
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     2
#
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     3
#   all         build dictionaries
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     4
#   install     install dictionaries, so they been available in stardict, may require root permission
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     5
#   uninstall   remove dictionaries, they been unavailable in stardict, may require root permission
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     6
#   install-local install dictionaries in user HOME dir, so they been available in stardict for that user
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
     7
#   uninstall-local remove dictionaries from user HOME directory
26
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
     8
#   install-local-symlink create symlink from installed dir to user HOME dir, so dictionaries been available in stardict
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
     9
#   uninstall-local-symlink remove symlink from user HOME directory
22
0616adf6e983 Describe available build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 21
diff changeset
    10
36
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    11
SHELL = /bin/sh
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    12
export PATH := /bin:/usr/bin:${PATH}
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    13
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    14
# Disable built in pattern rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    15
MAKEFLAGS += -r
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    16
# Disable built in variables.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    17
MAKEFLAGS += -R
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    18
# Disable built in suffix rules.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    19
.SUFFIXES:
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    20
# Default target.
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    21
.DEFAULT_GOAL = all
6fee90eb2d85 Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 28
diff changeset
    22
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    24
# On Debian Etch 'stardict-tools' package not placed tools in any system bin dir.
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
export PATH := $(PATH):/usr/lib/stardict-tools
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
DICSETNAME = gavenkoa-dicts
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
prefix = /usr/local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
datarootdir = $(prefix)/share
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
datadir = $(datarootdir)/stardict
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
dicdir = $(datadir)/dic/$(DICSETNAME)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    34
# Per user dictionaries hold in user HOME directory.
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    35
dicdir-local = $(HOME)/.stardict/dic/$(DICSETNAME)
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    36
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    37
F_TAB_ = $(wildcard *.tab_)
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    38
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    39
F_TAB = $(patsubst %.tab_,%.tab,$(F_TAB_))
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
FNAME = $(patsubst %.tab,%,$(F_TAB))
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
F_DICT = $(patsubst %.tab,%.dict.dz,$(F_TAB))
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
F_IFO = $(patsubst %.tab,%.ifo,$(F_TAB))
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
    44
.PHONY: all
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
all: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
    47
.PHONY: verify
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
verify: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
	@echo
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
	@for dic in $(F_IFO); do \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
		stardict_verify $$dic; \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
	done
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
    54
.PHONY: dist
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
dist: $(F_DICT)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    57
%.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
    58
	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
    59
9
976f8876799d Added forgotten dependence.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 3
diff changeset
    60
%.dict.dz: %.tab %.descr
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
	tabfile $<
3
cc5593c28a4b Update .ifo file with author/date/description info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1
diff changeset
    62
	/bin/sh update-ifo.sh $*.ifo
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
    64
.PHONY: install
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
install: dist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
	mkdir -p $(dicdir)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
	for dic in $(FNAME); do \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
		install -m 644 $$dic.dict.dz $(dicdir); \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
		install -m 644 $$dic.idx $(dicdir); \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
		install -m 644 $$dic.ifo $(dicdir); \
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
	done
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
    73
.PHONY: uninstall
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
uninstall:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
	rm -r -f $(dicdir)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
26
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    77
.PHONY: install-local-symlink
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    78
install-local-symlink: # Assume use run "make install" before.
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    79
	mkdir -p $(HOME)/.stardict/dic
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    80
	ln -s $(dicdir) $(HOME)/.stardict/dic/$(DICSETNAME)
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    81
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    82
.PHONY: uninstall-local-symlink
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    83
uninstall-local-symlink: # Assume use run "make uninstall" before.
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    84
	rm -f $(HOME)/.stardict/dic/$(DICSETNAME)
6dfc4ac2dc80 Back targets that allow make symlink to dictionaries install dir from user HOME dir.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 23
diff changeset
    85
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    86
.PHONY: install-local
28
6bab39ff1663 Correct depends: before install-local make dist.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 26
diff changeset
    87
install-local: dist
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    88
	mkdir -p $(dicdir-local)
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    89
	for dic in $(FNAME); do \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    90
		install -m 644 $$dic.dict.dz $(dicdir-local); \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    91
		install -m 644 $$dic.idx $(dicdir-local); \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    92
		install -m 644 $$dic.ifo $(dicdir-local); \
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    93
	done
13
d0e948499faf Added targets [un]install-user to proper install dict for current user.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 9
diff changeset
    94
21
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    95
.PHONY: uninstall-local
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    96
uninstall-local:
d4b27e5b7a4b Added per user install target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 20
diff changeset
    97
	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
    98
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
    99
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
clean:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
	for dic in $(FNAME); do \
1
b23e948de24a Make article for all verbs form.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   102
		rm -f $$dic.dict.dz $$dic.idx $$dic.ifo $$dic.tab; \
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
	done
23
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   104
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   105
.PHONY: distclean
946ae4b96419 Phony targets marked.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 22
diff changeset
   106
distclean: clean