source: packaging/Makefile.packages@ 727

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

packaging: Delete temporary package directories at start to make sure removed files are not accidentally packed to WPIs (this also fixes the problem of directories not being updated when gathering them in temporary package dirs).

File size: 7.4 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.runtime.PATH = $(WPI_ROOT)/pkg.lib.runtime
54pkg.lib.runtime.SOURCES = \
55 $(QT_INSTALL)/bin/QtCore4.dll \
56 $(QT_INSTALL)/bin/QtGui4.dll \
57 $(QT_INSTALL)/bin/QtNet4.dll \
58 $(QT_INSTALL)/bin/QtScri4.dll \
59 $(QT_INSTALL)/bin/QtScTl4.dll \
60 $(QT_INSTALL)/bin/QtSql4.dll \
61 $(QT_INSTALL)/bin/QtSvg4.dll \
62 $(QT_INSTALL)/bin/QtTest4.dll \
63 $(QT_INSTALL)/bin/QtXml4.dll \
64 $(QT_INSTALL)/bin/QtXmlP4.dll
65
66pkg.lib.instutils.PATH = $(WPI_ROOT)/pkg.lib.instutils
67pkg.lib.instutils.SOURCES = \
68 UpdateQtSysConf.cmd->util/
69
70pkg.lib.plugins.PATH = $(WPI_ROOT)/pkg.lib.plugins
71pkg.lib.plugins.SOURCES = \
72 $(addsuffix ->accessible/, $(wildcard $(QT_INSTALL)/plugins/accessible/*.dll)) \
73 $(addsuffix ->codecs/, $(wildcard $(QT_INSTALL)/plugins/codecs/*.dll)) \
74 $(addsuffix ->iconengines/, $(wildcard $(QT_INSTALL)/plugins/iconengines/*.dll)) \
75 $(addsuffix ->imageformats/,$(wildcard $(QT_INSTALL)/plugins/imageformats/*.dll)) \
76 $(addsuffix ->sqldrivers/, $(wildcard $(QT_INSTALL)/plugins/sqldrivers/*.dll))
77
78pkg.lib.translations.PATH = $(WPI_ROOT)/pkg.lib.translations
79pkg.lib.translations.SOURCES = \
80 $(filter-out $(wildcard $(QT_INSTALL)/translations/qt_help*.qm),\
81 $(wildcard $(QT_INSTALL)/translations/qt_*.qm))
82
83pkg.lib.systray.PATH = $(WPI_ROOT)/pkg.lib.systray
84pkg.lib.systray.SOURCES = \
85 $(QT_BUILD)/plugins/xcenter/xsystray.dll->plugins/xcenter/
86
87wpi.lib.PATH = $(OUT_ROOT)/qt-lib-$(QT_VER_FULL).wpi
88wpi.lib.SCRIPT = $(WPI_ROOT)/lib.wis
89wpi.lib.PACKAGES = \
90 pkg.lib.runtime=1 \
91 pkg.lib.instutils=2 \
92 pkg.lib.plugins=3 \
93 pkg.lib.translations=4 \
94 pkg.lib.systray=5 \
95 pkg.readme=6
96
97#
98# Development archive
99#
100
101# @todo QtDsgn4.dll and QtDsgC4.dll must be taken from $(QT_INSTALL)
102# on the next release
103
104pkg.dev.libraries.PATH = $(WPI_ROOT)/pkg.dev.libraries
105pkg.dev.libraries.SOURCES = \
106 $(addsuffix ->bin/, $(wildcard $(QT_INSTALL)/bin/*.exe)) \
107 $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.lib)) \
108 $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.prl)) \
109 $(QT_INSTALL)/mkspecs/default/->mkspecs/ \
110 $(QT_INSTALL)/mkspecs/features/->mkspecs/ \
111 $(QT_INSTALL)/mkspecs/os2-g++/->mkspecs/ \
112 $(QT_INSTALL)/mkspecs/qconfig.pri->mkspecs/ \
113 $(QT_INSTALL)/include/ \
114 $(QT_INSTALL)/phrasebooks/ \
115 QtEnv.cmd->util/
116
117pkg.dev.runtime.PATH = $(WPI_ROOT)/pkg.dev.runtime
118pkg.dev.runtime.SOURCES = \
119 $(QT_BUILD)/bin/QtDsgn4.dll \
120 $(QT_BUILD)/bin/QtDsgC4.dll
121
122pkg.dev.translations.PATH = $(WPI_ROOT)/pkg.dev.translations
123pkg.dev.translations.SOURCES = \
124 $(wildcard $(QT_INSTALL)/translations/designer_*.qm) \
125 $(wildcard $(QT_INSTALL)/translations/linguist_*.qm)
126
127wpi.dev.PATH = $(OUT_ROOT)/qt-dev-$(QT_VER_FULL).wpi
128wpi.dev.SCRIPT = $(WPI_ROOT)/dev.wis
129wpi.dev.PACKAGES = \
130 pkg.dev.libraries=1 \
131 pkg.dev.runtime=2 \
132 pkg.dev.translations=3 \
133 pkg.readme=4
134
135#
136# Examples archive
137#
138
139pkg.examples.demos.PATH = $(WPI_ROOT)/pkg.examples.demos
140pkg.examples.demos.SOURCES = \
141 $(wildcard $(QT_INSTALL)/demos/*/) \
142
143pkg.examples.demo-plugins.PATH = $(WPI_ROOT)/pkg.examples.demo-plugins
144pkg.examples.demo-plugins.SOURCES = \
145 $(QT_INSTALL)/plugins/designer/arthurpl.dll->designer/
146
147pkg.examples.examples.PATH = $(WPI_ROOT)/pkg.examples.examples
148pkg.examples.examples.SOURCES = \
149 $(wildcard $(QT_INSTALL)/examples/*/) \
150
151# @todo add examples.example-plugins
152# @todo install qtdemo in bin/ when it's ready
153
154wpi.examples.PATH = $(OUT_ROOT)/qt-examples-$(QT_VER_FULL).wpi
155wpi.examples.SCRIPT = $(WPI_ROOT)/examples.wis
156wpi.examples.PACKAGES = \
157 pkg.examples.demos=1 \
158 pkg.examples.demo-plugins=2 \
159 pkg.examples.examples=3 \
160 pkg.readme=4
161
162#
163# Summary
164#
165
166WPIS = wpi.lib wpi.dev wpi.examples
167
168#-------------------------------------------------------------------------------
169# Core functions
170#-------------------------------------------------------------------------------
171
172_EMPTY_ :=
173
174_DIRS_ :=
175
176define EnsureDir
177ifneq ($(1),./)
178ifneq ($(1:%:/=:/),:/)
179ifeq ($$(filter $(1),$$(_DIRS_)),)
180_DIRS_ += $(1)
181$$(eval $$(call EnsureDir,$(dir $(1:%/=%))))
182$$(shell if not exist "$(subst /,\,$(1:%/=%))" mkdir "$(subst /,\,$(1:%/=%))" >nul 2>&1)
183endif
184endif
185endif
186endef
187
188# Generate rules to copy one file.
189# @param $(1) Stem which file is to copy.
190# @param $(2) File name in format src[->tgt].
191define GenFileCopyRule
19290 := $(subst ->, ,$(2))
19391 := $$(word 1,$$(90))
19492 := $$(word 2,$$(90))
195ifeq ($$(91:%/=/),/)
19693 := 1
19791 := $$(91:%/=%)
198else
19993 := 0
200endif
201ifeq ($$(92),)
202 92 := $$(notdir $$(91))
203else
204ifeq ($$(92:%/=/),/)
205 92 := $$(92)$$(notdir $$(91))
206endif
207endif
20892 := $($(1).PATH)/$$(92)
209$(1).TARGETS += $$(92)
210$$(eval $$(call EnsureDir,$$(dir $$(92))))
211$$(92): $$(91)
212ifeq ($$(93),1)
213 xcopy /s /e /o "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"\ $(_EMPTY_)
214else
215 copy "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"
216endif
217endef
218
219_PACKAGES_ :=
220
221# Generate rules for one WPI package.
222# @param $(1) Package stem.
223define GenPkgRule
224ifeq ($$(filter $(1),$$(_PACKAGES_)),)
225_PACKAGES_ += $(1)
226$$(foreach file,$$($(1).SOURCES),$$(eval $$(call GenFileCopyRule,$(1),$$(file))))
227$(1): $$($(1).TARGETS)
228clean-$(1):
229 if exist "$($(1).PATH)" deltree.cmd "$(subst /,\,$($(1).PATH))" /Y /S
230endif
231endef
232
233define GenWpiRuleHelper
23490 := $(subst =, ,$(2))
23591 := $$(word 1,$$(90))
23692 := $$(word 2,$$(90))
237$(1)._PACKAGES_CMD += $$(92) -c$$($$(91).PATH) -r *
238$(1).PACKAGES += $$(91)
239endef
240
241# Generate rules for one WPI archive.
242# @param $(1) WPI stem.
243define GenWpiRule
244$(eval $(1)._PACKAGES := $($(1).PACKAGES))
245$(eval $(1)._PACKAGES_CMD :=)
246$(eval $(1).PACKAGES :=)
247$(foreach pkg,$($(1)._PACKAGES),$(eval $(call GenWpiRuleHelper,$(1),$(pkg))))
248# generate WPI target (depends on clean to make sure the removed files are not packed)
249$(1): clean-$(1) $($(1).PACKAGES) $($(1).SCRIPT)
250 -del $(subst /,\,$($(1).PATH))
251 $(WIC) $($(1).PATH) -a $($(1)._PACKAGES_CMD) -s $($(1).SCRIPT)
252# clean WPI target
253clean-$(1): $(foreach pkg,$($(1).PACKAGES),clean-$(pkg))
254# helpers
255$(foreach pkg,$($(1).PACKAGES),$(eval $(pkg).TARGETS :=))
256$(foreach pkg,$($(1).PACKAGES),$(eval $(call GenPkgRule,$(pkg))))
257endef
258
259#-------------------------------------------------------------------------------
260# Core function invocations
261#-------------------------------------------------------------------------------
262
263.PHONY: $(WPIS) $(foreach wpi,$(WPIS),$($(wpi).PACKAGES))
264
265$(foreach wpi,$(WPIS),$(eval $(call GenWpiRule,$(wpi))))
266
Note: See TracBrowser for help on using the repository browser.