Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / i18npool / CustomTarget_breakiterator.mk
blobf12b94c4a5b71f30cb38e768c9614c877202d235
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 # Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License or as specified alternatively below. You may obtain a copy of
7 # the License at http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
12 # License.
14 # The Initial Developer of the Original Code is
15 # Matúš Kukan <matus.kukan@gmail.com>
16 # Portions created by the Initial Developer are Copyright (C) 2011 the
17 # Initial Developer. All Rights Reserved.
19 # Major Contributor(s):
21 # For minor contributions see the git repository.
23 # Alternatively, the contents of this file may be used under the terms of
24 # either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 # the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 # instead of those above.
29 $(eval $(call gb_CustomTarget_CustomTarget,i18npool/breakiterator))
31 i18npool_BIDIR := $(call gb_CustomTarget_get_workdir,i18npool/breakiterator)
33 $(call gb_CustomTarget_get_target,i18npool/breakiterator) : \
34 $(i18npool_BIDIR)/dict_ja.cxx $(i18npool_BIDIR)/dict_zh.cxx $(i18npool_BIDIR)/OpenOffice_dat.c
36 $(i18npool_BIDIR)/dict_%.cxx : \
37 $(SRCDIR)/i18npool/source/breakiterator/data/%.dic \
38 $(call gb_Executable_get_target_for_build,gendict) \
39 | $(i18npool_BIDIR)/.dir
40 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),DIC,1)
41 $(call gb_Helper_abbreviate_dirs,\
42 $(call gb_Helper_execute,gendict) $< $@ $(patsubst $(i18npool_BIDIR)/dict_%.cxx,%,$@))
44 ifeq ($(SYSTEM_GENBRK),)
45 i18npool_GENBRKTARGET := $(call gb_Executable_get_target_for_build,genbrk)
46 i18npool_GENBRK := $(call gb_Helper_execute,genbrk)
47 else
48 i18npool_GENBRKTARGET :=
49 i18npool_GENBRK := $(SYSTEM_GENBRK)
50 endif
52 ifeq ($(SYSTEM_GENCCODE),)
53 i18npool_GENCCODETARGET := $(call gb_Executable_get_target_for_build,genccode)
54 i18npool_GENCCODE := $(call gb_Helper_execute,genccode)
55 else
56 i18npool_GENCCODETARGET :=
57 i18npool_GENCCODE := $(SYSTEM_GENCCODE)
58 endif
60 ifeq ($(SYSTEM_GENCMN),)
61 i18npool_GENCMNTARGET := $(call gb_Executable_get_target_for_build,gencmn)
62 i18npool_GENCMN := $(call gb_Helper_execute,gencmn)
63 else
64 i18npool_GENCMNTARGET :=
65 i18npool_GENCMN := $(SYSTEM_GENCMN)
66 endif
68 i18npool_BRKTXTS := \
69 char_in.brk \
70 char.brk \
71 count_word_fi.brk \
72 count_word.brk \
73 dict_word_fi.brk \
74 dict_word_he.brk \
75 dict_word_hu.brk \
76 dict_word_nodash.brk \
77 dict_word_prepostdash.brk \
78 dict_word.brk \
79 edit_word_he.brk \
80 edit_word_hu.brk \
81 edit_word.brk \
82 line.brk \
83 sent.brk
85 # 'gencmn', 'genbrk' and 'genccode' are tools generated and delivered by icu project to process icu breakiterator rules.
86 # The output of gencmn generates warnings under Windows. We want to minimize the patches to external tools,
87 # so the output (OpenOffice_dat.c) is changed here to include a pragma to disable the warnings.
88 # Output of gencmn is redirected to OpenOffice_tmp.c with the -t switch.
89 $(i18npool_BIDIR)/OpenOffice_dat.c : $(SRCDIR)/i18npool/CustomTarget_breakiterator.mk \
90 $(patsubst %.brk,$(i18npool_BIDIR)/%_brk.c,$(i18npool_BRKTXTS)) \
91 $(i18npool_GENCMNTARGET)
92 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CMN,1)
93 $(call gb_Helper_abbreviate_dirs,\
94 RESPONSEFILE=$(shell $(gb_MKTEMP)) && \
95 $(foreach brk,$(i18npool_BRKTXTS),echo '$(brk)' >> $${RESPONSEFILE} && ) \
96 $(i18npool_GENCMN) -n OpenOffice -t tmp -S -d $(i18npool_BIDIR)/ 0 $${RESPONSEFILE} && \
97 rm -f $${RESPONSEFILE} && \
98 echo '#ifdef _MSC_VER' > $@ && \
99 echo '#pragma warning( disable : 4229 4668 )' >> $@ && \
100 echo '#endif' >> $@ && \
101 cat $(subst _dat,_tmp,$@) >> $@)
103 $(i18npool_BIDIR)/%_brk.c : $(i18npool_BIDIR)/%.brk $(i18npool_GENCCODETARGET)
104 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CCD,1)
105 $(call gb_Helper_abbreviate_dirs,\
106 $(i18npool_GENCCODE) -n OpenOffice -d $(i18npool_BIDIR)/ $< \
107 $(if $(findstring s,$(MAKEFLAGS)),> /dev/null))
109 $(i18npool_BIDIR)/%.brk : $(i18npool_BIDIR)/%.txt $(i18npool_GENBRKTARGET)
110 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),BRK,1)
111 $(call gb_Helper_abbreviate_dirs,\
112 $(i18npool_GENBRK) -r $< -o $@ $(if $(findstring s,$(MAKEFLAGS)),> /dev/null))
114 # fdo#31271 ")" reclassified in more recent Unicode Standards / ICU 4.4
115 # * Prepend set empty as of Unicode Version 6.1 / ICU 4.9, which bails out if used.
116 # NOTE: strips every line with _word_ 'Prepend', including $Prepend
117 # * Conditional_Japanese_Starter does not exist in ICU 4.6, which bails out if used.
118 # * Hebrew_Letter does not exist in ICU 4.6, which bails out if used.
119 # NOTE: I sincerely hope there is a better way to avoid problems than this abominable
120 # sed substitution...
121 $(i18npool_BIDIR)/%.txt : \
122 $(SRCDIR)/i18npool/source/breakiterator/data/%.txt | $(i18npool_BIDIR)/.dir
123 sed -e ': dummy' \
124 -e "s#\[:LineBreak = Close_Punctuation:\]#\[& \[:LineBreak = Close_Parenthesis:\]\]#" \
125 $(if $(filter-out YES,$(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)),\
126 -e '/\[:LineBreak = Conditional_Japanese_Starter:\]/d' \
127 -e 's# $$CJ##' \
129 $(if $(filter-out YES,$(ICU_RECLASSIFIED_HEBREW_LETTER)),\
130 -e '/\[:LineBreak = Hebrew_Letter:\]/d' \
131 -e '/^$$HLcm =/d' \
132 -e '/^$$HLcm $$NUcm;/d' \
133 -e '/^$$NUcm $$HLcm;/d' \
134 -e '/^$$HL $$CM+;/d' \
135 -e 's# | $$HL\(cm\)\?##g' \
136 -e 's#$$HLcm ##g' \
137 -e 's# $$HL##g' \
139 $(if $(filter YES,$(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)),-e "/Prepend/d") \
140 $< > $@
142 # vim: set noet sw=4 ts=4: