# # Helper makefile for make_packages.cmd # all: @echo This Makefile is not intended to be used directly. @echo Use make_packages.cmd instead. #------------------------------------------------------------------------------- # Environment checks #------------------------------------------------------------------------------- ifeq ($(WIC),) $(error WIC unset!) endif ifeq ($(OUT_ROOT),) $(error OUT_ROOT unset!) endif ifeq ($(WPI_ROOT),) $(error WPI_ROOT unset!) endif ifeq ($(QT_BUILD),) $(error QT_BUILD unset!) endif ifeq ($(QT_INSTALL),) $(error QT_INSTALL unset!) endif ifeq ($(QT_VER_FULL),) $(error QT_VER_FULL unset!) endif $(foreach var,WPI_ROOT QT_BUILD QT_INSTALL,\ $(eval $(var) := $(subst \,/,$($(var))))) #------------------------------------------------------------------------------- # Definitions #------------------------------------------------------------------------------- pkg.readme.PATH = $(WPI_ROOT)/pkg.readme pkg.readme.SOURCES = \ $(QT_BUILD)/LGPL_EXCEPTION.txt \ $(QT_BUILD)/LICENSE.GPL3 \ $(QT_BUILD)/LICENSE.LGPL \ $(wildcard $(QT_BUILD)/changes-*) \ $(QT_BUILD)/README \ $(QT_BUILD)/README.OS2 \ $(QT_BUILD)/CHANGES.OS2 # # Runtime archive # pkg.lib.instutils.PATH = $(WPI_ROOT)/pkg.lib.instutils pkg.lib.instutils.SOURCES = \ UpdateQtSysConf.cmd->util/ pkg.lib.runtime.PATH = $(WPI_ROOT)/pkg.lib.runtime pkg.lib.runtime.SOURCES = \ $(QT_INSTALL)/bin/QtCLuc4.dll \ $(QT_INSTALL)/bin/QtCore4.dll \ $(QT_INSTALL)/bin/QtGui4.dll \ $(QT_INSTALL)/bin/QtHelp4.dll \ $(QT_INSTALL)/bin/QtNet4.dll \ $(QT_INSTALL)/bin/QtScri4.dll \ $(QT_INSTALL)/bin/QtScTl4.dll \ $(QT_INSTALL)/bin/QtSql4.dll \ $(QT_INSTALL)/bin/QtSvg4.dll \ $(QT_INSTALL)/bin/QtTest4.dll \ $(QT_INSTALL)/bin/QtWebK4.dll \ $(QT_INSTALL)/bin/QtXml4.dll \ $(QT_INSTALL)/bin/QtXmlP4.dll pkg.lib.plugins.PATH = $(WPI_ROOT)/pkg.lib.plugins pkg.lib.plugins.SOURCES = \ $(addsuffix ->accessible/, $(wildcard $(QT_INSTALL)/plugins/accessible/*.dll)) \ $(addsuffix ->codecs/, $(wildcard $(QT_INSTALL)/plugins/codecs/*.dll)) \ $(addsuffix ->graphicssystems/, $(wildcard $(QT_INSTALL)/plugins/graphicssystems/*.dll)) \ $(addsuffix ->iconengines/, $(wildcard $(QT_INSTALL)/plugins/iconengines/*.dll)) \ $(addsuffix ->imageformats/, $(wildcard $(QT_INSTALL)/plugins/imageformats/*.dll)) \ $(addsuffix ->sqldrivers/, $(wildcard $(QT_INSTALL)/plugins/sqldrivers/*.dll)) pkg.lib.translations.PATH = $(WPI_ROOT)/pkg.lib.translations pkg.lib.translations.SOURCES = \ $(wildcard $(QT_INSTALL)/translations/qt_*.qm) \ $(wildcard $(QT_INSTALL)/translations/qt_help_*.qm) pkg.lib.systray.PATH = $(WPI_ROOT)/pkg.lib.systray pkg.lib.systray.SOURCES = \ $(QT_BUILD)/plugins/xcenter/xsystray.dll->plugins/xcenter/ wpi.lib.PATH = $(OUT_ROOT)/qt-lib-$(QT_VER_FULL).wpi wpi.lib.SCRIPT = $(WPI_ROOT)/lib.wis wpi.lib.PACKAGES = \ pkg.lib.instutils=1 \ pkg.lib.runtime=2 \ pkg.lib.plugins=3 \ pkg.lib.translations=4 \ pkg.lib.systray=5 \ pkg.readme=6 # create another WPI with no XWorkplace dependency, see #146 wpi.lib_noxwpdep.PATH = $(OUT_ROOT)/qt-lib-$(QT_VER_FULL)-noxwpdep.wpi wpi.lib_noxwpdep.SCRIPT = $(WPI_ROOT)/lib_noxwpdep.wis wpi.lib_noxwpdep.PACKAGES = \ pkg.lib.instutils=1 \ pkg.lib.runtime=2 \ pkg.lib.plugins=3 \ pkg.lib.translations=4 \ pkg.readme=6 # # Development archive # pkg.dev.runtime.PATH = $(WPI_ROOT)/pkg.dev.runtime pkg.dev.runtime.SOURCES = \ $(QT_INSTALL)/bin/QtAsCl4.dll \ $(QT_INSTALL)/bin/QtDsgn4.dll \ $(QT_INSTALL)/bin/QtDsgC4.dll pkg.dev.libraries.PATH = $(WPI_ROOT)/pkg.dev.libraries pkg.dev.libraries.SOURCES = \ $(addsuffix ->bin/, $(filter-out \ %/qtdemo.exe, \ $(wildcard $(QT_INSTALL)/bin/*.exe))) \ $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.lib)) \ $(addsuffix ->lib/, $(wildcard $(QT_INSTALL)/lib/*.prl)) \ $(QT_INSTALL)/mkspecs/default/->mkspecs/ \ $(QT_INSTALL)/mkspecs/features/->mkspecs/ \ $(QT_INSTALL)/mkspecs/os2-g++/->mkspecs/ \ $(QT_INSTALL)/mkspecs/qconfig.pri->mkspecs/ \ $(QT_INSTALL)/include/ \ $(QT_INSTALL)/phrasebooks/ \ QtEnv.cmd->util/ pkg.dev.plugins.PATH = $(WPI_ROOT)/pkg.dev.plugins pkg.dev.plugins.SOURCES = \ $(QT_INSTALL)/plugins/designer/qwebview.dll->designer/ pkg.dev.translations.PATH = $(WPI_ROOT)/pkg.dev.translations pkg.dev.translations.SOURCES = \ $(wildcard $(QT_INSTALL)/translations/designer_*.qm) \ $(wildcard $(QT_INSTALL)/translations/linguist_*.qm) \ $(wildcard $(QT_INSTALL)/translations/assistant_*.qm) wpi.dev.PATH = $(OUT_ROOT)/qt-dev-$(QT_VER_FULL).wpi wpi.dev.SCRIPT = $(WPI_ROOT)/dev.wis wpi.dev.PACKAGES = \ pkg.dev.runtime=1 \ pkg.dev.libraries=2 \ pkg.dev.plugins=3 \ pkg.dev.translations=4 \ pkg.readme=5 # # Examples archive # pkg.examples.demos.PATH = $(WPI_ROOT)/pkg.examples.demos pkg.examples.demos.SOURCES = \ $(wildcard $(QT_INSTALL)/demos/*/) pkg.examples.demo-plugins.PATH = $(WPI_ROOT)/pkg.examples.demo-plugins pkg.examples.demo-plugins.SOURCES = \ $(QT_INSTALL)/plugins/designer/arthurpl.dll->designer/ pkg.examples.examples.PATH = $(WPI_ROOT)/pkg.examples.examples pkg.examples.examples.SOURCES = \ $(wildcard $(QT_INSTALL)/examples/*/) \ pkg.examples.example-plugins.PATH = $(WPI_ROOT)/pkg.examples.example-plugins pkg.examples.example-plugins.SOURCES = \ $(QT_INSTALL)/plugins/designer/cntrext.dll->designer/ \ $(QT_INSTALL)/plugins/designer/cstmwgt.dll->designer/ \ $(QT_INSTALL)/plugins/designer/tskmext.dll->designer/ \ $(QT_INSTALL)/plugins/designer/wrldclk.dll->designer/ pkg.examples.qtdemo.PATH = $(WPI_ROOT)/pkg.examples.qtdemo pkg.examples.qtdemo.SOURCES = \ $(QT_INSTALL)/bin/qtdemo.exe wpi.examples.PATH = $(OUT_ROOT)/qt-examples-$(QT_VER_FULL).wpi wpi.examples.SCRIPT = $(WPI_ROOT)/examples.wis wpi.examples.PACKAGES = \ pkg.examples.demos=1 \ pkg.examples.demo-plugins=2 \ pkg.examples.examples=3 \ pkg.examples.example-plugins=4 \ pkg.examples.qtdemo=5 \ pkg.readme=6 # # Documentation archive # pkg.doc.qch.PATH = $(WPI_ROOT)/pkg.doc.qch pkg.doc.qch.SOURCES = \ $(wildcard $(QT_INSTALL)/doc/qch/) wpi.doc.PATH = $(OUT_ROOT)/qt-doc-$(QT_VER_FULL).wpi wpi.doc.SCRIPT = $(WPI_ROOT)/doc.wis wpi.doc.PACKAGES = \ pkg.doc.qch=1 \ pkg.readme=2 # # Summary # WPIS = wpi.lib wpi.lib_noxwpdep wpi.dev wpi.examples wpi.doc #------------------------------------------------------------------------------- # Core functions #------------------------------------------------------------------------------- _EMPTY_ := _DIRS_ := define DirRule ifeq ($(filter $(1),$(_DIRS_)),) _DIRS_ += $(1) $(1): mkdir-p.cmd $$@ endif endef define EnsureDir $(eval $(call DirRule,$(1)))$(1) endef # Generate rules to copy one file. # @param $(1) Stem which file is to copy. # @param $(2) File name in format src[->tgt]. define GenFileCopyRule 90 := $(subst ->, ,$(2)) 91 := $$(word 1,$$(90)) 92 := $$(word 2,$$(90)) ifeq ($$(91:%/=/),/) 93 := 1 91 := $$(91:%/=%) else 93 := 0 endif ifeq ($$(92),) 92 := $$(notdir $$(91)) else ifeq ($$(92:%/=/),/) 92 := $$(92)$$(notdir $$(91)) endif endif 92 := $($(1).PATH)/$$(92) $(1).TARGETS += $$(92) $$(92): $$(91) | $$(call EnsureDir,$$(dir $$(92))) ifeq ($$(93),1) xcopy /s /e /o "$$(subst /,\,$$<)" "$$(subst /,\,$$@)"\ $(_EMPTY_) else copy "$$(subst /,\,$$<)" "$$(subst /,\,$$@)" endif endef _PACKAGES_ := # Generate rules for one WPI package. # @param $(1) Package stem. define GenPkgRule ifeq ($$(filter $(1),$$(_PACKAGES_)),) _PACKAGES_ += $(1) $$(foreach file,$$($(1).SOURCES),$$(eval $$(call GenFileCopyRule,$(1),$$(file)))) $(1): $$($(1).TARGETS) clean-$(1): if exist "$($(1).PATH)" deltree.cmd "$(subst /,\,$($(1).PATH))" /Y /S endif endef define GenWpiRuleHelper 90 := $(subst =, ,$(2)) 91 := $$(word 1,$$(90)) 92 := $$(word 2,$$(90)) $(1)._PACKAGES_CMD += $$(92) -c$$($$(91).PATH) -r * $(1).PACKAGES += $$(91) endef # Generate rules for one WPI archive. # @param $(1) WPI stem. define GenWpiRule $(eval $(1)._PACKAGES := $($(1).PACKAGES)) $(eval $(1)._PACKAGES_CMD :=) $(eval $(1).PACKAGES :=) $(foreach pkg,$($(1)._PACKAGES),$(eval $(call GenWpiRuleHelper,$(1),$(pkg)))) # generate WPI target (depends on clean to make sure the removed files are not packed) $(1): clean-$(1) $($(1).PACKAGES) $($(1).SCRIPT) -del $(subst /,\,$($(1).PATH)) $(WIC) $($(1).PATH) -a $($(1)._PACKAGES_CMD) -s $($(1).SCRIPT) # clean WPI target clean-$(1): $(foreach pkg,$($(1).PACKAGES),clean-$(pkg)) # helpers $(foreach pkg,$($(1).PACKAGES),$(eval $(pkg).TARGETS :=)) $(foreach pkg,$($(1).PACKAGES),$(eval $(call GenPkgRule,$(pkg)))) endef #------------------------------------------------------------------------------- # Core function invocations #------------------------------------------------------------------------------- .PHONY: $(WPIS) $(foreach wpi,$(WPIS),$($(wpi).PACKAGES)) $(foreach wpi,$(WPIS),$(eval $(call GenWpiRule,$(wpi))))