Version 1.0.
[wortliste.git] / Makefile
blob0b3cb4c5c2e38589a3f1eb9d367c7a4cfbe0ccc9
1 # -*- coding: utf-8 -*-
3 # (See below for a German introduction.)
5 # This Makefile creates German hyphenation patterns in subdirectories
6 # `$(TRAD)` and `$(REFO)` for traditional and new orthography, respectively.
7 # Hyphenation patterns for traditional Swiss German are generated in
8 # directory `$(SWISS)`.
10 # The input data is expected to be in `$(SRCDIR)`, which by default is set to
11 # the directory containing the Makefile. Output goes to directory
12 # `$(OUTDIR)`, which by default is set to './muster'.
14 # The possible targets are `pattern-trad`, `pattern-refo`, and
15 # `pattern-swiss`. If no target (or target `all`) is given, all patterns for
16 # all three targets are built.
18 # Example call:
20 # ```
21 # mkdir build-patterns
22 # cd build-patterns
23 # make --makefile=~/git/wortliste/Makefile OUTDIR=. pattern-trad
24 # ```
26 # If you add one of the (phony) targets `major`, `fugen`, `suffix`, `primary`,
27 # or `secondary`, patterns that only use major hyphenation points
28 # ('Haupttrennstellen') are created. If you add the (phony) target `gesang`,
29 # patterns usable for German lyrics are created. Example:
31 # ```
32 # make major pattern-refo
33 # ```
35 # The output directories have `-major` (etc.) appended to their names. Note
36 # that the `major`, `fugen`, and `suffix` targets reflect the markup in the
37 # `wortliste` file; they are not intended to produce patterns for 'good'
38 # hyphenation in text but rather to test the consistency of the markup, and
39 # to assist in adding new words.
41 # To control the used weights in the major hyphenation patterns, add variable
42 # `W=N`, where `N` gives the quality: value 1 specifies the best hyphenation
43 # points only, value 2 both the best and second-best points, etc. The
44 # default is value 0, using all major hyphenation points.
45 # Primary and secondary hyphenation patterns are major hyphenation patterns
46 # with `W=1` and `W=2`, respectively.
48 # The targets `schluss-s`, `schluss-s-1901`, and `schluss-s-1996` create
49 # (experimental) patterns and word lists for converting words in traditional
50 # and new orthography that make a distinction between long and round S as
51 # needed for typesetting with Fraktur fonts. An example for applying these
52 # patterns is the script `skripte/lib/py_patuse/long_s_conversion.py`.
54 # The targets `de_ligaturaufbruch`, `de-1901_ligaturaufbruch`, and
55 # `de-1996_ligaturaufbruch` create (experimental) patterns and word lists for
56 # 'breaking up' ligatures: The "hyphenation" points indicate positions where
57 # ligatures like 'fl' must not occur.
60 # Dieses Makefile erzeugt deutsche Trennmuster in den Unterverzeichnissen
61 # `$(TRAD)` und `$(REFO)` für die traditionelle bzw. reformierte
62 # Rechtschreibung. Trennmuster für tradionelles deutschschweizerisches
63 # Deutsch werden Verzeichnis `$(SWISS)` erzeugt.
65 # Die Eingabedaten werden im Verzeichnis `$(SRCDIR)` erwartet, welches
66 # standardmäßig identisch zum dem Verzeichnis ist, welches die
67 # `Makefile`-Datei enthält. Die Ausgabe wird in Verzeichnis `$(OUTDIR)`
68 # erzeugt, welches standardmäßig den Namen './muster' hat.
70 # Die möglichen Make-Ziele sind `pattern-trad`, `pattern-refo` und
71 # `pattern-swiss`. Wenn kein Ziel angegeben ist (oder man das Ziel `all`
72 # verwendet), werden alle drei Trennmuster erzeugt.
74 # Beispiel:
76 # ```
77 # mkdir build-patterns
78 # cd build-patterns
79 # make --makefile=~/git/wortliste/Makefile OUTDIR=. pattern-trad
80 # ```
82 # Wird eines der zusätzlichen (künstlichen) Ziele `major`, `fugen`, `suffix`,
83 # `primary` oder `secondary` angegeben, werden Haupttrennstellmuster erzeugt.
84 # Wird das (künstliche) Ziel `gesang` angegeben, werden Muster mit
85 # Gesangstrennstellen erzeugt.
87 # Beispiel:
89 # ```
90 # make major pattern-refo
91 # ```
93 # Die verwendeten Verzeichnisnamen sind die gleichen wie oben, allerdings mit
94 # einem angehängten `-major`, `-fugen`, `-suffix`, `-primary`, `-secondar` bzw.
95 # `-gesang`.
97 # Die Haupttrennstellmuster spiegeln die Auszeichnung in der Liste direkt
98 # wider. Sie haben nicht das Ziel, "gute" Trennungen in Texten zu erzeugen,
99 # sondern sind zum Testen der Konsistenz der Auszeichnung sowie zum
100 # "kategorisierten" Markieren der Trennstellen neuer Wörter gedacht.
102 # Bei `major` kann die Menge der verwendeten Haupttrennstellen mittels der
103 # Variable `W=N` (Wichtungs-Schwellwert) kontrolliert werden, wo `N` die
104 # Qualität angibt: Wert 1 selektiert nur die besten Haupttrennstellen, Wert 2
105 # die besten und zweitbesten Haupttrennstellen usw. Der Standardwert für `W`
106 # ist 0; er gibt an, dass alle Haupttrennstellen verwendet werden sollen.
107 # `primary` entspricht Haupttrennstellen mit `W=1`, `secondary` solchen mit
108 # `W=2`.
110 # Die Ziele `schluss-s`, `schluss-s-1901` und `schluss-s-1996` erzeugen
111 # (experimentelle) Wortlisten und Muster für die Wandlung von
112 # Wörtern in die Orthographievariante mit Unterscheidung von langem und
113 # runden S (Binnen-S vs. Schluß-S), wie sie im Satz mit gebrochenen Schriften
114 # benötigt wird (de-Latf). Ein Beispiel für die Anwendung dieser Muster
115 # ist das Skript `skripte/lib/py_patuse/long_s_conversion.py`.
117 # Die Ziele `de_ligaturaufbruch`, `de-1901_ligaturaufbruch`, and
118 # `de-1996_ligaturaufbruch` erzeugen (experimentelle) Wortlisten und
119 # Trennmuster, um Ligaturen 'aufzubrechen': Die Trennstellen zeigen an,
120 # wo Ligaturen wie 'fl' nicht auftreten dürfen.
124 # setup
127 W = 0
129 SRCDIR = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
130 DATADIR = $(SRCDIR)/daten
131 SCRIPTDIR = $(SRCDIR)/skripte
132 WORDLIST = $(SRCDIR)/wortliste
134 OUTDIR = ./muster
136 TRAD_TITLE_EN = German Hyphenation Patterns (Traditional Orthography)
137 REFO_TITLE_EN = German Hyphenation Patterns (Reformed Orthography, 2006)
138 SWISS_TITLE_EN = Swiss-German Hyphenation Patterns (Traditional Orthography)
139 TRAD_AND_REFO_TITLE_EN = German Hyphenation Patterns
140 TRAD_TITLE_DE = TeX-Trennmuster für die traditionelle deutsche Rechtschreibung
141 REFO_TITLE_DE = TeX-Trennmuster für die reformierte (2006) deutsche Rechtschreibung
142 SWISS_TITLE_DE = TeX-Trennmuster für die traditionelle deutsch-schweizerische Rechtschreibung
143 TRAD_AND_REFO_TITLE_DE = TeX-Trennmuster für die deutsche Sprache
144 TRAD_LANG_NAME = German, traditional spelling
145 REFO_LANG_NAME = German, reformed spelling
146 SWISS_LANG_NAME = German, traditional Swiss spelling
147 TRAD_AND_REFO_LANG_NAME = German
148 TRAD_LANG_TAG = de-1901
149 REFO_LANG_TAG = de-1996
150 SWISS_LANG_TAG = de-CH-1901
151 TRAD_AND_REFO_LANG_TAG = de
152 TEX_WRAPPER_SUFFIX = normal
154 .PHONY: major fugen suffix gesang
157 ifneq ($(findstring major,$(MAKECMDGOALS)),)
158 PATTYPE = -major
159 # A single `-` gets removed; all other combinations of `-`, `<`, `>`, and
160 # `=` are converted to a hyphen.
161 SED_PATTYPE = $(SED) -e '/[=<>-]/!n' \
162 -e 's/---*/=/g' \
163 -e 's/-//g' \
164 -e 's/[=<>][=<>]*/-/g'
165 PERL_PATTYPE = -g $(W) -1 -U
166 TRAD_TITLE_EN := $(subst German,German Major,$(TRAD_TITLE_EN))
167 REFO_TITLE_EN := $(subst German,German Major,$(REFO_TITLE_EN))
168 SWISS_TITLE_EN := $(subst German,German Major,$(SWISS_TITLE_EN))
169 TRAD_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Haupttrennstellen),$(TRAD_TITLE_DE))
170 REFO_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Haupttrennstellen),$(REFO_TITLE_DE))
171 SWISS_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Haupttrennstellen),$(SWISS_TITLE_DE))
172 TRAD_LANG_NAME := $(TRAD_LANG_NAME), major
173 REFO_LANG_NAME := $(REFO_LANG_NAME), major
174 SWISS_LANG_NAME := $(SWISS_LANG_NAME), major
175 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-major
176 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-major
177 SWISS_LANG_TAG := $(SWISS_LANG_TAG)-x-major
178 TEX_WRAPPER_SUFFIX := spezial
180 ifeq ($(words $(MAKECMDGOALS)),1)
181 major: all
182 else
183 # This is to suppress the 'nothing to be done' warning.
184 major:
186 endif
187 else ifneq ($(findstring fugen,$(MAKECMDGOALS)),)
188 PATTYPE = -fugen
189 # All combinations of `-`, `<`, `>`, `<=`, `=>` get removed, runs of `=`
190 # are converted to a hyphen.
191 SED_PATTYPE = $(SED) -e '/[=<>-]/!n' \
192 -e 's/--*//g' \
193 -e 's/<=*//g' \
194 -e 's/=*>//g' \
195 -e 's/[<>][<>]*//g' \
196 -e 's/[=][=]*/-/g'
197 PERL_PATTYPE = -g $(W) -1 -U
198 TRAD_TITLE_EN := $(subst German,German Compound,$(TRAD_TITLE_EN))
199 REFO_TITLE_EN := $(subst German,German Compound,$(REFO_TITLE_EN))
200 SWISS_TITLE_EN := $(subst German,German Compound,$(SWISS_TITLE_EN))
201 TRAD_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Wortfugen),$(TRAD_TITLE_DE))
202 REFO_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Wortfugen),$(REFO_TITLE_DE))
203 SWISS_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Wortfugen),$(SWISS_TITLE_DE))
204 TRAD_LANG_NAME := $(TRAD_LANG_NAME), compound
205 REFO_LANG_NAME := $(REFO_LANG_NAME), compound
206 SWISS_LANG_NAME := $(SWISS_LANG_NAME), compound
207 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-compound
208 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-compound
209 SWISS_LANG_TAG := $(SWISS_LANG_TAG)-x-compound
210 TEX_WRAPPER_SUFFIX := spezial
212 ifeq ($(words $(MAKECMDGOALS)),1)
213 fugen: all
214 else
215 # This is to suppress the 'nothing to be done' warning.
216 fugen:
218 endif
219 else ifneq ($(findstring suffix,$(MAKECMDGOALS)),)
220 PATTYPE = -suffix
221 # All combinations of `-`, `<`, `=` get removed, runs of `>` are converted
222 # to a hyphen.
223 SED_PATTYPE = $(SED) -e '/[=<>-]/!n' \
224 -e 's/-//g' \
225 -e 's/[<=][<=]*//g' \
226 -e 's/[>][>]*/-/g'
227 PERL_PATTYPE = -g $(W) -1 -U
228 TRAD_TITLE_EN := $(subst German,German Suffix,$(TRAD_TITLE_EN))
229 REFO_TITLE_EN := $(subst German,German Suffix,$(REFO_TITLE_EN))
230 SWISS_TITLE_EN := $(subst German,German Suffix,$(SWISS_TITLE_EN))
231 TRAD_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Suffixtrennstellen),$(TRAD_TITLE_DE))
232 REFO_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Suffixtrennstellen),$(REFO_TITLE_DE))
233 SWISS_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Suffixtrennstellen),$(SWISS_TITLE_DE))
234 TRAD_LANG_NAME := $(TRAD_LANG_NAME), suffix
235 REFO_LANG_NAME := $(REFO_LANG_NAME), suffix
236 SWISS_LANG_NAME := $(SWISS_LANG_NAME), suffix
237 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-suffix
238 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-suffix
239 SWISS_LANG_TAG := $(SWISS_LANG_TAG)-x-suffix
240 TEX_WRAPPER_SUFFIX := spezial
242 ifeq ($(words $(MAKECMDGOALS)),1)
243 suffix: all
244 else
245 # This is to suppress the 'nothing to be done' warning.
246 suffix:
248 endif
249 else ifneq ($(findstring primary,$(MAKECMDGOALS)),)
250 PATTYPE = -primary
251 # A single `-` gets removed; all other combinations of `-`, `<`, `>`, and
252 # `=` are converted to a hyphen.
253 SED_PATTYPE = $(SED) -e '/[=<>-]/!n' \
254 -e 's/---*/=/g' \
255 -e 's/-//g' \
256 -e 's/[=<>][=<>]*/-/g'
257 PERL_PATTYPE = -g 1 -1 -U
258 TRAD_TITLE_EN := $(subst German,German Primary,$(TRAD_TITLE_EN))
259 REFO_TITLE_EN := $(subst German,German Primary,$(REFO_TITLE_EN))
260 SWISS_TITLE_EN := $(subst German,German Primary,$(SWISS_TITLE_EN))
261 TRAD_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Primärtrennstellen),$(TRAD_TITLE_DE))
262 REFO_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Primärtrennstellen),$(REFO_TITLE_DE))
263 SWISS_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Primärtrennstellen),$(SWISS_TITLE_DE))
264 TRAD_LANG_NAME := $(TRAD_LANG_NAME), primary
265 REFO_LANG_NAME := $(REFO_LANG_NAME), primary
266 SWISS_LANG_NAME := $(SWISS_LANG_NAME), primary
267 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-primary
268 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-primary
269 SWISS_LANG_TAG := $(SWISS_LANG_TAG)-x-primary
270 TEX_WRAPPER_SUFFIX := spezial
271 PATGEN_PARAMS = -p
273 ifeq ($(words $(MAKECMDGOALS)),1)
274 primary: all
275 else
276 # This is to suppress the 'nothing to be done' warning.
277 primary:
279 endif
280 else ifneq ($(findstring secondary,$(MAKECMDGOALS)),)
281 PATTYPE = -secondar
282 # A single `-` gets removed; all other combinations of `-`, `<`, `>`, and
283 # `=` are converted to a hyphen.
284 SED_PATTYPE = $(SED) -e '/[=<>-]/!n' \
285 -e 's/---*/=/g' \
286 -e 's/-//g' \
287 -e 's/[=<>][=<>]*/-/g'
288 PERL_PATTYPE = -g 2 -1 -U
289 TRAD_TITLE_EN := $(subst German,German Secondary,$(TRAD_TITLE_EN))
290 REFO_TITLE_EN := $(subst German,German Secondary,$(REFO_TITLE_EN))
291 SWISS_TITLE_EN := $(subst German,German Secondary,$(SWISS_TITLE_EN))
292 TRAD_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Sekundärtrennstellen),$(TRAD_TITLE_DE))
293 REFO_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Sekundärtrennstellen),$(REFO_TITLE_DE))
294 SWISS_TITLE_DE := $(subst Trennmuster,Trennmuster (nur Sekundärtrennstellen),$(SWISS_TITLE_DE))
295 TRAD_LANG_NAME := $(TRAD_LANG_NAME), secondary
296 REFO_LANG_NAME := $(REFO_LANG_NAME), secondary
297 SWISS_LANG_NAME := $(SWISS_LANG_NAME), secondary
298 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-secondar
299 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-secondar
300 SWISS_LANG_TAG := $(SWISS_LANG_TAG)-x-secondar
301 TEX_WRAPPER_SUFFIX := spezial
302 PATGEN_PARAMS = -p
304 ifeq ($(words $(MAKECMDGOALS)),1)
305 secondary: all
306 else
307 # This is to suppress the 'nothing to be done' warning.
308 secondary:
310 endif
311 else ifneq ($(findstring gesang,$(MAKECMDGOALS)),)
312 PATTYPE = -gesang
313 SED_PATTYPE = cat
314 PERL_PATTYPE = -G -S
315 TRAD_TITLE_EN := $(subst German,German Lyrics,$(TRAD_TITLE_EN))
316 REFO_TITLE_EN := $(subst German,German Lyrics,$(REFO_TITLE_EN))
317 SWISS_TITLE_EN := $(subst German,German Lyrics,$(SWISS_TITLE_EN))
318 TRAD_TITLE_DE := $(subst Trennmuster,Trennmuster (Gesangstexte),$(TRAD_TITLE_DE))
319 REFO_TITLE_DE := $(subst Trennmuster,Trennmuster (Gesangstexte),$(REFO_TITLE_DE))
320 SWISS_TITLE_DE := $(subst Trennmuster,Trennmuster (Gesangstexte),$(SWISS_TITLE_DE))
321 TRAD_LANG_NAME := $(TRAD_LANG_NAME), lyrics
322 REFO_LANG_NAME := $(REFO_LANG_NAME), lyrics
323 SWISS_LANG_NAME := $(SWISS_LANG_NAME), lyrics
324 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-lyrics
325 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-lyrics
326 SWISS_LANG_TAG := $(SWISS_LANG_TAG)-x-lyrics
327 TEX_WRAPPER_SUFFIX := spezial
329 ifeq ($(words $(MAKECMDGOALS)),1)
330 gesang: all
331 else
332 # This is to suppress the 'nothing to be done' warning.
333 gesang:
335 endif
336 else ifneq ($(findstring ligaturaufbruch,$(MAKECMDGOALS)),)
337 PATTYPE = -ligaturaufbruch
338 TRAD_TITLE_EN := $(subst Hyphenation,Ligature Suppression,$(TRAD_TITLE_EN))
339 REFO_TITLE_EN := $(subst Hyphenation,Ligature Suppression,$(REFO_TITLE_EN))
340 TRAD_AND_REFO_TITLE_EN := $(subst Hyphenation,Ligature Suppression,$(TRAD_AND_REFO_TITLE_EN))
341 TRAD_TITLE_DE := $(subst Trennmuster,Pseudotrennmuster (Ligaturaufbruch),$(TRAD_TITLE_DE))
342 REFO_TITLE_DE := $(subst Trennmuster,Pseudotrennmuster (Ligaturaufbruch),$(REFO_TITLE_DE))
343 TRAD_AND_REFO_TITLE_DE := $(subst Trennmuster,Pseudotrennmuster (Ligaturaufbruch),$(TRAD_AND_REFO_TITLE_DE))
344 TRAD_LANG_NAME := $(TRAD_LANG_NAME), ligature suppression
345 REFO_LANG_NAME := $(REFO_LANG_NAME), ligature suppression
346 TRAD_AND_REFO_LANG_NAME := $(TRAD_AND_REFO_LANG_NAME), ligature suppression
347 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-liga
348 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-liga
349 TRAD_AND_REFO_LANG_TAG := $(TRAD_AND_REFO_LANG_TAG)-x-liga
350 else ifneq ($(findstring schluss-s,$(MAKECMDGOALS)),)
351 PATTYPE = -schluss-s
352 TRAD_TITLE_EN := $(subst Hyphenation,Round s,$(TRAD_TITLE_EN))
353 REFO_TITLE_EN := $(subst Hyphenation,Round s,$(REFO_TITLE_EN))
354 TRAD_AND_REFO_TITLE_EN := $(subst Hyphenation,Round s,$(TRAD_AND_REFO_TITLE_EN))
355 TRAD_TITLE_DE := $(subst Trennmuster,Pseudotrennmuster (Rund-s),$(TRAD_TITLE_DE))
356 REFO_TITLE_DE := $(subst Trennmuster,Pseudotrennmuster (Rund-s),$(REFO_TITLE_DE))
357 TRAD_AND_REFO_TITLE_DE := $(subst Trennmuster,Pseudotrennmuster (Rund-s),$(TRAD_AND_REFO_TITLE_DE))
358 TRAD_LANG_NAME := $(TRAD_LANG_NAME), round s
359 REFO_LANG_NAME := $(REFO_LANG_NAME), round s
360 TRAD_AND_REFO_LANG_NAME := $(TRAD_AND_REFO_LANG_NAME), round s
361 TRAD_LANG_TAG := $(TRAD_LANG_TAG)-x-round-s
362 REFO_LANG_TAG := $(REFO_LANG_TAG)-x-round-s
363 TRAD_AND_REFO_LANG_TAG := $(TRAD_AND_REFO_LANG_TAG)-x-round-s
364 else
365 PATTYPE =
366 SED_PATTYPE = cat
367 PERL_PATTYPE = -1 -U
368 endif
370 TRAD = dehypht-x$(PATTYPE)
371 REFO = dehyphn-x$(PATTYPE)
372 SWISS = dehyphts-x$(PATTYPE)
373 # The following variable is needed for special patterns such as ligature suppression.
374 TRAD_AND_REFO = dehyph-x$(PATTYPE)
376 LC_ENVVARS = LC_COLLATE=de_DE.UTF-8 \
377 LC_CTYPE=de_DE.UTF-8
379 CAT = cat
380 CHDIR = cd
381 COPY = cp
382 DATE = $(shell date '+%Y-%m-%d')
383 ECHO = echo
384 GIT = git
385 MKDIR = mkdir -p
386 PERL = perl
387 PWD = pwd
388 EXTRACT_TEX = $(SCRIPTDIR)/wortliste/extract-tex.pl
389 SPRACHAUSZUG = $(SCRIPTDIR)/wortliste/sprachauszug.py
390 S2LONG_S = $(SCRIPTDIR)/spezialmuster/lang_s/s2long-s.py
391 SED = sed
392 SH = bash
393 SORT = $(LC_ENVVARS) sort -d $(bsnl)\
394 | $(LC_ENVVARS) uniq -i
395 TR = tr
397 ifneq ($(findstring gesang,$(MAKECMDGOALS)),)
398 GERMAN_TR = $(DATADIR)/german-gesang.tr
399 LEFTHYPHENMIN = 1
400 RIGHTHYPHENMIN = 1
401 else ifneq ($(findstring schluss-s,$(MAKECMDGOALS)),)
402 GERMAN_TR = $(DATADIR)/german-gesang.tr
403 LEFTHYPHENMIN = 1
404 RIGHTHYPHENMIN = 1
405 else
406 GERMAN_TR = $(DATADIR)/german.tr
407 LEFTHYPHENMIN = \
408 $(strip $(shell $(SED) 's/^\(..\).*/\1/;q' < $(GERMAN_TR)))
409 RIGHTHYPHENMIN = \
410 $(strip $(shell $(SED) 's/^..\(..\).*/\1/;q' < $(GERMAN_TR)))
411 endif
413 GIT_VERSION := `$(CHDIR) $(SRCDIR) \
414 && $(GIT) log --format=%H -1 HEAD --`
416 TRADDIR = $(OUTDIR)/$(TRAD)
417 REFODIR = $(OUTDIR)/$(REFO)
418 SWISSDIR = $(OUTDIR)/$(SWISS)
419 TRAD_AND_REFO_DIR = $(OUTDIR)/$(TRAD_AND_REFO)
421 ifeq ("$(PATTYPE)", "-ligaturaufbruch")
422 TRADFILES = $(TRADDIR)/$(TRAD)-$(DATE).pat
423 REFOFILES = $(REFODIR)/$(REFO)-$(DATE).pat
424 TRAD_AND_REFO_FILES = $(TRAD_AND_REFO_DIR)/$(TRAD_AND_REFO)-$(DATE).pat
425 else ifeq ("$(PATTYPE)", "-schluss-s")
426 TRADFILES = $(TRADDIR)/$(TRAD)-$(DATE).pat
427 REFOFILES = $(REFODIR)/$(REFO)-$(DATE).pat
428 TRAD_AND_REFO_FILES = $(TRAD_AND_REFO_DIR)/$(TRAD_AND_REFO)-$(DATE).pat
429 else
430 TRADFILES = $(TRADDIR)/$(TRAD)-$(DATE).pat $(TRADDIR)/$(TRAD)-$(DATE).tex
431 REFOFILES = $(REFODIR)/$(REFO)-$(DATE).pat $(REFODIR)/$(REFO)-$(DATE).tex
432 SWISSFILES = $(SWISSDIR)/$(SWISS)-$(DATE).pat $(SWISSDIR)/$(SWISS)-$(DATE).tex
433 endif
435 # This macro defines a backslash followed by a newline. We use it to
436 # beautify canned recipes, avoiding overlong lines in the make output.
437 define bsnl
438 \$(strip)
440 endef
443 override SRCDIR := $(shell cd $(SRCDIR) && $(PWD))
447 # main targets
450 all: pattern-trad pattern-refo pattern-swiss
452 .PHONY: pattern-trad pattern-refo pattern-swiss
453 pattern-trad: $(TRADFILES)
454 pattern-refo: $(REFOFILES)
455 pattern-swiss: $(SWISSFILES)
458 # auxiliary targets
460 .PHONY: words-trad words-refo words-swiss
461 words-trad: $(TRADDIR)/words.hyphenated.trad
462 words-refo: $(REFODIR)/words.hyphenated.refo
463 words-swiss: $(SWISSDIR)/words.hyphenated.swiss
466 .PHONY: pre-trad pre-refo pre-swiss pre-trad-and-refo
467 pre-trad:
468 $(MKDIR) $(TRADDIR)
469 pre-refo:
470 $(MKDIR) $(REFODIR)
471 pre-swiss:
472 $(MKDIR) $(SWISSDIR)
473 pre-trad-and-refo:
474 $(MKDIR) $(TRAD_AND_REFO_DIR)
476 $(TRADFILES) $(TRADDIR)/words.hyphenated.trad: | pre-trad
477 $(REFOFILES) $(REFODIR)/words.hyphenated.refo: | pre-refo
478 $(SWISSFILES) $(SWISSDIR)/words.hyphenated.swiss: | pre-swiss
479 $(TRAD_AND_REFO_FILES) $(TRAD_AND_REFO_DIR)/words.hyphenated.de: | pre-trad-and-refo
481 # GNU make supports creation of multiple targets by a single invocation of a
482 # recipe only for pattern rules, thus we have to use a 'sentinel file' (using
483 # 'echo' for the time stamp).
485 $(TRADDIR)/pattern.8 \
486 $(TRADDIR)/pattern.rules: \
487 $(TRADDIR)/make-full-pattern-trad
488 $(REFODIR)/pattern.8 \
489 $(REFODIR)/pattern.rules: \
490 $(REFODIR)/make-full-pattern-refo
491 $(SWISSDIR)/pattern.8 \
492 $(SWISSDIR)/pattern.rules: \
493 $(SWISSDIR)/make-full-pattern-swiss
494 $(TRAD_AND_REFO_DIR)/pattern.8 \
495 $(TRAD_AND_REFO_DIR)/pattern.rules: \
496 $(TRAD_AND_REFO_DIR)/make-full-pattern-de
499 $(DATADIR)/german-gesang.tr: $(DATADIR)/german.tr
500 $(SED) -e '1c\
501 1 1' < $< > $@
504 # $(1): pattern directory
505 define make-full-pattern
506 $(CHDIR) $(strip $(1)) $(bsnl)\
507 && $(SH) $(SCRIPTDIR)/trennmuster/make-full-pattern.sh $(bsnl)\
508 $(PATGEN_PARAMS) $(<F) $(GERMAN_TR)
509 $(ECHO) done > $@
510 endef
512 # Both `make-full-pattern.sh` and `german.tr` control hyphenation parameters;
513 # it is thus a good idea to make them prerequisites.
514 $(TRADDIR)/make-full-pattern-trad \
515 $(REFODIR)/make-full-pattern-refo \
516 $(SWISSDIR)/make-full-pattern-swiss \
517 $(TRAD_AND_REFO_DIR)/make-full-pattern-de: \
518 $(SCRIPTDIR)/trennmuster/make-full-pattern.sh \
519 $(GERMAN_TR)
521 $(TRADDIR)/make-full-pattern-trad: $(TRADDIR)/words.hyphenated.trad
522 $(call make-full-pattern, $(TRADDIR))
523 $(REFODIR)/make-full-pattern-refo: $(REFODIR)/words.hyphenated.refo
524 $(call make-full-pattern, $(REFODIR))
525 $(SWISSDIR)/make-full-pattern-swiss: $(SWISSDIR)/words.hyphenated.swiss
526 $(call make-full-pattern, $(SWISSDIR))
527 $(TRAD_AND_REFO_DIR)/make-full-pattern-de: $(TRAD_AND_REFO_DIR)/words.hyphenated.de
528 $(call make-full-pattern, $(TRAD_AND_REFO_DIR))
530 # $(1): pattern file name
531 # $(2): pattern directory
532 # $(3): English pattern title
533 # $(4): German pattern title
534 # $(5): language name
535 # $(6): language tag
536 define make-pat-file
537 $(CAT) $(DATADIR)/kopf $(bsnl)\
538 | $(SED) -e "s/@ENGLISH_TITLE@/$(strip $(3))/" $(bsnl)\
539 -e "s/@GERMAN_TITLE@/$(strip $(4))/" $(bsnl)\
540 -e "s/@DATE@/$(DATE)/" $(bsnl)\
541 -e "s/@GIT_VERSION@/$(GIT_VERSION)/" $(bsnl)\
542 -e "s/@LANG_NAME@/$(strip $(5))/" $(bsnl)\
543 -e "s/@LANG_TAG@/$(strip $(6))/" $(bsnl)\
544 -e "s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" $(bsnl)\
545 -e "s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" $(bsnl)\
546 -e "s/@FILE_NAME@/$(strip $(1))/" > $@ $(bsnl)\
547 && $(CAT) $(strip $(2))/pattern.rules >> $@ $(bsnl)\
548 && $(CAT) $(DATADIR)/patterns-anfang >> $@ $(bsnl)\
549 && $(CAT) $(strip $(2))/pattern.8 >> $@ $(bsnl)\
550 && $(CAT) $(DATADIR)/patterns-ende >> $@
551 endef
553 $(TRADDIR)/$(TRAD)-$(DATE).pat: \
554 $(TRADDIR)/pattern.8 \
555 $(TRADDIR)/pattern.rules
556 $(call make-pat-file, \
557 $(TRAD), $(TRADDIR), \
558 $(TRAD_TITLE_EN), $(TRAD_TITLE_DE), \
559 $(TRAD_LANG_NAME), $(TRAD_LANG_TAG))
560 $(REFODIR)/$(REFO)-$(DATE).pat: \
561 $(REFODIR)/pattern.8 \
562 $(REFODIR)/pattern.rules
563 $(call make-pat-file, \
564 $(REFO), $(REFODIR), \
565 $(REFO_TITLE_EN), $(REFO_TITLE_DE), \
566 $(REFO_LANG_NAME), $(REFO_LANG_TAG))
567 $(SWISSDIR)/$(SWISS)-$(DATE).pat: \
568 $(SWISSDIR)/pattern.8 \
569 $(SWISSDIR)/pattern.rules
570 $(call make-pat-file, \
571 $(SWISS), $(SWISSDIR), \
572 $(SWISS_TITLE_EN), $(SWISS_TITLE_DE), \
573 $(SWISS_LANG_NAME), $(SWISS_LANG_TAG))
574 $(TRAD_AND_REFO_DIR)/$(TRAD_AND_REFO)-$(DATE).pat: \
575 $(TRAD_AND_REFO_DIR)/pattern.8 \
576 $(TRAD_AND_REFO_DIR)/pattern.rules
577 $(call make-pat-file, \
578 $(TRAD_AND_REFO), $(TRAD_AND_REFO_DIR), \
579 $(TRAD_AND_REFO_TITLE_EN), $(TRAD_AND_REFO_TITLE_DE), \
580 $(TRAD_AND_REFO_LANG_NAME), $(TRAD_AND_REFO_LANG_TAG))
582 # $(1): arguments for `extract-tex.pl`
583 define extract-tex
584 $(CAT) $< $(bsnl)\
585 | $(PERL) $(EXTRACT_TEX) \
586 $(strip $(1)) $(PERL_PATTYPE) $(bsnl)\
587 | $(SED_PATTYPE) $(bsnl)\
588 | $(SORT) $(bsnl)\
589 > $@
590 endef
592 # $(1): arguments for `-l` parameter of `sprachauszug.py`
593 define ligaturaufbruch-eingabe
594 $(SPRACHAUSZUG) -l $(strip $(1)) -s "morphemgrenzen,einfach" $(bsnl)\
595 $< > $@
596 endef
598 # words with hyphens following final "s" inside a word
599 # (Aus-sage, …, Zynis-mus)
600 define schluss-s-eingabe
601 $(SCRIPTDIR)/spezialmuster/lang_s/final_s_quasihyph.py < $< > $@
602 endef
604 ifeq ("$(PATTYPE)", "-ligaturaufbruch")
605 $(TRADDIR)/words.hyphenated.trad: $(WORDLIST) $(SPRACHAUSZUG)
606 $(call ligaturaufbruch-eingabe, \
607 "de-1901:de-CH-1901")
608 $(REFODIR)/words.hyphenated.refo: $(WORDLIST) $(SPRACHAUSZUG)
609 $(call ligaturaufbruch-eingabe, \
610 "de-1996:de-CH-1996")
611 $(TRAD_AND_REFO_DIR)/words.hyphenated.de: $(WORDLIST) $(SPRACHAUSZUG)
612 $(call ligaturaufbruch-eingabe, \
613 "de-1901:de-CH-1901:de-1996:de-CH-1996")
614 else ifeq ("$(PATTYPE)", "-schluss-s")
615 $(TRADDIR)/words.hyphenated.trad: exzerpte/de-Latf-1901
616 $(call schluss-s-eingabe)
617 $(REFODIR)/words.hyphenated.refo: exzerpte/de-Latf-1996
618 $(call schluss-s-eingabe)
619 $(TRAD_AND_REFO_DIR)/words.hyphenated.de: exzerpte/de-Latf
620 $(call schluss-s-eingabe)
621 else
622 $(TRADDIR)/words.hyphenated.trad: $(WORDLIST) $(EXTRACT_TEX)
623 $(call extract-tex, -t)
624 $(REFODIR)/words.hyphenated.refo: $(WORDLIST) $(EXTRACT_TEX)
625 $(call extract-tex)
626 $(SWISSDIR)/words.hyphenated.swiss: $(WORDLIST) $(EXTRACT_TEX)
627 $(call extract-tex, -s)
628 endif
630 # $(1): pattern file name
631 # $(2): language tag (will be converted to lower case, important for
632 # "de-CH-1901")
633 define make-tex-file
634 $(CAT) $(DATADIR)/mantel.1 $(bsnl)\
635 | $(SED) -e "s/@DATE@/$(DATE)/" $(bsnl)\
636 -e "s/@FILE_NAME@/$(strip $(1))/" > $@ $(bsnl)\
637 && LANG_TAG="$(shell $(ECHO) $(strip $(2)) \
638 | $(TR) '[:upper:]' '[:lower:]')" \
639 && $(CAT) $(DATADIR)/mantel.2-$(TEX_WRAPPER_SUFFIX) $(bsnl)\
640 | $(SED) "s/@LANG_TAG@/$$LANG_TAG/" >> $@ $(bsnl)\
641 && $(CAT) $(DATADIR)/mantel.3 >> $@
642 endef
644 $(TRADDIR)/$(TRAD)-$(DATE).tex: \
645 $(DATADIR)/mantel.1 \
646 $(DATADIR)/mantel.2-$(TEX_WRAPPER_SUFFIX) \
647 $(DATADIR)/mantel.3
648 $(call make-tex-file, $(TRAD), $(TRAD_LANG_TAG))
649 $(REFODIR)/$(REFO)-$(DATE).tex: \
650 $(DATADIR)/mantel.1 \
651 $(DATADIR)/mantel.2-$(TEX_WRAPPER_SUFFIX) \
652 $(DATADIR)/mantel.3
653 $(call make-tex-file, $(REFO), $(REFO_LANG_TAG))
654 $(SWISSDIR)/$(SWISS)-$(DATE).tex: \
655 $(DATADIR)/mantel.1 \
656 $(DATADIR)/mantel.2-$(TEX_WRAPPER_SUFFIX) \
657 $(DATADIR)/mantel.3
658 $(call make-tex-file, $(SWISS), $(SWISS_LANG_TAG))
662 # patterns for handling round 's' vs. long 'ſ'
665 # Word lists and patterns for converting words with only round 's' to
666 # words with distinction of round and long 's' according to the German
667 # orthograpy variant "de-Latf" (for texts typeset using *Fraktur*) .
669 # The patterns contain only round 's'. Hyphenation points after 's' indicate
670 # final 's' inside a word ('Aus-schuss' == 'Ausſchuſs').
672 .PHONY: schluss-s schluss-s-1901 schluss-s-1996
673 schluss-s: $(TRAD_AND_REFO_FILES)
674 schluss-s-1901: $(TRADFILES)
675 schluss-s-1996: $(REFOFILES)
677 # unhyphenated words with distinction of long-s and round-s
678 # (Auſsage, …, Zynismus)
679 exzerpte/de-Latf: $(WORDLIST) $(S2LONG_S)
680 $(S2LONG_S) --drop-homonyms -l 'de-1901,de-1996' < $< > $@
681 exzerpte/de-Latf-1901: $(WORDLIST) $(S2LONG_S)
682 $(S2LONG_S) --drop-homonyms -l de-1901 < $< > $@
683 exzerpte/de-Latf-1996: $(WORDLIST) $(S2LONG_S)
684 $(S2LONG_S) --drop-homonyms -l de-1996 < $< > $@
687 # patterns for 'breaking up' typographic ligatures
690 # Word lists and patterns 'de_ligaturaufbruch': 'de-1901' (old orthography),
691 # 'de-1996' (reformed orthgraphy), and mixed. The final patterns contain
692 # hyphenation points at positions where ligatures like 'fl' must not
693 # occur ('Dorfladen' => 'Dorf-laden').
695 .PHONY: de_ligaturaufbruch de-1901_ligaturaufbruch de-1996_ligaturaufbruch
696 de_ligaturaufbruch: $(TRAD_AND_REFO_FILES)
697 de-1901_ligaturaufbruch: $(TRADFILES)
698 de-1996_ligaturaufbruch: $(REFOFILES)
702 # experimental stuff
706 # Exzerpte mit `sprachauszug.py`
708 STILFILTER = $(SCRIPTDIR)/lib/py_wortliste/stilfilter.py
710 exzerpte/de-1996_morphemgrenzen: $(WORDLIST) $(STILFILTER)
711 $(SPRACHAUSZUG) -l de-1996 \
712 -s "morphemgrenzen,einfach" < $< > $@
713 exzerpte/de-1901_morphemgrenzen: $(WORDLIST) $(STILFILTER)
714 $(SPRACHAUSZUG) -l de-1901 \
715 -s "morphemgrenzen,einfach" < $< > $@
716 exzerpte/de-1996_hyphenmin3: $(WORDLIST) $(STILFILTER)
717 $(SPRACHAUSZUG) -l "de-1996,de-1996-x-versal" \
718 -s "standard,morphemisch,hyphenmin3,einfach" < $< > $@
719 exzerpte/de-1996_gesangstext-syllabisch: $(WORDLIST) $(STILFILTER)
720 $(SPRACHAUSZUG) -l "de-1996,de-1996-x-versal" \
721 -s "syllabisch,keine_schwankungsfaelle,einfach" < $< > $@
722 exzerpte/de-1996_gesangstext-morphemisch: $(WORDLIST) $(STILFILTER)
723 $(SPRACHAUSZUG) -l "de-1996,de-1996-x-versal" \
724 -s "morphemisch,keine_schwankungsfaelle,einfach" < $< > $@
726 # Wortliste mit Orthographie für Fraktursatz (s/ſ-Unterscheidung),
727 exzerpte/wortliste-Latf: $(WORDLIST) $(S2LONG_S)
728 $(S2LONG_S) -w < $< > $@
730 # EOF