1 | #
|
---|
2 | # Helper makefile for make_packages.cmd
|
---|
3 | #
|
---|
4 |
|
---|
5 | all:
|
---|
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 |
|
---|
13 | ifeq ($(WIC),)
|
---|
14 | $(error WIC unset!)
|
---|
15 | endif
|
---|
16 | ifeq ($(OUT_ROOT),)
|
---|
17 | $(error OUT_ROOT unset!)
|
---|
18 | endif
|
---|
19 | ifeq ($(WPI_ROOT),)
|
---|
20 | $(error WPI_ROOT unset!)
|
---|
21 | endif
|
---|
22 | ifeq ($(QT_BUILD),)
|
---|
23 | $(error QT_BUILD unset!)
|
---|
24 | endif
|
---|
25 | ifeq ($(QT_INSTALL),)
|
---|
26 | $(error QT_INSTALL unset!)
|
---|
27 | endif
|
---|
28 | ifeq ($(QT_VER_FULL),)
|
---|
29 | $(error QT_VER_FULL unset!)
|
---|
30 | endif
|
---|
31 |
|
---|
32 | $(foreach var,WPI_ROOT QT_BUILD QT_INSTALL,\
|
---|
33 | $(eval $(var) := $(subst \,/,$($(var)))))
|
---|
34 |
|
---|
35 | #-------------------------------------------------------------------------------
|
---|
36 | # Definitions
|
---|
37 | #-------------------------------------------------------------------------------
|
---|
38 |
|
---|
39 | pkg.readme.PATH = $(WPI_ROOT)/pkg.readme
|
---|
40 | pkg.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 | # Runtime archive
|
---|
50 |
|
---|
51 | pkg.lib.runtime.PATH = $(WPI_ROOT)/pkg.lib.runtime
|
---|
52 | pkg.lib.runtime.SOURCES = \
|
---|
53 | $(QT_INSTALL)/bin/QtCore4.dll \
|
---|
54 | $(QT_INSTALL)/bin/QtGui4.dll \
|
---|
55 | $(QT_INSTALL)/bin/QtNet4.dll \
|
---|
56 | $(QT_INSTALL)/bin/QtScri4.dll \
|
---|
57 | $(QT_INSTALL)/bin/QtScTl4.dll \
|
---|
58 | $(QT_INSTALL)/bin/QtSql4.dll \
|
---|
59 | $(QT_INSTALL)/bin/QtSvg4.dll \
|
---|
60 | $(QT_INSTALL)/bin/QtTest4.dll \
|
---|
61 | $(QT_INSTALL)/bin/QtXml4.dll \
|
---|
62 | $(QT_INSTALL)/bin/QtXmlP4.dll
|
---|
63 |
|
---|
64 | pkg.lib.instutils.PATH = $(WPI_ROOT)/pkg.lib.instutils
|
---|
65 | pkg.lib.instutils.SOURCES = \
|
---|
66 | UpdateQtSysConf.cmd->util/
|
---|
67 |
|
---|
68 | pkg.lib.plugins.PATH = $(WPI_ROOT)/pkg.lib.plugins
|
---|
69 | pkg.lib.plugins.SOURCES = \
|
---|
70 | $(addsuffix ->accessible/, $(wildcard $(QT_INSTALL)/plugins/accessible/*.dll)) \
|
---|
71 | $(addsuffix ->codecs/, $(wildcard $(QT_INSTALL)/plugins/codecs/*.dll)) \
|
---|
72 | $(addsuffix ->iconengines/, $(wildcard $(QT_INSTALL)/plugins/iconengines/*.dll)) \
|
---|
73 | $(addsuffix ->imageformats/,$(wildcard $(QT_INSTALL)/plugins/imageformats/*.dll)) \
|
---|
74 | $(addsuffix ->sqldrivers/, $(wildcard $(QT_INSTALL)/plugins/sqldrivers/*.dll))
|
---|
75 |
|
---|
76 | pkg.lib.translations.PATH = $(WPI_ROOT)/pkg.lib.translations
|
---|
77 | pkg.lib.translations.SOURCES = \
|
---|
78 | $(filter-out $(wildcard $(QT_INSTALL)/translations/qt_help*.qm),\
|
---|
79 | $(wildcard $(QT_INSTALL)/translations/qt_*.qm))
|
---|
80 |
|
---|
81 | pkg.lib.systray.PATH = $(WPI_ROOT)/pkg.lib.systray
|
---|
82 | pkg.lib.systray.SOURCES = \
|
---|
83 | $(QT_BUILD)/plugins/xcenter/xsystray.dll->plugins/xcenter/
|
---|
84 |
|
---|
85 | wpi.lib.PATH = $(OUT_ROOT)/qt-lib-$(QT_VER_FULL).wpi
|
---|
86 | wpi.lib.SCRIPT = $(WPI_ROOT)/lib.wis
|
---|
87 | wpi.lib.PACKAGES = pkg.lib.runtime=1 pkg.lib.instutils=2 pkg.lib.plugins=3 \
|
---|
88 | pkg.lib.translations=4 pkg.lib.systray=5 pkg.readme=6
|
---|
89 |
|
---|
90 | # Development archive
|
---|
91 |
|
---|
92 | # @todo QtDsgn4.dll and QtDsgC4.dll must be taken from $(QT_INSTALL)
|
---|
93 | # on the next release
|
---|
94 |
|
---|
95 | pkg.dev.libraries.PATH = $(WPI_ROOT)/pkg.dev.libraries
|
---|
96 | pkg.dev.libraries.SOURCES = \
|
---|
97 | $(addsuffix ->bin/, $(wildcard $(QT_INSTALL)/bin/*.exe)) \
|
---|
98 | $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.lib)) \
|
---|
99 | $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.prl)) \
|
---|
100 | $(QT_INSTALL)/mkspecs/default/->mkspecs/ \
|
---|
101 | $(QT_INSTALL)/mkspecs/features/->mkspecs/ \
|
---|
102 | $(QT_INSTALL)/mkspecs/os2-g++/->mkspecs/ \
|
---|
103 | $(QT_INSTALL)/mkspecs/qconfig.pri->mkspecs/ \
|
---|
104 | $(QT_INSTALL)/include/ \
|
---|
105 | $(QT_INSTALL)/phrasebooks/ \
|
---|
106 | QtEnv.cmd->util/
|
---|
107 |
|
---|
108 | pkg.dev.runtime.PATH = $(WPI_ROOT)/pkg.dev.runtime
|
---|
109 | pkg.dev.runtime.SOURCES = \
|
---|
110 | $(QT_BUILD)/bin/QtDsgn4.dll \
|
---|
111 | $(QT_BUILD)/bin/QtDsgC4.dll
|
---|
112 |
|
---|
113 | pkg.dev.translations.PATH = $(WPI_ROOT)/pkg.dev.translations
|
---|
114 | pkg.dev.translations.SOURCES = \
|
---|
115 | $(wildcard $(QT_INSTALL)/translations/designer_*.qm) \
|
---|
116 | $(wildcard $(QT_INSTALL)/translations/linguist_*.qm)
|
---|
117 |
|
---|
118 | wpi.dev.PATH = $(OUT_ROOT)/qt-dev-$(QT_VER_FULL).wpi
|
---|
119 | wpi.dev.SCRIPT = $(WPI_ROOT)/dev.wis
|
---|
120 | wpi.dev.PACKAGES = pkg.dev.libraries=1 pkg.dev.runtime=2 \
|
---|
121 | pkg.dev.translations=3 pkg.readme=4
|
---|
122 |
|
---|
123 | # Examples archive
|
---|
124 |
|
---|
125 | pkg.examples.demos.PATH = $(WPI_ROOT)/pkg.examples.demos
|
---|
126 | pkg.examples.demos.SOURCES = \
|
---|
127 | $(wildcard $(QT_INSTALL)/demos/*/) \
|
---|
128 |
|
---|
129 | pkg.examples.demo-plugins.PATH = $(WPI_ROOT)/pkg.examples.demo-plugins
|
---|
130 | pkg.examples.demo-plugins.SOURCES = \
|
---|
131 | $(QT_INSTALL)/plugins/designer/arthurpl.dll->designer/
|
---|
132 |
|
---|
133 | pkg.examples.examples.PATH = $(WPI_ROOT)/pkg.examples.examples
|
---|
134 | pkg.examples.examples.SOURCES = \
|
---|
135 | $(wildcard $(QT_INSTALL)/examples/*/) \
|
---|
136 |
|
---|
137 | # @todo add examples.example-plugins
|
---|
138 | # @todo install qtdemo in bin/ when its' ready
|
---|
139 |
|
---|
140 | wpi.examples.PATH = $(OUT_ROOT)/qt-examples-$(QT_VER_FULL).wpi
|
---|
141 | wpi.examples.SCRIPT = $(WPI_ROOT)/examples.wis
|
---|
142 | wpi.examples.PACKAGES = pkg.examples.demos=1 pkg.examples.demo-plugins=2 \
|
---|
143 | pkg.examples.examples=3 \
|
---|
144 | pkg.readme=4
|
---|
145 |
|
---|
146 | # Summary
|
---|
147 |
|
---|
148 | WPIS = wpi.lib wpi.dev wpi.examples
|
---|
149 |
|
---|
150 | #-------------------------------------------------------------------------------
|
---|
151 | # Core functions
|
---|
152 | #-------------------------------------------------------------------------------
|
---|
153 |
|
---|
154 | _EMPTY_ :=
|
---|
155 |
|
---|
156 | _DIRS_ :=
|
---|
157 |
|
---|
158 | define EnsureDir
|
---|
159 | ifneq ($(1),./)
|
---|
160 | ifneq ($(1:%:/=:/),:/)
|
---|
161 | ifeq ($$(filter $(1),$$(_DIRS_)),)
|
---|
162 | _DIRS_ += $(1)
|
---|
163 | $$(eval $$(call EnsureDir,$(dir $(1:%/=%))))
|
---|
164 | $$(shell if not exist $(subst /,\,$(1:%/=%)) mkdir $(subst /,\,$(1:%/=%)) >nul 2>&1)
|
---|
165 | endif
|
---|
166 | endif
|
---|
167 | endif
|
---|
168 | endef
|
---|
169 |
|
---|
170 | # Generate rules to copy one file.
|
---|
171 | # @param $(1) Stem whose file is to copy.
|
---|
172 | # @param $(2) File name in format src[->tgt].
|
---|
173 | define GenFileCopyRule
|
---|
174 | 90 := $(subst ->, ,$(2))
|
---|
175 | 91 := $$(word 1,$$(90))
|
---|
176 | 92 := $$(word 2,$$(90))
|
---|
177 | ifeq ($$(91:%/=/),/)
|
---|
178 | 93 := 1
|
---|
179 | 91 := $$(91:%/=%)
|
---|
180 | else
|
---|
181 | 93 := 0
|
---|
182 | endif
|
---|
183 | ifeq ($$(92),)
|
---|
184 | 92 := $$(notdir $$(91))
|
---|
185 | else
|
---|
186 | ifeq ($$(92:%/=/),/)
|
---|
187 | 92 := $$(92)$$(notdir $$(91))
|
---|
188 | endif
|
---|
189 | endif
|
---|
190 | 92 := $($(1).PATH)/$$(92)
|
---|
191 | $(1).TARGETS += $$(92)
|
---|
192 | $$(eval $$(call EnsureDir,$$(dir $$(92))))
|
---|
193 | $$(92): $$(91)
|
---|
194 | ifeq ($$(93),1)
|
---|
195 | xcopy /s /e /o "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"\ $(_EMPTY_)
|
---|
196 | else
|
---|
197 | copy "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"
|
---|
198 | endif
|
---|
199 | endef
|
---|
200 |
|
---|
201 | _PACKAGES_ :=
|
---|
202 |
|
---|
203 | # Generate rules for one WPI package.
|
---|
204 | # @param $(1) Package stem.
|
---|
205 | define GenPkgRule
|
---|
206 | ifeq ($$(filter $(1),$$(_PACKAGES_)),)
|
---|
207 | _PACKAGES_ += $(1)
|
---|
208 | $$(foreach file,$$($(1).SOURCES),$$(eval $$(call GenFileCopyRule,$(1),$$(file))))
|
---|
209 | $(1): $$($(1).TARGETS)
|
---|
210 | endif
|
---|
211 | endef
|
---|
212 |
|
---|
213 | define GenWpiRuleHelper
|
---|
214 | 90 := $(subst =, ,$(2))
|
---|
215 | 91 := $$(word 1,$$(90))
|
---|
216 | 92 := $$(word 2,$$(90))
|
---|
217 | $(1)._PACKAGES_CMD += $$(92) -c$$($$(91).PATH) -r *
|
---|
218 | $(1).PACKAGES += $$(91)
|
---|
219 | endef
|
---|
220 |
|
---|
221 | # Generate rules for one WPI archive.
|
---|
222 | # @param $(1) WPI stem.
|
---|
223 | define GenWpiRule
|
---|
224 | $(eval $(1)._PACKAGES := $($(1).PACKAGES))
|
---|
225 | $(eval $(1)._PACKAGES_CMD :=)
|
---|
226 | $(eval $(1).PACKAGES :=)
|
---|
227 | $(foreach pkg,$($(1)._PACKAGES),$(eval $(call GenWpiRuleHelper,$(1),$(pkg))))
|
---|
228 | $(1): $($(1).PACKAGES) $($(1).SCRIPT)
|
---|
229 | -del $(subst /,\,$($(1).PATH))
|
---|
230 | $(WIC) $($(1).PATH) -a $($(1)._PACKAGES_CMD) -s $($(1).SCRIPT)
|
---|
231 | $(foreach pkg,$($(1).PACKAGES),$(eval $(pkg).TARGETS :=))
|
---|
232 | $(foreach pkg,$($(1).PACKAGES),$(eval $(call GenPkgRule,$(pkg))))
|
---|
233 | endef
|
---|
234 |
|
---|
235 | #-------------------------------------------------------------------------------
|
---|
236 | # Core function invocations
|
---|
237 | #-------------------------------------------------------------------------------
|
---|
238 |
|
---|
239 | .PHONY: $(WPIS) $(foreach wpi,$(WPIS),$($(wpi).PACKAGES))
|
---|
240 |
|
---|
241 | $(foreach wpi,$(WPIS),$(eval $(call GenWpiRule,$(wpi))))
|
---|
242 |
|
---|