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 the (phony) target `major', patterns which only use major
18 # hyphenation points (`Haupttrennstellen') are created. Example:
20 # make major pattern-refo
22 # The used directories names are the same as above but with `-major'
23 # appended to the names.
25 # To control the used weights in the major hyphenation patterns, add
26 # variable `W=N', where `N' gives the quality: value 1 specifies the best
27 # hyphenation points only, value 2 both the best and second-best points,
28 # etc. The default is value 0, using all major hyphenation points.
32 # Dieses Makefile erzeugt deutsche Trennmuster in den
33 # Unterverzeichnissen $(TRAD) und $(REFO) für die traditionelle
34 # bzw. reformierte Rechtschreibung. Trennmuster für tradionelles
35 # deutschschweizerisches Deutsch werden Verzeichnis $(SWISS) erzeugt.
37 # Die Eingabedaten werden im Verzeichnis $(SRCDIR) erwartet; die möglichen
38 # Make-Ziele sind `pattern-trad', `pattern-refo' und `pattern-swiss'. Wenn
39 # kein Ziel angegeben ist (oder man das Ziel `all' verwendet), werden alle
40 # drei Trennmuster erzeugt.
42 # SRCDIR (und die anderen Variablen) kann man leicht beim Aufruf von
43 # `make' als Parameter modifizieren, z.B.
45 # make pattern-trad SRCDIR=~/git/wortliste
47 # Wird zusätzlich das zusätzliche (künstliche) Ziel `major' angegeben,
48 # werden Haupttrennstellmuster erzeugt.
52 # make major pattern-refo
54 # Die verwendeten Verzeichnisnamen sind die gleichen wie oben, allerdings
55 # mit einem angehängten `-major'.
57 # Die Wichtung der verwendeten Haupttrennstellen kann mittels der Variable
58 # `W=N' kontrolliert werden, wo `N' die Qualität angibt: Wert 1 selektiert
59 # nur die besten Haupttrennstellen, Wert 2 die besten und zweitbesten
60 # Haupttrennstellen usw. Der Standardwert für `W' ist 0; er gibt an, dass
61 # alle Haupttrennstellen verwendet werden sollen.
67 DATADIR
= $(SRCDIR
)/daten
68 SCRIPTDIR
= $(SRCDIR
)/skripte
70 # Variables FROM and TO are used by goal `pidiff'. FROM must be a
71 # commit set from shell, like `make pidiff FROM=abcdef', TO is optional
72 # and evaluates to `HEAD' if not given.
74 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
76 # A single `-' gets removed; all other combinations of `-', `<', `>',
77 # `=', and `|' are converted to a hyphen.
78 SEDMAJOR
= $(SED
) -e
'/[=|<>-]/!n' \
81 -e
's/[=|<>][=|<>]*/-/g' \
85 ifeq ($(words $(MAKECMDGOALS
)),1)
88 # This is to suppress the `nothing to be done' warning.
98 TRAD
= dehypht-x
$(MAJOR
)
99 REFO
= dehyphn-x
$(MAJOR
)
100 SWISS
= dehyphts-x
$(MAJOR
)
102 LC_ENVVARS
= LC_COLLATE
=de_DE.ISO8859-15 \
103 LC_CTYPE
=de_DE.ISO8859-15
108 DATE
= $(shell date
'+%Y-%m-%d')
111 ICONV
= iconv
-f iso-8859-15
-t utf-8
117 SORT
= $(LC_ENVVARS
) sort -d \
118 |
$(LC_ENVVARS
) uniq
-i
120 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
121 $(GIT) log --format=%H -1 HEAD --`
122 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
123 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
124 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
127 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
130 all: pattern-trad pattern-refo pattern-swiss
132 .PHONY
: pattern-trad pattern-refo pattern-swiss major
133 pattern-trad
: $(TRADFILES
)
134 pattern-refo
: $(REFOFILES
)
135 pattern-swiss
: $(SWISSFILES
)
139 .PHONY
: words-trad words-refo
140 words-trad
: $(TRAD
)/words.hyphenated.trad
141 words-refo
: $(REFO
)/words.hyphenated.refo
144 .PHONY
: pre-trad pre-refo pre-swiss
152 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
153 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
154 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
157 # GNU make supports creation of multiple targets by a single
158 # invocation of a recipe only for pattern rules, thus we have
159 # to use a `sentinel file' (using `echo' for the time stamp).
162 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
164 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
166 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
169 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
170 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
171 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
172 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
173 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
174 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
175 $(CAT
) $(TRAD
)/pattern
.8 \
177 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
180 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
182 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
184 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
187 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
188 $(CAT
) $(DATADIR
)/$(REFO
).1 \
189 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
190 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
191 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
192 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
193 $(CAT
) $(REFO
)/pattern
.8 \
195 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
198 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
200 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
202 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
205 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
206 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
207 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
208 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" > $@
; \
209 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
210 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
211 $(CAT
) $(SWISS
)/pattern
.8 \
213 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
216 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
218 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-t
$(PERLMAJOR
) \
222 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
224 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
$(PERLMAJOR
) \
228 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
230 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-l
-s
$(PERLMAJOR
) \
235 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
237 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
239 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
241 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
243 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
245 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
248 $(SH
) skripte
/patgen-list-diff.sh
$(FROM
) $(TO
)