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 which 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ünstliche) 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 # Die Wichtung der verwendeten Haupttrennstellen kann mittels der Variable
64 # `W=N' 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.
73 DATADIR
= $(SRCDIR
)/daten
74 SCRIPTDIR
= $(SRCDIR
)/skripte
76 # Variables FROM and TO are used by goal `pidiff'. FROM must be a
77 # commit set from shell, like `make pidiff FROM=abcdef', TO is optional
78 # and evaluates to `HEAD' if not given.
80 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
82 # A single `-' gets removed; all other combinations of `-', `<', `>',
83 # and `=' are converted to a hyphen.
84 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
87 -e
's/[=<>][=<>]*/-/g' \
91 ifeq ($(words $(MAKECMDGOALS
)),1)
94 # This is to suppress the `nothing to be done' warning.
98 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
100 # All combinations of `-', `<', `>' get removed,
101 # runs of `=' are converted to a hyphen.
102 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
104 -e
's/[<>][<>]*//g' \
108 ifeq ($(words $(MAKECMDGOALS
)),1)
111 # This is to suppress the `nothing to be done' warning.
115 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
117 # All combinations of `-', `<', `=' get removed,
118 # runs of `>' are converted to a hyphen.
119 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
121 -e
's/[<=][<=]*//g' \
125 ifeq ($(words $(MAKECMDGOALS
)),1)
128 # This is to suppress the `nothing to be done' warning.
138 TRAD
= dehypht-x
$(MAJOR
)
139 REFO
= dehyphn-x
$(MAJOR
)
140 SWISS
= dehyphts-x
$(MAJOR
)
142 LC_ENVVARS
= LC_COLLATE
=de_DE.ISO8859-15 \
143 LC_CTYPE
=de_DE.ISO8859-15
148 DATE
= $(shell date
'+%Y-%m-%d')
151 ICONV
= iconv
-f iso-8859-15
-t utf-8
157 SORT
= $(LC_ENVVARS
) sort -d \
158 |
$(LC_ENVVARS
) uniq
-i
160 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
161 $(GIT) log --format=%H -1 HEAD --`
162 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
163 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
164 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
167 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
170 all: pattern-trad pattern-refo pattern-swiss
172 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
173 pattern-trad
: $(TRADFILES
)
174 pattern-refo
: $(REFOFILES
)
175 pattern-swiss
: $(SWISSFILES
)
177 # intermediate targets
181 .PHONY
: words-trad words-refo
182 words-trad
: $(TRAD
)/words.hyphenated.trad
183 words-refo
: $(REFO
)/words.hyphenated.refo
186 .PHONY
: pre-trad pre-refo pre-swiss
194 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
195 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
196 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
199 # GNU make supports creation of multiple targets by a single
200 # invocation of a recipe only for pattern rules, thus we have
201 # to use a `sentinel file' (using `echo' for the time stamp).
204 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
206 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
208 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
211 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
212 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
213 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
214 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
215 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
216 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
217 $(CAT
) $(TRAD
)/pattern
.8 \
219 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
222 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
224 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
226 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
229 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
230 $(CAT
) $(DATADIR
)/$(REFO
).1 \
231 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
232 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
233 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
234 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
235 $(CAT
) $(REFO
)/pattern
.8 \
237 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
240 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
242 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
244 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
247 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
248 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
249 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
250 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
251 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
252 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
253 $(CAT
) $(SWISS
)/pattern
.8 \
255 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
258 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
260 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-t
$(PERLMAJOR
) \
264 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
266 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
$(PERLMAJOR
) \
270 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
272 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-s
$(PERLMAJOR
) \
277 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
279 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
281 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
283 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
285 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
287 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
290 $(SH
) skripte
/patgen-list-diff.sh
$(FROM
) $(TO
)