1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23PRJ=..$/..
24PRJNAME=i18npool
25TARGET=breakiterator
26
27TARGETTYPE=CUI
28ENABLE_EXCEPTIONS=TRUE
29
30# --- Settings -----------------------------------------------------
31
32.INCLUDE :  settings.mk
33
34# --- Files --------------------------------------------------------
35
36# grab all .txt files under data directory, which are breakiterator rule files.
37MY_BRK_TXTFILES:=$(shell @ls data/*.txt)
38
39# insert "OpenOffice" as icu package name in front of the  name of each rule file for searching on application provided data
40MY_BRK_BRKFILES:=$(subst,data/,$(MISC)$/ $(MY_BRK_TXTFILES:s/.txt/.brk/))
41
42# OpenOffice_dat.c is a generated file from the rule file list by gencmn
43MY_MISC_CXXFILES := \
44        $(MISC)$/OpenOffice_dat.c \
45        $(MY_BRK_BRKFILES:s/.brk/_brk.c/)
46
47SLOFILES=   \
48	    $(SLO)$/breakiteratorImpl.obj \
49	    $(SLO)$/breakiterator_cjk.obj \
50	    $(SLO)$/breakiterator_ctl.obj \
51	    $(SLO)$/breakiterator_th.obj \
52	    $(SLO)$/breakiterator_unicode.obj \
53	    $(SLO)$/xdictionary.obj \
54        $(subst,$(MISC)$/,$(SLO)$/ $(MY_MISC_CXXFILES:s/.c/.obj/))
55
56OBJFILES   = $(OBJ)$/gendict.obj
57
58APP1TARGET = gendict
59APP1RPATH = NONE
60
61DEPOBJFILES   = $(OBJ)$/gendict.obj
62APP1OBJS   = $(DEPOBJFILES)
63
64APP1STDLIBS = $(SALLIB)
65
66# --- Targets ------------------------------------------------------
67
68.IF "$(SYSTEM_ICU)" == "YES"
69GENCMN:=$(SYSTEM_GENCMN)
70GENBRK:=$(SYSTEM_GENBRK)
71GENCCODE:=$(SYSTEM_GENCCODE)
72.ELSE
73GENCMN:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)$/gencmn
74GENBRK:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)$/genbrk
75GENCCODE:=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)$/genccode
76.ENDIF
77
78.INCLUDE .IGNORE :  icuversion.mk
79
80$(MISC)$/%.txt : data/%.txt
81# fdo#31271 ")" reclassified in more recent ICU/Unicode Standards
82.IF "$(ICU_MAJOR)" >= "5" || ("$(ICU_MAJOR)" == "4" && "$(ICU_MINOR)" >= "4")
83    $(SED) "s#\[:LineBreak =  Close_Punctuation:\]#\[\[:LineBreak =  Close_Punctuation:\] \[:LineBreak = Close_Parenthesis:\]\]#" $< > $@
84.ELSE
85    $(COPY) $< $@
86.ENDIF
87
88$(MISC)$/%.brk : $(MISC)/%.txt
89    $(WRAPCMD) $(GENBRK) -r $< -o $(MISC)$/$*.brk
90
91$(MISC)$/%_brk.c : $(MISC)$/%.brk
92    $(WRAPCMD) $(GENCCODE) -n OpenOffice -d $(MISC)$ $(MISC)$/$*.brk
93
94# 'gencmn', 'genbrk' and 'genccode' are tools generated and delivered by icu project to process icu breakiterator rules.
95# The output of gencmn generates warnings under Windows. We want to minimize the patches to external tools,
96# so the output (OpenOffice_icu_dat.c) is changed here to include a pragma to disable the warnings.
97# Output of gencmn is redirected to OpenOffice_icu_tmp.c with the -t switch.
98$(MISC)$/OpenOffice_%.c : $(MY_BRK_BRKFILES:s/.brk/_brk.c/)
99    $(WRAPCMD) $(GENCMN) -n OpenOffice -t tmp -S -d $(MISC) O $(mktmp $(subst,$(MISC)$/, $(MY_BRK_BRKFILES:t"\n")))
100    echo $(USQ)#ifdef _MSC_VER$(USQ) > $@
101    echo $(USQ)#pragma warning( disable : 4229 4668 )$(USQ) >> $@
102    echo $(USQ)#endif$(USQ) >> $@
103    $(TYPE) $(@:s/_dat/_tmp/) >> $@
104
105.INCLUDE :	target.mk
106
107