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)
71 # Wortlisten und (Quasi-) Trennmuster für die Wandlung von Wörtern in
72 # traditioneller oder reformierter Standartorthographie in die Variante mit
73 # Unterscheidung von langem und runden S (Binnen-S vs. Schluß-S) wie sie im
74 # Satz mit gebrochenen Schriften benötigt wird.
79 DATADIR
= $(SRCDIR
)/daten
80 SCRIPTDIR
= $(SRCDIR
)/skripte
81 PYSCRIPTDIR
= $(SRCDIR
)/skripte
/python
83 # Variables FROM and TO are used by goal `pidiff'. FROM must be a
84 # commit set from shell, like `make pidiff FROM=abcdef', TO is optional
85 # and evaluates to `HEAD' if not given.
87 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
89 # A single `-' gets removed; all other combinations of `-', `<', `>',
90 # and `=' are converted to a hyphen.
91 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
94 -e
's/[=<>][=<>]*/-/g' \
98 ifeq ($(words $(MAKECMDGOALS
)),1)
101 # This is to suppress the `nothing to be done' warning.
105 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
107 # All combinations of `-', `<', `>', `<=', `=>' get removed,
108 # runs of `=' are converted to a hyphen.
109 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
113 -e
's/[<>][<>]*//g' \
117 ifeq ($(words $(MAKECMDGOALS
)),1)
120 # This is to suppress the `nothing to be done' warning.
124 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
126 # All combinations of `-', `<', `=' get removed,
127 # runs of `>' are converted to a hyphen.
128 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
130 -e
's/[<=][<=]*//g' \
134 ifeq ($(words $(MAKECMDGOALS
)),1)
137 # This is to suppress the `nothing to be done' warning.
147 TRAD
= dehypht-x
$(MAJOR
)
148 REFO
= dehyphn-x
$(MAJOR
)
149 SWISS
= dehyphts-x
$(MAJOR
)
153 LC_ENVVARS
= LC_COLLATE
=de_DE.ISO8859-15 \
154 LC_CTYPE
=de_DE.ISO8859-15
159 DATE
= $(shell date
'+%Y-%m-%d')
162 ICONV
= iconv
-f iso-8859-15
-t utf-8
169 SORT
= $(LC_ENVVARS
) sort -d \
170 |
$(LC_ENVVARS
) uniq
-i
172 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
173 $(GIT) log --format=%H -1 HEAD --`
174 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
175 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
176 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
179 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
182 all: pattern-trad pattern-refo pattern-swiss
184 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
185 pattern-trad
: $(TRADFILES
)
186 pattern-refo
: $(REFOFILES
)
187 pattern-swiss
: $(SWISSFILES
)
189 # intermediate targets
193 .PHONY
: words-trad words-refo
194 words-trad
: $(TRAD
)/words.hyphenated.trad
195 words-refo
: $(REFO
)/words.hyphenated.refo
198 .PHONY
: pre-trad pre-refo pre-swiss
206 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
207 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
208 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
211 # GNU make supports creation of multiple targets by a single
212 # invocation of a recipe only for pattern rules, thus we have
213 # to use a `sentinel file' (using `echo' for the time stamp).
216 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
218 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
220 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
223 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
224 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
225 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
226 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
227 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
228 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
229 $(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 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
246 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
247 $(CAT
) $(REFO
)/pattern
.8 \
249 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
252 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
254 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
256 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
259 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
260 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
261 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
262 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
263 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
264 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
265 $(CAT
) $(SWISS
)/pattern
.8 \
267 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
270 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
272 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-t
$(PERLMAJOR
) \
276 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
278 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
$(PERLMAJOR
) \
282 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
284 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-s
$(PERLMAJOR
) \
289 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
291 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
293 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
295 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
297 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
299 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
302 $(SH
) skripte
/patgen-list-diff.sh
$(FROM
) $(TO
)
304 # Listen und Patterns de-Latf (deutsch, Latin script, fraktur;
305 # Orthographie für Satz mit gebrochenen Schriften und rundem und langem S)
307 # de-Latf...: Variante mit Quasi-Trennstellen nach rund-s
309 .PHONY
: de-Latf de-1901-Latf de-1996-Latf
311 de-Latf
: $(LATF
)/de-Latf.pat
313 $(LATF
)/words-de-Latf.txt
: wortliste
$(PYSCRIPTDIR
)/s2long-s.py
315 $(PYTHON
) $(PYSCRIPTDIR
)/s2long-s.py
--drop-homonyms \
316 -l
"de-1901,de-1996" -i wortliste
-o
$(LATF
)/words-de-Latf.txt
318 $(LATF
)/words-de-Latf.hyphenated
: $(LATF
)/words-de-Latf.txt
319 $(PYTHON
) $(PYSCRIPTDIR
)/de_Latf_quasihyph.py
< $< > $@
321 $(LATF
)/de-Latf.pat
: $(LATF
)/words-de-Latf.hyphenated
323 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
324 $(CAT
) $(LATF
)/pattern
.8 |
$(ICONV
) >> $@
;
326 de-1901-Latf
: $(LATF
)/de-1901-Latf.pat
328 $(LATF
)/words-de-1901-Latf.txt
: wortliste
$(PYSCRIPTDIR
)/s2long-s.py
330 $(PYTHON
) $(PYSCRIPTDIR
)/s2long-s.py
--drop-homonyms
-l de-1901 \
331 -i wortliste
-o
$(LATF
)/words-de-1901-Latf.txt
333 $(LATF
)/words-de-1901-Latf.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
334 $(PYTHON
) $(PYSCRIPTDIR
)/de_Latf_quasihyph.py
< $< > $@
336 $(LATF
)/de-1901-Latf.pat
: $(LATF
)/words-de-1901-Latf.hyphenated
338 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
339 $(CAT
) $(LATF
)/pattern
.8 |
$(ICONV
) >> $@
;
341 de-1996-Latf
: $(LATF
)/de-1996-Latf.pat
343 $(LATF
)/words-de-1996-Latf.txt
: wortliste
$(PYSCRIPTDIR
)/s2long-s.py
344 $(PYTHON
) $(PYSCRIPTDIR
)/s2long-s.py
--drop-homonyms
-l de-1996 \
345 -i wortliste
-o
$(LATF
)/words-de-1996-Latf.txt
347 $(LATF
)/words-de-1996-Latf.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
348 $(PYTHON
) $(PYSCRIPTDIR
)/de_Latf_quasihyph.py
< $< > $@
350 $(LATF
)/de-1996-Latf.pat
: $(LATF
)/words-de-1996-Latf.hyphenated
352 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
353 $(CAT
) $(LATF
)/pattern
.8 |
$(ICONV
) >> $@
;
355 # long-s: Variante mit Quasi-Trennstellen nach Lang-S
358 de-x-long-s
: $(LONG_S
)/de-x-long-s.pat
360 $(LONG_S
)/words-de-x-long-s.hyphenated
: $(LATF
)/words-de-Latf.txt
362 $(PYTHON
) $(PYSCRIPTDIR
)/long_s_quasihyph.py
< $< > $@
364 $(LONG_S
)/de-x-long-s.pat
: $(LONG_S
)/words-de-x-long-s.hyphenated
365 $(CHDIR
) $(LONG_S
); \
366 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
367 $(CAT
) $(LONG_S
)/pattern
.8 |
$(ICONV
) >> $@
;