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 one of the (phony) targets `major', `fugen', or `suffix',
18 # patterns that only use major hyphenation points (`Haupttrennstellen')
19 # are created. Example:
21 # make major pattern-refo
23 # The output directories have `-major' (etc.) appended to their 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 eines der zusätzlichen (künstlichen) Ziele `major', `fugen' oder
48 # `suffix' angegeben, werden Haupttrennstellmuster erzeugt.
52 # make major pattern-refo
54 # Die verwendeten Verzeichnisnamen sind die gleichen wie oben, allerdings
55 # mit einem angehängten `-major', `-fugen' bzw. `-suffix'.
57 # Diese Spezialmuster spiegeln die Auszeichnung in der Liste direkt wider.
58 # Sie haben nicht das Ziel, "gute" Trennungen in Texten zu erzeugen, sondern
59 # sind zum Testen der Konsistenz der Auszeichnung sowie zum "kategorisierten"
60 # Markieren der Trennstellen neuer Wörter gedacht.
62 # Bei `major' kann die Menge der verwendeten Haupttrennstellen mittels der
63 # Variable `W=N' (Wichtungs-Schwellwert)
64 # kontrolliert werden, wo `N' die Qualität angibt: Wert 1 selektiert
65 # nur die besten Haupttrennstellen, Wert 2 die besten und zweitbesten
66 # Haupttrennstellen usw. Der Standardwert für `W' ist 0; er gibt an, dass
67 # alle Haupttrennstellen verwendet werden sollen.
69 # Die Ziele `de-Latf' und `de-x-long-s' erzeugen (experimentelle) Wortlisten
70 # und (Quasi-) Trennmuster für die Wandlung von Wörtern in traditioneller oder
71 # reformierter Standardorthographie in der Variante mit Unterscheidung von
72 # langem und runden S (Binnen-S vs. Schluß-S) wie sie im Satz mit gebrochenen
73 # Schriften benötigt wird. Ein Beispiel für die Anwendung dieser Muster ist
74 # das Skript `skripte/python/patuse/long_s_conversion.py`
79 DATADIR
= $(SRCDIR
)/daten
80 SCRIPTDIR
= $(SRCDIR
)/skripte
81 LANGSDIR
= $(SCRIPTDIR
)/python
/lang_s
84 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
86 # A single `-' gets removed; all other combinations of `-', `<', `>',
87 # and `=' are converted to a hyphen.
88 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
91 -e
's/[=<>][=<>]*/-/g' \
95 ifeq ($(words $(MAKECMDGOALS
)),1)
98 # This is to suppress the `nothing to be done' warning.
102 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
104 # All combinations of `-', `<', `>', `<=', `=>' get removed,
105 # runs of `=' are converted to a hyphen.
106 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
110 -e
's/[<>][<>]*//g' \
114 ifeq ($(words $(MAKECMDGOALS
)),1)
117 # This is to suppress the `nothing to be done' warning.
121 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
123 # All combinations of `-', `<', `=' get removed,
124 # runs of `>' are converted to a hyphen.
125 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
127 -e
's/[<=][<=]*//g' \
131 ifeq ($(words $(MAKECMDGOALS
)),1)
134 # This is to suppress the `nothing to be done' warning.
144 TRAD
= dehypht-x
$(MAJOR
)
145 REFO
= dehyphn-x
$(MAJOR
)
146 SWISS
= dehyphts-x
$(MAJOR
)
150 LC_ENVVARS
= LC_COLLATE
=de_DE.UTF-8 \
156 DATE
= $(shell date
'+%Y-%m-%d')
165 SORT
= $(LC_ENVVARS
) sort -d \
166 |
$(LC_ENVVARS
) uniq
-i
168 LEFTHYPHENMIN
= $(strip $(shell $(SED
) 's/^\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
169 RIGHTHYPHENMIN
= $(strip $(shell $(SED
) 's/^..\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
171 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
172 $(GIT) log --format=%H -1 HEAD --`
173 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
174 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
175 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
178 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
181 all: pattern-trad pattern-refo pattern-swiss
183 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
184 pattern-trad
: $(TRADFILES
)
185 pattern-refo
: $(REFOFILES
)
186 pattern-swiss
: $(SWISSFILES
)
188 # intermediate targets
192 .PHONY
: words-trad words-refo
193 words-trad
: $(TRAD
)/words.hyphenated.trad
194 words-refo
: $(REFO
)/words.hyphenated.refo
197 .PHONY
: pre-trad pre-refo pre-swiss
205 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
206 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
207 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
210 # GNU make supports creation of multiple targets by a single
211 # invocation of a recipe only for pattern rules, thus we have
212 # to use a `sentinel file' (using `echo' for the time stamp).
215 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
217 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
219 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
222 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
223 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
224 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
225 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
226 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
227 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
228 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
229 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
230 $(CAT
) $(TRAD
)/pattern
.8 >> $@
; \
231 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
234 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
236 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
238 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
241 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
242 $(CAT
) $(DATADIR
)/$(REFO
).1 \
243 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
244 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
245 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
246 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
247 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
248 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
249 $(CAT
) $(REFO
)/pattern
.8 >> $@
; \
250 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
253 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
255 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
257 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
260 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
261 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
262 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
263 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
264 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
265 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
266 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
267 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
268 $(CAT
) $(SWISS
)/pattern
.8 >> $@
; \
269 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
272 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
274 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-t
-1 $(PERLMAJOR
) \
278 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
280 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-1 $(PERLMAJOR
) \
284 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
286 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-s
-1 $(PERLMAJOR
) \
291 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
293 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
295 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
297 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
299 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
301 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
303 # Listen und Patterns de-Latf (deutsch, Latin script, fraktur;
304 # Orthographie für Satz mit gebrochenen Schriften und rundem und langem S)
306 # Wortlisten mit Langem-S: gemischt, de-1901 (alt), de-1996 (reform)
308 $(LATF
)/words-de-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
310 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms \
311 -l
"de-1901,de-1996" -i wortliste
-o
$(LATF
)/words-de-Latf.txt
313 $(LATF
)/words-de-1901-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
315 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1901 \
316 -i wortliste
-o
$(LATF
)/words-de-1901-Latf.txt
318 $(LATF
)/words-de-1996-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
319 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1996 \
320 -i wortliste
-o
$(LATF
)/words-de-1996-Latf.txt
322 # de-Latf...: Variante mit Quasi-Trennstellen nach rund-s (aus-sagen)
324 .PHONY
: de-Latf de-1901-Latf de-1996-Latf
326 de-Latf
: $(LATF
)/de-Latf.pat
328 $(LATF
)/words-de-Latf.hyphenated
: $(LATF
)/words-de-Latf.txt
329 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
331 $(LATF
)/de-Latf.pat
: $(LATF
)/words-de-Latf.hyphenated
333 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
334 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
336 de-1901-Latf
: $(LATF
)/de-1901-Latf.pat
338 $(LATF
)/words-de-1901-Latf.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
339 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
341 $(LATF
)/de-1901-Latf.pat
: $(LATF
)/words-de-1901-Latf.hyphenated
343 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
344 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
346 de-1996-Latf
: $(LATF
)/de-1996-Latf.pat
348 $(LATF
)/words-de-1996-Latf.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
349 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
351 $(LATF
)/de-1996-Latf.pat
: $(LATF
)/words-de-1996-Latf.hyphenated
353 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
354 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
356 # long-s: Variante mit Quasi-Trennstellen nach Lang-S (auss-agen)
358 .PHONY
: de-x-long-s de-1901-x-long-s de-1996-x-long-s
360 de-x-long-s
: $(LONG_S
)/de-x-long-s.pat
362 $(LONG_S
)/words-de-x-long-s.hyphenated
: $(LATF
)/words-de-Latf.txt
364 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
366 $(LONG_S
)/de-x-long-s.pat
: $(LONG_S
)/words-de-x-long-s.hyphenated
367 $(CHDIR
) $(LONG_S
); \
368 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
369 $(CAT
) $(LONG_S
)/pattern
.8 >> $@
;
371 de-1901-x-long-s
: $(LONG_S
)/de-1901-x-long-s.pat
373 $(LONG_S
)/words-de-1901-x-long-s.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
375 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
377 $(LONG_S
)/de-1901-x-long-s.pat
: $(LONG_S
)/words-de-1901-x-long-s.hyphenated
378 $(CHDIR
) $(LONG_S
); \
379 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
380 $(CAT
) $(LONG_S
)/pattern
.8 >> $@
;
382 de-1996-x-long-s
: $(LONG_S
)/de-1996-x-long-s.pat
384 $(LONG_S
)/words-de-1996-x-long-s.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
386 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
388 $(LONG_S
)/de-1996-x-long-s.pat
: $(LONG_S
)/words-de-1996-x-long-s.hyphenated
389 $(CHDIR
) $(LONG_S
); \
390 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
391 $(CAT
) $(LONG_S
)/pattern
.8 >> $@
;