1 # -*- coding: utf-8 -*-
3 # This Makefile creates German hyphenation patterns in subdirectories
4 # $(TRAD) and $(REFO) for traditional and new orthography, respectively.
5 # Hyphenation patterns for traditional Swiss German are generated in
8 # The input data is in $(SRCDIR); the possible targets are `pattern-trad',
9 # `pattern-refo', and `pattern-swiss'. If no target (or target `all') is
10 # given, all patterns for all three targets are built.
12 # SRCDIR (and the other variables) can be easily modified as parameters
13 # while calling `make', e.g.
15 # make pattern-trad SRCDIR=~/git/wortliste
17 # If you add the (phony) target `major', patterns which only use major
18 # hyphenation points (`Haupttrennstellen') are created. Example:
20 # make major pattern-refo
22 # The used directories names are the same as above but with `-major'
23 # appended to the names.
25 # To control the used weights in the major hyphenation patterns, add
26 # variable `W=N', where `N' gives the quality: value 1 specifies the best
27 # hyphenation points only, value 2 both the best and second-best points,
28 # etc. The default is value 0, using all major hyphenation points.
32 # Dieses Makefile erzeugt deutsche Trennmuster in den
33 # Unterverzeichnissen $(TRAD) und $(REFO) für die traditionelle
34 # bzw. reformierte Rechtschreibung. Trennmuster für tradionelles
35 # deutschschweizerisches Deutsch werden Verzeichnis $(SWISS) erzeugt.
37 # Die Eingabedaten werden im Verzeichnis $(SRCDIR) erwartet; die möglichen
38 # Make-Ziele sind `pattern-trad', `pattern-refo' und `pattern-swiss'. Wenn
39 # kein Ziel angegeben ist (oder man das Ziel `all' verwendet), werden alle
40 # drei Trennmuster erzeugt.
42 # SRCDIR (und die anderen Variablen) kann man leicht beim Aufruf von
43 # `make' als Parameter modifizieren, z.B.
45 # make pattern-trad SRCDIR=~/git/wortliste
47 # Wird zusätzlich das zusätzliche (künstliche) Ziel `major' angegeben,
48 # werden Haupttrennstellmuster erzeugt.
52 # make major pattern-refo
54 # Die verwendeten Verzeichnisnamen sind die gleichen wie oben, allerdings
55 # mit einem angehängten `-major'.
57 # Die Wichtung der verwendeten Haupttrennstellen kann mittels der Variable
58 # `W=N' kontrolliert werden, wo `N' die Qualität angibt: Wert 1 selektiert
59 # nur die besten Haupttrennstellen, Wert 2 die besten und zweitbesten
60 # Haupttrennstellen usw. Der Standardwert für `W' ist 0; er gibt an, dass
61 # alle Haupttrennstellen verwendet werden sollen.
67 DATADIR
= $(SRCDIR
)/daten
68 SCRIPTDIR
= $(SRCDIR
)/skripte
70 # Variables FROM and TO are used by goal `pidiff'. FROM must be a
71 # commit set from shell, like `make pidiff FROM=abcdef', TO is optional
72 # and evaluates to `HEAD' if not given.
74 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
76 # A single `-' gets removed; all other combinations of `-', `<', `>',
77 # `=', and `|' are converted to a hyphen.
78 SEDMAJOR
= $(SED
) -e
'/[=|<>-]/!n' \
81 -e
's/[=|<>][=|<>]*/-/g' \
85 ifeq ($(words $(MAKECMDGOALS
)),1)
88 # This is to suppress the `nothing to be done' warning.
92 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
94 # All combinations of `-', `<', `>' get removed,
95 # runs of `=' are converted to a hyphen.
96 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
102 ifeq ($(words $(MAKECMDGOALS
)),1)
105 # This is to suppress the `nothing to be done' warning.
115 TRAD
= dehypht-x
$(MAJOR
)
116 REFO
= dehyphn-x
$(MAJOR
)
117 SWISS
= dehyphts-x
$(MAJOR
)
119 LC_ENVVARS
= LC_COLLATE
=de_DE.ISO8859-15 \
120 LC_CTYPE
=de_DE.ISO8859-15
125 DATE
= $(shell date
'+%Y-%m-%d')
128 ICONV
= iconv
-f iso-8859-15
-t utf-8
134 SORT
= $(LC_ENVVARS
) sort -d \
135 |
$(LC_ENVVARS
) uniq
-i
137 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
138 $(GIT) log --format=%H -1 HEAD --`
139 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
140 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
141 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
144 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
147 all: pattern-trad pattern-refo pattern-swiss
149 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
150 pattern-trad
: $(TRADFILES
)
151 pattern-refo
: $(REFOFILES
)
152 pattern-swiss
: $(SWISSFILES
)
156 .PHONY
: words-trad words-refo
157 words-trad
: $(TRAD
)/words.hyphenated.trad
158 words-refo
: $(REFO
)/words.hyphenated.refo
161 .PHONY
: pre-trad pre-refo pre-swiss
169 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
170 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
171 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
174 # GNU make supports creation of multiple targets by a single
175 # invocation of a recipe only for pattern rules, thus we have
176 # to use a `sentinel file' (using `echo' for the time stamp).
179 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
181 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
183 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
186 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
187 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
188 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
189 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
190 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
191 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
192 $(CAT
) $(TRAD
)/pattern
.8 \
194 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
197 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
199 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
201 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
204 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
205 $(CAT
) $(DATADIR
)/$(REFO
).1 \
206 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
207 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
208 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
209 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
210 $(CAT
) $(REFO
)/pattern
.8 \
212 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
215 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
217 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
219 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
222 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
223 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
224 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
225 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
226 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
227 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
228 $(CAT
) $(SWISS
)/pattern
.8 \
230 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
233 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
235 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-t
$(PERLMAJOR
) \
239 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
241 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
$(PERLMAJOR
) \
245 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
247 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-s
$(PERLMAJOR
) \
252 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
254 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
256 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
258 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
260 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
262 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
265 $(SH
) skripte
/patgen-list-diff.sh
$(FROM
) $(TO
)