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' \
106 -e
's/[<>][<>]*//g' \
110 ifeq ($(words $(MAKECMDGOALS
)),1)
113 # This is to suppress the `nothing to be done' warning.
117 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
119 # All combinations of `-', `<', `=' get removed,
120 # runs of `>' are converted to a hyphen.
121 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
123 -e
's/[<=][<=]*//g' \
127 ifeq ($(words $(MAKECMDGOALS
)),1)
130 # This is to suppress the `nothing to be done' warning.
140 TRAD
= dehypht-x
$(MAJOR
)
141 REFO
= dehyphn-x
$(MAJOR
)
142 SWISS
= dehyphts-x
$(MAJOR
)
144 LC_ENVVARS
= LC_COLLATE
=de_DE.ISO8859-15 \
145 LC_CTYPE
=de_DE.ISO8859-15
150 DATE
= $(shell date
'+%Y-%m-%d')
153 ICONV
= iconv
-f iso-8859-15
-t utf-8
159 SORT
= $(LC_ENVVARS
) sort -d \
160 |
$(LC_ENVVARS
) uniq
-i
162 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
163 $(GIT) log --format=%H -1 HEAD --`
164 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
165 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
166 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
169 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
172 all: pattern-trad pattern-refo pattern-swiss
174 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
175 pattern-trad
: $(TRADFILES
)
176 pattern-refo
: $(REFOFILES
)
177 pattern-swiss
: $(SWISSFILES
)
179 # intermediate targets
183 .PHONY
: words-trad words-refo
184 words-trad
: $(TRAD
)/words.hyphenated.trad
185 words-refo
: $(REFO
)/words.hyphenated.refo
188 .PHONY
: pre-trad pre-refo pre-swiss
196 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
197 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
198 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
201 # GNU make supports creation of multiple targets by a single
202 # invocation of a recipe only for pattern rules, thus we have
203 # to use a `sentinel file' (using `echo' for the time stamp).
206 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
208 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
210 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
213 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
214 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
215 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
216 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
217 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
218 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
219 $(CAT
) $(TRAD
)/pattern
.8 \
221 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
224 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
226 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
228 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
231 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
232 $(CAT
) $(DATADIR
)/$(REFO
).1 \
233 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
234 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
235 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
236 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
237 $(CAT
) $(REFO
)/pattern
.8 \
239 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
242 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
244 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
246 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
249 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
250 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
251 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
252 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
253 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
254 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
255 $(CAT
) $(SWISS
)/pattern
.8 \
257 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
260 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
262 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-t
$(PERLMAJOR
) \
266 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
268 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
$(PERLMAJOR
) \
272 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
274 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-s
$(PERLMAJOR
) \
279 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
281 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
283 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
285 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
287 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
289 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
292 $(SH
) skripte
/patgen-list-diff.sh
$(FROM
) $(TO
)