xref: /trunk/main/writerfilter/source/Makefile (revision 07327bc6)
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
23
24WFDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
25GBUILDDIR := $(SOLARENV)/gbuild
26
27include $(WFDIR)generated.mk
28include $(GBUILDDIR)/gbuild.mk
29
30# doctok
31
32doctok :
33	mkdir doctok
34
35wf_SRC_doctok_Model=$(WFDIR)doctok/resources.xmi
36wf_SRC_doctok_Resources_xsl=$(WFDIR)doctok/resources.xsl
37wf_SRC_doctok_ResourcesImpl_xsl=$(WFDIR)doctok/resourcesimpl.xsl
38wf_SRC_doctok_ResourceIds_xsl=$(WFDIR)doctok/resourceids.xsl
39wf_SRC_doctok_SprmIds_xsl=$(WFDIR)doctok/sprmids.xsl
40wf_SRC_doctok_ResourceTools_xsl=$(WFDIR)doctok/resourcetools.xsl
41
42wf_GEN_doctok_SprmIds_hxx=doctok/sprmids.hxx
43wf_GEN_doctok_ResourceIds_hxx=doctok/resourceids.hxx
44wf_GEN_doctok_Resources_hxx=doctok/resources.hxx
45wf_GEN_doctok_Resources_cxx=resources.cxx
46
47$(wf_GEN_doctok_SprmIds_hxx) : $(wf_SRC_doctok_SprmIds_xsl) $(wf_SRC_doctok_Model) | doctok
48	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
49
50$(wf_GEN_doctok_ResourceIds_hxx) : $(wf_SRC_doctok_ResourceIds_xsl) $(wf_SRC_doctok_Model) $(wf_SRC_doctok_ResourceTools_xsl) | doctok
51	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $(wf_SRC_doctok_ResourceIds_xsl) $(wf_SRC_doctok_Model)) > $@
52
53$(wf_GEN_doctok_Resources_hxx) : $(wf_SRC_doctok_Resources_xsl) $(wf_SRC_doctok_Model) | doctok
54	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
55
56$(wf_GEN_doctok_Resources_cxx) : $(wf_SRC_doctok_ResourcesImpl_xsl) $(wf_SRC_doctok_Model) $(wf_SRC_doctok_ResourceTools_xsl) | doctok
57	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
58
59# ooxml
60
61ooxml :
62	mkdir ooxml
63
64wf_SRC_ooxml_Model=$(WFDIR)ooxml/model.xml
65wf_SRC_ooxml_Preprocess_xsl=$(WFDIR)ooxml/modelpreprocess.xsl
66wf_SRC_ooxml_FactoryTools_xsl=$(WFDIR)ooxml/factorytools.xsl
67wf_SRC_ooxml_FastTokens_xsl=$(WFDIR)ooxml/fasttokens.xsl
68wf_SRC_ooxml_NamespaceIds_xsl=$(WFDIR)ooxml/namespaceids.xsl
69wf_SRC_ooxml_FactoryValues_xsl=$(WFDIR)ooxml/factory_values.xsl
70wf_SRC_ooxml_FactoryValuesImpl_xsl=$(WFDIR)ooxml/factoryimpl_values.xsl
71wf_SRC_ooxml_ResourceIds_xsl=$(WFDIR)ooxml/resourceids.xsl
72wf_SRC_ooxml_GperfFastTokenHandler_xsl=$(WFDIR)ooxml/gperffasttokenhandler.xsl
73wf_SRC_ooxml_Analyze_model_xsl=$(WFDIR)ooxml/analyzemodel.xsl
74wf_SRC_ooxml_Status_stage1_sh=$(WFDIR)ooxml/stage1.sh
75wf_SRC_ooxml_Status_stage2_xsl=$(WFDIR)ooxml/analyzestage2.xsl
76wf_SRC_ooxml_Status_stage3_xsl=$(WFDIR)ooxml/analyzestage3.xsl
77wf_SRC_ooxml_Status_todo_xsl=$(WFDIR)ooxml/todo.xsl
78wf_SRC_ooxml_Status_efforts_xsl=$(WFDIR)ooxml/effort.xsl
79
80wf_GEN_ooxml_ResourceIds_hxx=ooxml/resourceids.hxx
81
82wf_GEN_ooxml_token_xml=token.xml
83wf_GEN_ooxml_token_tmp=token.tmp
84
85wf_GEN_ooxml_Factory_hxx=OOXMLFactory_generated.hxx
86wf_GEN_ooxml_Factory_cxx=OOXMLFactory_generated.cxx
87wf_GEN_ooxml_FastTokens_hxx=ooxml/OOXMLFastTokens.hxx
88wf_GEN_ooxml_NamespaceIds_hxx=ooxml/OOXMLnamespaceids.hxx
89wf_GEN_ooxml_FactoryValues_hxx=OOXMLFactory_values.hxx
90wf_GEN_ooxml_FactoryValues_cxx=OOXMLFactory_values.cxx
91wf_GEN_ooxml_GperfFastToken_hxx=gperffasttoken.hxx
92wf_GEN_ooxml_Model_processed=model_preprocessed.xml
93wf_GEN_ooxml_Model_analyzed=ooxml/model_analyzed.xml
94wf_GEN_ooxml_Status_stage1=ooxml/status_stage1.xml
95wf_GEN_ooxml_Status_stage2=ooxml/status_stage2.xml
96wf_GEN_ooxml_Status_stage3=ooxml/status_stage3.xml
97wf_GEN_ooxml_Status_todo=ooxml/todo.xml
98wf_GEN_ooxml_Status_efforts=ooxml/efforts.csv
99
100$(wf_GEN_ooxml_token_tmp) : $(OUTDIR)/inc$(UPDMINOREXT)/oox/token/tokens.txt
101	cat $(OUTDIR)/inc$(UPDMINOREXT)/oox/token/tokens.txt \
102	| sed "s#\(.*\)#<fasttoken>\1</fasttoken>#" > $@
103
104$(wf_GEN_ooxml_token_xml) : $(WFDIR)ooxml/tokenxmlheader $(wf_GEN_ooxml_token_tmp) $(WFDIR)ooxml/tokenxmlfooter
105	cat $^ > $@
106
107$(wf_GEN_ooxml_FastTokens_hxx) : $(wf_SRC_ooxml_FastTokens_xsl) $(wf_GEN_ooxml_token_xml) | ooxml
108	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
109
110$(wf_GEN_ooxml_Factory_hxx) : $(WFDIR)ooxml/factoryinc.xsl $(wf_GEN_ooxml_Model_processed)
111	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $< $(wf_GEN_ooxml_Model_processed)) > $@
112
113$(wf_GEN_ooxml_Factory_cxx) : $(WFDIR)ooxml/factoryimpl.xsl $(wf_GEN_ooxml_Model_processed)
114	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $< $(wf_GEN_ooxml_Model_processed)) > $@
115
116OOXMLFactory%.cxx : $(WFDIR)ooxml/factoryimpl_ns.xsl $(wf_GEN_ooxml_Model_processed)
117	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) --stringparam file $@ $< $(wf_GEN_ooxml_Model_processed)) > $@
118
119OOXMLFactory%.hxx : $(WFDIR)ooxml/factory_ns.xsl $(wf_GEN_ooxml_Model_processed)
120	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) --stringparam file $@ $< $(wf_GEN_ooxml_Model_processed)) > $@
121
122$(wf_GEN_ooxml_FactoryValues_hxx) : $(wf_SRC_ooxml_FactoryValues_xsl) $(wf_GEN_ooxml_Model_processed)
123	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
124
125$(wf_GEN_ooxml_FactoryValues_cxx) : $(wf_SRC_ooxml_FactoryValuesImpl_xsl) $(wf_GEN_ooxml_Model_processed)
126	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
127
128$(wf_GEN_ooxml_ResourceIds_hxx) : $(wf_SRC_ooxml_ResourceIds_xsl) $(wf_GEN_ooxml_Model_processed) $(wf_SRC_ooxml_FactoryTools_xsl) | ooxml
129	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $(wf_SRC_ooxml_ResourceIds_xsl) $(wf_GEN_ooxml_Model_processed)) > $@
130
131$(wf_GEN_ooxml_NamespaceIds_hxx) : $(wf_SRC_ooxml_NamespaceIds_xsl) $(wf_GEN_ooxml_Model_processed) | ooxml
132	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
133
134$(wf_GEN_ooxml_GperfFastToken_hxx) : $(wf_SRC_ooxml_GperfFastTokenHandler_xsl) $(wf_GEN_ooxml_Model_processed)
135	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) \
136	| tr -d '\r' | gperf -I -t -E -S1 -c -G -LC++ > $@
137
138$(wf_GEN_ooxml_Model_analyzed): $(wf_SRC_ooxml_Analyze_model_xsl) $(wf_SRC_ooxml_Model) | ooxml
139	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
140
141$(wf_GEN_ooxml_Status_stage1) : $(wf_GEN_ooxml_Model_analyzed) $(wf_SRC_ooxml_stage1_sh) | ooxml
142	$(wf_SRC_ooxml_Status_stage1_sh) $(wf_GEN_ooxml_Model_analyzed) $(WFDIR)dmapper > $@
143
144$(wf_GEN_ooxml_Status_stage2) : $(wf_SRC_ooxml_Status_stage2_xsl) $(wf_GEN_ooxml_Status_stage1) | ooxml
145	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
146
147$(wf_GEN_ooxml_Status_stage3) : $(wf_SRC_ooxml_Status_stage3_xsl) $(wf_GEN_ooxml_Status_stage2) | ooxml
148	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
149
150$(wf_GEN_ooxml_Status_todo) : $(wf_SRC_ooxml_Status_todo_xsl) $(wf_GEN_ooxml_Status_stage3) | ooxml
151	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
152
153$(wf_GEN_ooxml_Status_efforts) : $(wf_SRC_ooxml_Status_efforts_xsl) $(wf_GEN_ooxml_Status_todo) | ooxml
154	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
155
156# rtftok
157
158wf_SRC_rtftok_scanner_lex=$(WFDIR)rtftok/RTFScanner.lex
159wf_SRC_rtftok_scanner_skl=$(WFDIR)rtftok/RTFScanner.skl
160
161wf_GEN_rtftok_scanner_cxx=RTFScanner.cxx
162
163# does not build, currently unused
164#$(wf_GEN_rtftok_scanner_cxx) : $(wf_SRC_rtftok_scanner_lex) $(wf_SRC_rtftok_scanner_skl)
165#	flex -+ -S$(wf_SRC_rtftok_scanner_skl) -o$@ $(wf_SRC_rtftok_scanner_lex)
166
167# resourcemodel
168
169wf_GEN_model_QNameToStr_cxx=qnametostr.cxx
170wf_GEN_ooxml_QNameToStr_tmp=OOXMLqnameToStr.tmp
171wf_GEN_model_SprmCodeToStr_cxx=sprmcodetostr.cxx
172wf_GEN_model_SprmCodeToStr_tmp=sprmcodetostr.tmp
173wf_GEN_doctok_QnameToStr_tmp=DOCTOKqnameToStr.tmp
174wf_SRC_doctok_SprmCodeToStr_xsl=$(WFDIR)doctok/sprmcodetostr.xsl
175wf_SRC_doctok_QNameToStr_xsl=$(WFDIR)doctok/qnametostr.xsl
176wf_SRC_ooxml_QNameToStr_xsl=$(WFDIR)ooxml/qnametostr.xsl
177wf_SRC_model_NamespacePreprocess=$(WFDIR)resourcemodel/namespace_preprocess.pl
178wf_GEN_ooxml_Namespacesmap_xsl=namespacesmap.xsl
179wf_DEP_ooxml_namespaces_txt=$(OUTDIR)/inc$(UPDMINOREXT)/oox/token/namespaces.txt
180wf_GEN_ooxml_preprocess_xsl=modelpreprocess.xsl
181
182$(wf_GEN_ooxml_QNameToStr_tmp): $(wf_SRC_ooxml_QNameToStr_xsl) $(wf_GEN_ooxml_Model_processed)
183	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
184
185$(wf_GEN_doctok_QnameToStr_tmp): $(wf_SRC_doctok_QNameToStr_xsl) $(wf_SRC_doctok_Model)
186	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
187
188$(wf_GEN_model_QNameToStr_cxx): $(WFDIR)resourcemodel/qnametostrheader $(wf_GEN_ooxml_QNameToStr_tmp) $(wf_GEN_doctok_QnameToStr_tmp) $(WFDIR)resourcemodel/qnametostrfooter
189	cat $^ > $@
190
191$(wf_GEN_model_SprmCodeToStr_tmp) : $(wf_SRC_doctok_SprmCodeToStr_xsl) $(wf_SRC_doctok_Model)
192	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $^) > $@
193
194$(wf_GEN_model_SprmCodeToStr_cxx): $(WFDIR)resourcemodel/sprmcodetostrheader $(wf_GEN_model_SprmCodeToStr_tmp) $(WFDIR)resourcemodel/sprmcodetostrfooter
195	cat $^ > $@
196
197$(wf_GEN_ooxml_Namespacesmap_xsl) : $(wf_SRC_ooxml_Model) $(wf_DEP_ooxml_namespaces_txt) $(wf_SRC_model_NamespacePreprocess)
198	$(PERL) $(wf_SRC_model_NamespacePreprocess) $(wf_DEP_ooxml_namespaces_txt) > $@
199
200$(wf_GEN_ooxml_preprocess_xsl) : $(wf_SRC_ooxml_Preprocess_xsl)
201	cp -f $^ $@
202
203$(wf_GEN_ooxml_Model_processed) : $(wf_GEN_ooxml_Namespacesmap_xsl) $(wf_GEN_ooxml_preprocess_xsl) $(wf_SRC_ooxml_Model)
204	$(call gb_Helper_abbreviate_dirs_native, $(gb_XSLTPROC) $(wf_GEN_ooxml_Namespacesmap_xsl) $(wf_SRC_ooxml_Model)) > $@
205
206# all
207
208.DEFAULT_GOAL:=all
209.PHONY: all
210all : \
211	$(wf_GEN_doctok_SprmIds_hxx) \
212	$(wf_GEN_doctok_ResourceIds_hxx) \
213	$(wf_GEN_doctok_Resources_hxx) \
214	$(wf_GEN_doctok_Resources_cxx) \
215	$(wf_GEN_ooxml_ResourceIds_hxx) \
216	$(wf_GEN_ooxml_Factory_hxx) \
217	$(wf_GEN_ooxml_Factory_cxx) \
218	$(wf_GEN_ooxml_FactoryValues_hxx) \
219	$(wf_GEN_ooxml_FactoryValues_cxx) \
220	$(wf_GEN_ooxml_FastTokens_hxx) \
221	$(wf_GEN_ooxml_GperfFastToken_hxx) \
222	$(wf_GEN_ooxml_NamespaceIds_hxx) \
223	$(wf_GEN_ooxml_Status_efforts) \
224	$(wf_GEN_model_QNameToStr_cxx) \
225	$(wf_GEN_model_SprmCodeToStr_cxx) \
226	$(patsubst %,OOXMLFactory_%.hxx,$(WRITERFILTER_OOXMLNAMESPACES)) \
227	$(patsubst %,OOXMLFactory_%.cxx,$(WRITERFILTER_OOXMLNAMESPACES)) \
228