source: packaging/Makefile.packages@ 1036

Last change on this file since 1036 was 832, checked in by Dmitry A. Kuminov, 15 years ago

packaging: Fixed noxwpdep.wpi (r825 regression).

File size: 8.7 KB
Line 
1#
2# Helper makefile for make_packages.cmd
3#
4
5all:
6 @echo This Makefile is not intended to be used directly.
7 @echo Use make_packages.cmd instead.
8
9#-------------------------------------------------------------------------------
10# Environment checks
11#-------------------------------------------------------------------------------
12
13ifeq ($(WIC),)
14$(error WIC unset!)
15endif
16ifeq ($(OUT_ROOT),)
17$(error OUT_ROOT unset!)
18endif
19ifeq ($(WPI_ROOT),)
20$(error WPI_ROOT unset!)
21endif
22ifeq ($(QT_BUILD),)
23$(error QT_BUILD unset!)
24endif
25ifeq ($(QT_INSTALL),)
26$(error QT_INSTALL unset!)
27endif
28ifeq ($(QT_VER_FULL),)
29$(error QT_VER_FULL unset!)
30endif
31
32$(foreach var,WPI_ROOT QT_BUILD QT_INSTALL,\
33 $(eval $(var) := $(subst \,/,$($(var)))))
34
35#-------------------------------------------------------------------------------
36# Definitions
37#-------------------------------------------------------------------------------
38
39pkg.readme.PATH = $(WPI_ROOT)/pkg.readme
40pkg.readme.SOURCES = \
41 $(QT_BUILD)/LGPL_EXCEPTION.txt \
42 $(QT_BUILD)/LICENSE.GPL3 \
43 $(QT_BUILD)/LICENSE.LGPL \
44 $(wildcard $(QT_BUILD)/changes-*) \
45 $(QT_BUILD)/README \
46 $(QT_BUILD)/README.OS2 \
47 $(QT_BUILD)/CHANGES.OS2
48
49#
50# Runtime archive
51#
52
53pkg.lib.instutils.PATH = $(WPI_ROOT)/pkg.lib.instutils
54pkg.lib.instutils.SOURCES = \
55 UpdateQtSysConf.cmd->util/
56
57pkg.lib.runtime.PATH = $(WPI_ROOT)/pkg.lib.runtime
58pkg.lib.runtime.SOURCES = \
59 $(QT_INSTALL)/bin/QtCLuc4.dll \
60 $(QT_INSTALL)/bin/QtCore4.dll \
61 $(QT_INSTALL)/bin/QtGui4.dll \
62 $(QT_INSTALL)/bin/QtHelp4.dll \
63 $(QT_INSTALL)/bin/QtNet4.dll \
64 $(QT_INSTALL)/bin/QtScri4.dll \
65 $(QT_INSTALL)/bin/QtScTl4.dll \
66 $(QT_INSTALL)/bin/QtSql4.dll \
67 $(QT_INSTALL)/bin/QtSvg4.dll \
68 $(QT_INSTALL)/bin/QtTest4.dll \
69 $(QT_INSTALL)/bin/QtWebK4.dll \
70 $(QT_INSTALL)/bin/QtXml4.dll \
71 $(QT_INSTALL)/bin/QtXmlP4.dll
72
73pkg.lib.plugins.PATH = $(WPI_ROOT)/pkg.lib.plugins
74pkg.lib.plugins.SOURCES = \
75 $(addsuffix ->accessible/, $(wildcard $(QT_INSTALL)/plugins/accessible/*.dll)) \
76 $(addsuffix ->codecs/, $(wildcard $(QT_INSTALL)/plugins/codecs/*.dll)) \
77 $(addsuffix ->graphicssystems/, $(wildcard $(QT_INSTALL)/plugins/graphicssystems/*.dll)) \
78 $(addsuffix ->iconengines/, $(wildcard $(QT_INSTALL)/plugins/iconengines/*.dll)) \
79 $(addsuffix ->imageformats/, $(wildcard $(QT_INSTALL)/plugins/imageformats/*.dll)) \
80 $(addsuffix ->sqldrivers/, $(wildcard $(QT_INSTALL)/plugins/sqldrivers/*.dll))
81
82pkg.lib.translations.PATH = $(WPI_ROOT)/pkg.lib.translations
83pkg.lib.translations.SOURCES = \
84 $(wildcard $(QT_INSTALL)/translations/qt_*.qm) \
85 $(wildcard $(QT_INSTALL)/translations/qt_help_*.qm)
86
87pkg.lib.systray.PATH = $(WPI_ROOT)/pkg.lib.systray
88pkg.lib.systray.SOURCES = \
89 $(QT_BUILD)/plugins/xcenter/xsystray.dll->plugins/xcenter/
90
91wpi.lib.PATH = $(OUT_ROOT)/qt-lib-$(QT_VER_FULL).wpi
92wpi.lib.SCRIPT = $(WPI_ROOT)/lib.wis
93wpi.lib.PACKAGES = \
94 pkg.lib.instutils=1 \
95 pkg.lib.runtime=2 \
96 pkg.lib.plugins=3 \
97 pkg.lib.translations=4 \
98 pkg.lib.systray=5 \
99 pkg.readme=6
100
101# create another WPI with no XWorkplace dependency, see #146
102wpi.lib_noxwpdep.PATH = $(OUT_ROOT)/qt-lib-$(QT_VER_FULL)-noxwpdep.wpi
103wpi.lib_noxwpdep.SCRIPT = $(WPI_ROOT)/lib_noxwpdep.wis
104wpi.lib_noxwpdep.PACKAGES = \
105 pkg.lib.instutils=1 \
106 pkg.lib.runtime=2 \
107 pkg.lib.plugins=3 \
108 pkg.lib.translations=4 \
109 pkg.readme=6
110
111#
112# Development archive
113#
114
115pkg.dev.runtime.PATH = $(WPI_ROOT)/pkg.dev.runtime
116pkg.dev.runtime.SOURCES = \
117 $(QT_INSTALL)/bin/QtAsCl4.dll \
118 $(QT_INSTALL)/bin/QtDsgn4.dll \
119 $(QT_INSTALL)/bin/QtDsgC4.dll
120
121pkg.dev.libraries.PATH = $(WPI_ROOT)/pkg.dev.libraries
122pkg.dev.libraries.SOURCES = \
123 $(addsuffix ->bin/, $(filter-out \
124 %/qtdemo.exe, \
125 $(wildcard $(QT_INSTALL)/bin/*.exe))) \
126 $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.lib)) \
127 $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.prl)) \
128 $(QT_INSTALL)/mkspecs/default/->mkspecs/ \
129 $(QT_INSTALL)/mkspecs/features/->mkspecs/ \
130 $(QT_INSTALL)/mkspecs/os2-g++/->mkspecs/ \
131 $(QT_INSTALL)/mkspecs/qconfig.pri->mkspecs/ \
132 $(QT_INSTALL)/include/ \
133 $(QT_INSTALL)/phrasebooks/ \
134 QtEnv.cmd->util/
135
136pkg.dev.plugins.PATH = $(WPI_ROOT)/pkg.dev.plugins
137pkg.dev.plugins.SOURCES = \
138 $(QT_INSTALL)/plugins/designer/qwebview.dll->designer/
139
140pkg.dev.translations.PATH = $(WPI_ROOT)/pkg.dev.translations
141pkg.dev.translations.SOURCES = \
142 $(wildcard $(QT_INSTALL)/translations/designer_*.qm) \
143 $(wildcard $(QT_INSTALL)/translations/linguist_*.qm) \
144 $(wildcard $(QT_INSTALL)/translations/assistant_*.qm)
145
146wpi.dev.PATH = $(OUT_ROOT)/qt-dev-$(QT_VER_FULL).wpi
147wpi.dev.SCRIPT = $(WPI_ROOT)/dev.wis
148wpi.dev.PACKAGES = \
149 pkg.dev.runtime=1 \
150 pkg.dev.libraries=2 \
151 pkg.dev.plugins=3 \
152 pkg.dev.translations=4 \
153 pkg.readme=5
154
155#
156# Examples archive
157#
158
159pkg.examples.demos.PATH = $(WPI_ROOT)/pkg.examples.demos
160pkg.examples.demos.SOURCES = \
161 $(wildcard $(QT_INSTALL)/demos/*/)
162
163pkg.examples.demo-plugins.PATH = $(WPI_ROOT)/pkg.examples.demo-plugins
164pkg.examples.demo-plugins.SOURCES = \
165 $(QT_INSTALL)/plugins/designer/arthurpl.dll->designer/
166
167pkg.examples.examples.PATH = $(WPI_ROOT)/pkg.examples.examples
168pkg.examples.examples.SOURCES = \
169 $(wildcard $(QT_INSTALL)/examples/*/) \
170
171pkg.examples.example-plugins.PATH = $(WPI_ROOT)/pkg.examples.example-plugins
172pkg.examples.example-plugins.SOURCES = \
173 $(QT_INSTALL)/plugins/designer/cntrext.dll->designer/ \
174 $(QT_INSTALL)/plugins/designer/cstmwgt.dll->designer/ \
175 $(QT_INSTALL)/plugins/designer/tskmext.dll->designer/ \
176 $(QT_INSTALL)/plugins/designer/wrldclk.dll->designer/
177
178pkg.examples.qtdemo.PATH = $(WPI_ROOT)/pkg.examples.qtdemo
179pkg.examples.qtdemo.SOURCES = \
180 $(QT_INSTALL)/bin/qtdemo.exe
181
182wpi.examples.PATH = $(OUT_ROOT)/qt-examples-$(QT_VER_FULL).wpi
183wpi.examples.SCRIPT = $(WPI_ROOT)/examples.wis
184wpi.examples.PACKAGES = \
185 pkg.examples.demos=1 \
186 pkg.examples.demo-plugins=2 \
187 pkg.examples.examples=3 \
188 pkg.examples.example-plugins=4 \
189 pkg.examples.qtdemo=5 \
190 pkg.readme=6
191
192#
193# Documentation archive
194#
195
196pkg.doc.qch.PATH = $(WPI_ROOT)/pkg.doc.qch
197pkg.doc.qch.SOURCES = \
198 $(wildcard $(QT_INSTALL)/doc/qch/)
199
200wpi.doc.PATH = $(OUT_ROOT)/qt-doc-$(QT_VER_FULL).wpi
201wpi.doc.SCRIPT = $(WPI_ROOT)/doc.wis
202wpi.doc.PACKAGES = \
203 pkg.doc.qch=1 \
204 pkg.readme=2
205
206#
207# Summary
208#
209
210WPIS = wpi.lib wpi.lib_noxwpdep wpi.dev wpi.examples wpi.doc
211
212#-------------------------------------------------------------------------------
213# Core functions
214#-------------------------------------------------------------------------------
215
216_EMPTY_ :=
217
218_DIRS_ :=
219
220define DirRule
221ifeq ($(filter $(1),$(_DIRS_)),)
222_DIRS_ += $(1)
223$(1):
224 mkdir-p.cmd $$@
225endif
226endef
227
228define EnsureDir
229$(eval $(call DirRule,$(1)))$(1)
230endef
231
232# Generate rules to copy one file.
233# @param $(1) Stem which file is to copy.
234# @param $(2) File name in format src[->tgt].
235define GenFileCopyRule
23690 := $(subst ->, ,$(2))
23791 := $$(word 1,$$(90))
23892 := $$(word 2,$$(90))
239ifeq ($$(91:%/=/),/)
24093 := 1
24191 := $$(91:%/=%)
242else
24393 := 0
244endif
245ifeq ($$(92),)
246 92 := $$(notdir $$(91))
247else
248ifeq ($$(92:%/=/),/)
249 92 := $$(92)$$(notdir $$(91))
250endif
251endif
25292 := $($(1).PATH)/$$(92)
253$(1).TARGETS += $$(92)
254$$(92): $$(91) | $$(call EnsureDir,$$(dir $$(92)))
255ifeq ($$(93),1)
256 xcopy /s /e /o "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"\ $(_EMPTY_)
257else
258 copy "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"
259endif
260endef
261
262_PACKAGES_ :=
263
264# Generate rules for one WPI package.
265# @param $(1) Package stem.
266define GenPkgRule
267ifeq ($$(filter $(1),$$(_PACKAGES_)),)
268_PACKAGES_ += $(1)
269$$(foreach file,$$($(1).SOURCES),$$(eval $$(call GenFileCopyRule,$(1),$$(file))))
270$(1): $$($(1).TARGETS)
271clean-$(1):
272 if exist "$($(1).PATH)" deltree.cmd "$(subst /,\,$($(1).PATH))" /Y /S
273endif
274endef
275
276define GenWpiRuleHelper
27790 := $(subst =, ,$(2))
27891 := $$(word 1,$$(90))
27992 := $$(word 2,$$(90))
280$(1)._PACKAGES_CMD += $$(92) -c$$($$(91).PATH) -r *
281$(1).PACKAGES += $$(91)
282endef
283
284# Generate rules for one WPI archive.
285# @param $(1) WPI stem.
286define GenWpiRule
287$(eval $(1)._PACKAGES := $($(1).PACKAGES))
288$(eval $(1)._PACKAGES_CMD :=)
289$(eval $(1).PACKAGES :=)
290$(foreach pkg,$($(1)._PACKAGES),$(eval $(call GenWpiRuleHelper,$(1),$(pkg))))
291# generate WPI target (depends on clean to make sure the removed files are not packed)
292$(1): clean-$(1) $($(1).PACKAGES) $($(1).SCRIPT)
293 -del $(subst /,\,$($(1).PATH))
294 $(WIC) $($(1).PATH) -a $($(1)._PACKAGES_CMD) -s $($(1).SCRIPT)
295# clean WPI target
296clean-$(1): $(foreach pkg,$($(1).PACKAGES),clean-$(pkg))
297# helpers
298$(foreach pkg,$($(1).PACKAGES),$(eval $(pkg).TARGETS :=))
299$(foreach pkg,$($(1).PACKAGES),$(eval $(call GenPkgRule,$(pkg))))
300endef
301
302#-------------------------------------------------------------------------------
303# Core function invocations
304#-------------------------------------------------------------------------------
305
306.PHONY: $(WPIS) $(foreach wpi,$(WPIS),$($(wpi).PACKAGES))
307
308$(foreach wpi,$(WPIS),$(eval $(call GenWpiRule,$(wpi))))
309
Note: See TracBrowser for help on using the repository browser.