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#**************************************************************
21PRJ=..$/..
22PRJNAME=writerfilter
23TARGET=resourcemodel
24#LIBTARGET=NO
25#USE_DEFFILE=TRUE
26ENABLE_EXCEPTIONS=TRUE
27
28# --- Settings -----------------------------------------------------
29
30.INCLUDE :  settings.mk
31.INCLUDE :  $(PRJ)$/inc$/writerfilter.mk
32
33#CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
34#CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
35CDEFS+=-DWRITERFILTER_DLLIMPLEMENTATION
36
37
38# --- Files --------------------------------------------------------
39
40# work around gcc taking hours and/or OOM'ing on this file
41NOOPTFILES= \
42	$(SLO)$/qnametostr.obj
43
44SLOFILES= \
45	$(SLO)$/Fraction.obj \
46	$(SLO)$/LoggedResources.obj \
47	$(SLO)$/Protocol.obj \
48	$(SLO)$/ResourceModelHelper.obj \
49	$(SLO)$/TagLogger.obj \
50	$(SLO)$/WW8Analyzer.obj \
51	$(SLO)$/XPathLogger.obj \
52	$(SLO)$/qnametostr.obj \
53	$(SLO)$/resourcemodel.obj \
54	$(SLO)$/sprmcodetostr.obj \
55	$(SLO)$/util.obj \
56
57# FreeBSD/Linux 64-bit: compiler (gcc 4.2.x) fails with 'out of memory'
58.IF "$(OUTPATH)"=="unxfbsdx" || "$(OUTPATH)"=="unxfbsdi" || "$(OUTPATH)"=="unxlngx6"
59NOOPTFILES= \
60	$(SLO)$/qnametostr.obj
61.ENDIF
62
63SHL1TARGET=$(TARGET)
64
65.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC"
66RTFTOKLIB=-lrtftok
67DOCTOKLIB=-ldoctok
68OOXMLLIB=-looxml
69.ELIF "$(GUI)"=="WNT"
70RTFTOKLIB=$(LB)$/irtftok.lib
71DOCTOKLIB=$(LB)$/idoctok.lib
72OOXMLLIB=$(LB)$/iooxml.lib
73.ENDIF
74
75SHL1STDLIBS=$(SALLIB)\
76	$(CPPULIB)\
77	$(CPPUHELPERLIB) \
78    $(COMPHELPERLIB)
79
80SHL1IMPLIB=i$(SHL1TARGET)
81SHL1USE_EXPORTS=name
82
83SHL1OBJS=$(SLOFILES)
84
85SHL1DEF=$(MISC)$/$(SHL1TARGET).def
86DEF1NAME=$(SHL1TARGET)
87DEFLIB1NAME=$(TARGET)
88
89# --- Targets ------------------------------------------------------
90
91.INCLUDE :	target.mk
92
93RESOURCEMODELCXXOUTDIR=$(MISC)
94DOCTOKHXXOUTDIR=$(INCCOM)$/doctok
95OOXMLHXXOUTDIR=$(INCCOM)$/ooxml
96
97DOCTOKHXXOUTDIRCREATED=$(DOCTOKHXXOUTDIR)$/created
98OOXMLHXXOUTDIRCREATED=$(OOXMLHXXOUTDIR)$/created
99
100OOXMLMODEL=..$/ooxml$/model.xml
101OOXMLPREPROCESSXSL=..$/ooxml$/modelpreprocess.xsl
102OOXMLPREPROCESSXSLCOPIED=$(MISC)$/modelpreprocess.xsl
103OOXMLQNAMETOSTRXSL=..$/ooxml$/qnametostr.xsl
104OOXMLANALYZERXSL=..$/ooxml$/analyzer.xsl
105OOXMLRESOURCEIDSXSL=..$/ooxml$/resourceids.xsl
106OOXMLFACTORYTOOLSXSL=..$/ooxml$/factorytools.xsl
107DOCTOKMODEL=..$/doctok$/resources.xmi
108DOCTOKQNAMETOSTRXSL=..$/doctok$/qnametostr.xsl
109DOCTOKANALYZERXSL=..$/doctok$/analyzer.xsl
110DOCTOKSPRMCODETOSTRXSL=..$/doctok$/sprmcodetostr.xsl
111DOCTOKRESOURCEIDSXSL=..$/doctok$/resourceids.xsl
112DOCTOKSPRMIDSXSL=..$/doctok$/sprmids.xsl
113DOCTOKRESOURCETOOLS=..$/doctok$/resourcetools.xsl
114
115NSPROCESS=namespace_preprocess.pl
116
117MODELPROCESSED=$(MISC)$/model_preprocessed.xml
118
119QNAMETOSTRCXX=$(RESOURCEMODELCXXOUTDIR)$/qnametostr.cxx
120OOXMLQNAMETOSTRTMP=$(RESOURCEMODELCXXOUTDIR)$/OOXMLqnameToStr.tmp
121DOCTOKQNAMETOSTRTMP=$(RESOURCEMODELCXXOUTDIR)$/DOCTOKqnameToStr.tmp
122SPRMCODETOSTRCXX=$(RESOURCEMODELCXXOUTDIR)$/sprmcodetostr.cxx
123SPRMCODETOSTRTMP=$(RESOURCEMODELCXXOUTDIR)$/sprmcodetostr.tmp
124DOCTOKRESOURCEIDSHXX=$(DOCTOKHXXOUTDIR)$/resourceids.hxx
125SPRMIDSHXX=$(DOCTOKHXXOUTDIR)$/sprmids.hxx
126OOXMLRESOURCEIDSHXX=$(OOXMLHXXOUTDIR)$/resourceids.hxx
127
128NSXSL=$(MISC)$/namespacesmap.xsl
129NAMESPACESTXT=$(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token$/namespaces.txt
130
131GENERATEDHEADERS=$(DOCTOKRESOURCEIDSHXX) $(OOXMLRESOURCEIDSHXX) $(SPRMIDSHXX)
132GENERATEDFILES= \
133	$(GENERATEDHEADERS) \
134	$(QNAMETOSTRCXX) \
135	$(SPRMCODETOSTRCXX) \
136	$(MODELPROCESSED) \
137	$(OOXMLQNAMETOSTRTMP) \
138	$(DOCTOKQNAMETOSTRTMP) \
139	$(SPRMCODETOSTRTMP)
140
141$(OOXMLQNAMETOSTRTMP): $(OOXMLQNAMETOSTRXSL) $(MODELPROCESSED)
142    @echo "Making:   " $(@:f)
143	$(XSLTPROC) $(OOXMLQNAMETOSTRXSL:s!\!/!) $(MODELPROCESSED) > $@
144
145$(DOCTOKQNAMETOSTRTMP): $(DOCTOKQNAMETOSTRXSL) $(DOCTOKMODEL)
146    @echo "Making:   " $(@:f)
147	$(XSLTPROC) $(DOCTOKQNAMETOSTRXSL:s!\!/!) $(DOCTOKMODEL) > $@
148
149$(QNAMETOSTRCXX): $(OOXMLQNAMETOSTRTMP) $(DOCTOKQNAMETOSTRTMP) qnametostrheader qnametostrfooter $(OOXMLFACTORYTOOLSXSL) $(DOCTOKRESOURCETOOLS)
150	@$(TYPE) qnametostrheader $(OOXMLQNAMETOSTRTMP) $(DOCTOKQNAMETOSTRTMP) qnametostrfooter > $@
151
152$(SPRMCODETOSTRTMP): $(DOCTOKSPRMCODETOSTRXSL) $(DOCTOKMODEL)
153    @echo "Making:   " $(@:f)
154	$(XSLTPROC) $(DOCTOKSPRMCODETOSTRXSL:s!\!/!) $(DOCTOKMODEL) > $@
155
156$(SPRMCODETOSTRCXX): sprmcodetostrheader $(SPRMCODETOSTRTMP) sprmcodetostrfooter
157	@$(TYPE) $< > $@
158
159$(SLO)$/sprmcodetostr.obj: $(SPRMCODETOSTRCXX)
160$(SLO)$/qnametostr.obj: $(QNAMETOSTRCXX)
161
162$(SLOFILES): $(GENERATEDHEADERS)
163
164$(DOCTOKHXXOUTDIRCREATED):
165	@$(MKDIRHIER) $(DOCTOKHXXOUTDIR)
166	@$(TOUCH) $@
167
168$(DOCTOKRESOURCEIDSHXX): $(DOCTOKHXXOUTDIRCREATED) $(DOCTOKRESOURCETOOLS) $(DOCTOKRESOURCEIDSXSL) $(DOCTOKMODEL)
169    @echo "Making:   " $(@:f)
170	$(COMMAND_ECHO)$(XSLTPROC) $(DOCTOKRESOURCEIDSXSL:s!\!/!) $(DOCTOKMODEL) > $@
171
172$(OOXMLHXXOUTDIRCREATED):
173	@$(MKDIRHIER) $(OOXMLHXXOUTDIR)
174	@$(TOUCH) $@
175
176$(OOXMLPREPROCESSXSLCOPIED): $(OOXMLPREPROCESSXSL)
177	@$(COPY) $(OOXMLPREPROCESSXSL) $@
178
179$(NSXSL) : $(OOXMLMODEL) $(NAMESPACESTXT) $(NSPROCESS)
180	@$(PERL) $(NSPROCESS) $(NAMESPACESTXT) > $@
181
182$(MODELPROCESSED): $(NSXSL) $(OOXMLPREPROCESSXSLCOPIED) $(OOXMLMODEL)
183	@echo "Making:   " $(@:f)
184	$(COMMAND_ECHO)$(XSLTPROC) $(NSXSL) $(OOXMLMODEL) > $@
185
186$(OOXMLRESOURCEIDSHXX): $(OOXMLHXXOUTDIRCREATED) $(OOXMLFACTORYTOOLSXSL) $(OOXMLRESOURCEIDSXSL) $(MODELPROCESSED)
187    @echo "Making:   " $(@:f)
188	$(COMMAND_ECHO)$(XSLTPROC) $(OOXMLRESOURCEIDSXSL:s!\!/!) $(MODELPROCESSED) > $@
189
190$(SPRMIDSHXX): $(DOCTOKHXXOUTDIRCREATED) $(DOCTOKSPRMIDSXSL) $(DOCTOKMODEL)
191    @echo "Making:   " $(@:f)
192	$(COMMAND_ECHO)$(XSLTPROC) $(DOCTOKSPRMIDSXSL:s!\!/!) $(DOCTOKMODEL) > $@
193
194.PHONY: genclean genmake gendirs
195
196genclean:
197	rm -f $(GENERATEDFILES)
198
199genmake: $(GENERATEDFILES)
200
201