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 used directories names are the same as above but with `-major' (etc.)
24 # appended to the names.
26 # To control the used weights in the major hyphenation patterns, add
27 # variable `W=N', where `N' gives the quality: value 1 specifies the best
28 # hyphenation points only, value 2 both the best and second-best points,
29 # etc. The default is value 0, using all major hyphenation points.
33 # Dieses Makefile erzeugt deutsche Trennmuster in den
34 # Unterverzeichnissen $(TRAD) und $(REFO) für die traditionelle
35 # bzw. reformierte Rechtschreibung. Trennmuster für tradionelles
36 # deutschschweizerisches Deutsch werden Verzeichnis $(SWISS) erzeugt.
38 # Die Eingabedaten werden im Verzeichnis $(SRCDIR) erwartet; die möglichen
39 # Make-Ziele sind `pattern-trad', `pattern-refo' und `pattern-swiss'. Wenn
40 # kein Ziel angegeben ist (oder man das Ziel `all' verwendet), werden alle
41 # drei Trennmuster erzeugt.
43 # SRCDIR (und die anderen Variablen) kann man leicht beim Aufruf von
44 # `make' als Parameter modifizieren, z.B.
46 # make pattern-trad SRCDIR=~/git/wortliste
48 # Wird eines der zusätzlichen (künstlichen) Ziele `major', `fugen' oder
49 # `suffix' angegeben, werden Haupttrennstellmuster erzeugt.
53 # make major pattern-refo
55 # Die verwendeten Verzeichnisnamen sind die gleichen wie oben, allerdings
56 # mit einem angehängten `-major', `-fugen' bzw. `-suffix'.
58 # Diese Spezialmuster spiegeln die Auszeichnung in der Liste direkt wider.
59 # Sie haben nicht das Ziel, "gute" Trennungen in Texten zu erzeugen sondern
60 # sind zum Testen der Konsistenz der Auszeichnung sowie zum "kategorisierten"
61 # Markieren der Trennstellen neuer Wörter gedacht.
63 # Bei `major' kann die Menge der verwendeten Haupttrennstellen mittels der
64 # Variable `W=N' (Wichtungs-Schwellwert)
65 # kontrolliert werden, wo `N' die Qualität angibt: Wert 1 selektiert
66 # nur die besten Haupttrennstellen, Wert 2 die besten und zweitbesten
67 # Haupttrennstellen usw. Der Standardwert für `W' ist 0; er gibt an, dass
68 # alle Haupttrennstellen verwendet werden sollen.
70 # Die Ziele `de-Latf' und `de-x-long-s' erzeugen (experimentelle) Wortlisten
71 # und (Quasi-) Trennmuster für die Wandlung von Wörtern in traditioneller oder
72 # reformierter Standardorthographie in der Variante mit Unterscheidung von
73 # langem und runden S (Binnen-S vs. Schluß-S) wie sie im Satz mit gebrochenen
74 # Schriften benötigt wird. Ein Beispiel für die Anwendung dieser Muster ist
75 # das Skript `skripte/python/patuse/long_s_conversion.py`
80 DATADIR
= $(SRCDIR
)/daten
81 SCRIPTDIR
= $(SRCDIR
)/skripte
82 LANGSDIR
= $(SCRIPTDIR
)/python
/lang_s
85 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
87 # A single `-' gets removed; all other combinations of `-', `<', `>',
88 # and `=' are converted to a hyphen.
89 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
92 -e
's/[=<>][=<>]*/-/g' \
96 ifeq ($(words $(MAKECMDGOALS
)),1)
99 # This is to suppress the `nothing to be done' warning.
103 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
105 # All combinations of `-', `<', `>', `<=', `=>' get removed,
106 # runs of `=' are converted to a hyphen.
107 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
111 -e
's/[<>][<>]*//g' \
115 ifeq ($(words $(MAKECMDGOALS
)),1)
118 # This is to suppress the `nothing to be done' warning.
122 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
124 # All combinations of `-', `<', `=' get removed,
125 # runs of `>' are converted to a hyphen.
126 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
128 -e
's/[<=][<=]*//g' \
132 ifeq ($(words $(MAKECMDGOALS
)),1)
135 # This is to suppress the `nothing to be done' warning.
145 TRAD
= dehypht-x
$(MAJOR
)
146 REFO
= dehyphn-x
$(MAJOR
)
147 SWISS
= dehyphts-x
$(MAJOR
)
151 LC_ENVVARS
= LC_COLLATE
=de_DE.ISO8859-15 \
152 LC_CTYPE
=de_DE.ISO8859-15
157 DATE
= $(shell date
'+%Y-%m-%d')
160 ICONV
= iconv
-f iso-8859-15
-t utf-8
167 SORT
= $(LC_ENVVARS
) sort -d \
168 |
$(LC_ENVVARS
) uniq
-i
170 LEFTHYPHENMIN
= $(strip $(shell $(SED
) 's/^\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
171 RIGHTHYPHENMIN
= $(strip $(shell $(SED
) 's/^..\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
173 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
174 $(GIT) log --format=%H -1 HEAD --`
175 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
176 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
177 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
180 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
183 all: pattern-trad pattern-refo pattern-swiss
185 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
186 pattern-trad
: $(TRADFILES
)
187 pattern-refo
: $(REFOFILES
)
188 pattern-swiss
: $(SWISSFILES
)
190 # intermediate targets
194 .PHONY
: words-trad words-refo
195 words-trad
: $(TRAD
)/words.hyphenated.trad
196 words-refo
: $(REFO
)/words.hyphenated.refo
199 .PHONY
: pre-trad pre-refo pre-swiss
207 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
208 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
209 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
212 # GNU make supports creation of multiple targets by a single
213 # invocation of a recipe only for pattern rules, thus we have
214 # to use a `sentinel file' (using `echo' for the time stamp).
217 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
219 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
221 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
224 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
225 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
226 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
227 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
228 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
229 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
230 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
231 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
232 $(CAT
) $(TRAD
)/pattern
.8 \
234 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
237 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
239 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
241 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
244 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
245 $(CAT
) $(DATADIR
)/$(REFO
).1 \
246 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
247 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
248 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
249 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
250 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
251 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
252 $(CAT
) $(REFO
)/pattern
.8 \
254 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
257 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
259 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
261 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
264 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
265 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
266 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
267 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
268 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
269 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
270 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
271 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
272 $(CAT
) $(SWISS
)/pattern
.8 \
274 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
277 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
279 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-t
$(PERLMAJOR
) \
283 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
285 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
$(PERLMAJOR
) \
289 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
291 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-s
$(PERLMAJOR
) \
296 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
298 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
300 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
302 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
304 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
306 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
308 # Listen und Patterns de-Latf (deutsch, Latin script, fraktur;
309 # Orthographie für Satz mit gebrochenen Schriften und rundem und langem S)
311 # Wortlisten mit Langem-S: gemischt, de-1901 (alt), de-1996 (reform)
313 $(LATF
)/words-de-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
315 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms \
316 -l
"de-1901,de-1996" -i wortliste
-o
$(LATF
)/words-de-Latf.txt
318 $(LATF
)/words-de-1901-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
320 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1901 \
321 -i wortliste
-o
$(LATF
)/words-de-1901-Latf.txt
323 $(LATF
)/words-de-1996-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
324 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1996 \
325 -i wortliste
-o
$(LATF
)/words-de-1996-Latf.txt
327 # de-Latf...: Variante mit Quasi-Trennstellen nach rund-s (aus-sagen)
329 .PHONY
: de-Latf de-1901-Latf de-1996-Latf
331 de-Latf
: $(LATF
)/de-Latf.pat
333 $(LATF
)/words-de-Latf.hyphenated
: $(LATF
)/words-de-Latf.txt
334 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
336 $(LATF
)/de-Latf.pat
: $(LATF
)/words-de-Latf.hyphenated
338 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
339 $(CAT
) $(LATF
)/pattern
.8 |
$(ICONV
) >> $@
;
341 de-1901-Latf
: $(LATF
)/de-1901-Latf.pat
343 $(LATF
)/words-de-1901-Latf.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
344 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
346 $(LATF
)/de-1901-Latf.pat
: $(LATF
)/words-de-1901-Latf.hyphenated
348 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
349 $(CAT
) $(LATF
)/pattern
.8 |
$(ICONV
) >> $@
;
351 de-1996-Latf
: $(LATF
)/de-1996-Latf.pat
353 $(LATF
)/words-de-1996-Latf.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
354 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
356 $(LATF
)/de-1996-Latf.pat
: $(LATF
)/words-de-1996-Latf.hyphenated
358 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
359 $(CAT
) $(LATF
)/pattern
.8 |
$(ICONV
) >> $@
;
361 # long-s: Variante mit Quasi-Trennstellen nach Lang-S (auss-agen)
363 .PHONY
: de-x-long-s de-1901-x-long-s de-1996-x-long-s
365 de-x-long-s
: $(LONG_S
)/de-x-long-s.pat
367 $(LONG_S
)/words-de-x-long-s.hyphenated
: $(LATF
)/words-de-Latf.txt
369 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
371 $(LONG_S
)/de-x-long-s.pat
: $(LONG_S
)/words-de-x-long-s.hyphenated
372 $(CHDIR
) $(LONG_S
); \
373 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
374 $(CAT
) $(LONG_S
)/pattern
.8 |
$(ICONV
) >> $@
;
376 de-1901-x-long-s
: $(LONG_S
)/de-1901-x-long-s.pat
378 $(LONG_S
)/words-de-1901-x-long-s.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
380 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
382 $(LONG_S
)/de-1901-x-long-s.pat
: $(LONG_S
)/words-de-1901-x-long-s.hyphenated
383 $(CHDIR
) $(LONG_S
); \
384 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
385 $(CAT
) $(LONG_S
)/pattern
.8 |
$(ICONV
) >> $@
;
387 de-1996-x-long-s
: $(LONG_S
)/de-1996-x-long-s.pat
389 $(LONG_S
)/words-de-1996-x-long-s.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
391 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
393 $(LONG_S
)/de-1996-x-long-s.pat
: $(LONG_S
)/words-de-1996-x-long-s.hyphenated
394 $(CHDIR
) $(LONG_S
); \
395 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
396 $(CAT
) $(LONG_S
)/pattern
.8 |
$(ICONV
) >> $@
;