-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (31 loc) · 1.01 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
# Makefile for the Hunspell dictionary of Computer Jargon
#
# Input is a simple text file with one word per line
#
# The vocabulary and dictionary files use the following format:
# - line 1: number of entries
# - remaining lines: one entry per line
#
# A sorted file is created by using the following steps:
# - sort all enries in reverse order
# - use awk to add a final line with the number of entries
# - reverse the final file; use 'tac' (Linux) or 'tail -r' (MacOS)
ifeq ($(shell uname), Darwin)
reverse := tail -r
destdir := ~/Library/Spelling
else
reverse := tac
destdir := ~/.config/dicts
endif
# Default target
all: jargon.dic
install: jargon.dic jargon.aff
install -d $(destdir)
install -C -m 0644 $^ $(destdir)
# Create vocabulary file from text file
%.voc: %.txt
sort -u -r <$? | awk '{print} END {print NR}' | $(reverse) >$@
# Create sorted dictionary from vocabulary file
%.dic: %.voc %.aff
munch $*.voc $*.aff 2>/dev/null | tail +2 | sort -r | awk '{print} END {print NR}' | $(reverse) >$@
.PHONY: all install