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