From 6c63b913179127e09ed7d9da8920493ccceec6ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 2 Mar 2009 12:14:54 +0200 Subject: Add make support for creating binary distributions Two new make targets, dist and dist-win, were added that allow one to create a binary distribution from the current build. The dist target creates a UNIX distribution while dist-win -- Windows. The simplified build systems for the runtime library and examples that were kept separately are now part of the project (the dist/ subdirectory). --- examples/cxx/hybrid/compositors/makefile | 27 +++++++++++++++++++-- examples/cxx/hybrid/filter/makefile | 32 +++++++++++++++++++++++-- examples/cxx/hybrid/hello/makefile | 29 ++++++++++++++++++++-- examples/cxx/hybrid/library/makefile | 28 ++++++++++++++++++++-- examples/cxx/hybrid/makefile | 41 ++++++++++++++++++++++++-------- examples/cxx/hybrid/minimal/makefile | 28 ++++++++++++++++++++-- examples/cxx/hybrid/multiroot/makefile | 30 +++++++++++++++++++++-- examples/cxx/hybrid/streaming/makefile | 32 +++++++++++++++++++++++-- examples/cxx/hybrid/wildcard/makefile | 34 ++++++++++++++++++++++++-- 9 files changed, 255 insertions(+), 26 deletions(-) (limited to 'examples/cxx/hybrid') diff --git a/examples/cxx/hybrid/compositors/makefile b/examples/cxx/hybrid/compositors/makefile index e436db2..f1694ab 100644 --- a/examples/cxx/hybrid/compositors/makefile +++ b/examples/cxx/hybrid/compositors/makefile @@ -14,8 +14,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -38,6 +40,26 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/compositors.xsd,$(dist_prefix)/$(path)/compositors.xsd) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -66,6 +88,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/filter/makefile b/examples/cxx/hybrid/filter/makefile index 92adbb1..543d175 100644 --- a/examples/cxx/hybrid/filter/makefile +++ b/examples/cxx/hybrid/filter/makefile @@ -21,8 +21,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -53,6 +55,31 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/people-custom-pimpl.hxx,$(dist_prefix)/$(path)/people-custom-pimpl.hxx) + $(call install-data,$(src_base)/people-custom-pimpl.cxx,$(dist_prefix)/$(path)/people-custom-pimpl.cxx) + $(call install-data,$(src_base)/people-custom-simpl.hxx,$(dist_prefix)/$(path)/people-custom-simpl.hxx) + $(call install-data,$(src_base)/people-custom-simpl.cxx,$(dist_prefix)/$(path)/people-custom-simpl.cxx) + $(call install-data,$(src_base)/people.xsd,$(dist_prefix)/$(path)/people.xsd) + $(call install-data,$(src_base)/people.xml,$(dist_prefix)/$(path)/people.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -81,6 +108,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/hello/makefile b/examples/cxx/hybrid/hello/makefile index 28db77c..c48ef90 100644 --- a/examples/cxx/hybrid/hello/makefile +++ b/examples/cxx/hybrid/hello/makefile @@ -19,8 +19,11 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean + # Build. # @@ -45,6 +48,27 @@ $(call include-dep,$(dep)) .PHONY: $(out_base)/ $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/hello.xsd,$(dist_prefix)/$(path)/hello.xsd) + $(call install-data,$(src_base)/hello.xml,$(dist_prefix)/$(path)/hello.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -73,6 +97,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/library/makefile b/examples/cxx/hybrid/library/makefile index 24f8bf1..f0dbae1 100644 --- a/examples/cxx/hybrid/library/makefile +++ b/examples/cxx/hybrid/library/makefile @@ -21,8 +21,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -51,6 +53,27 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd) + $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -79,6 +102,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/makefile b/examples/cxx/hybrid/makefile index d3f0729..765c196 100644 --- a/examples/cxx/hybrid/makefile +++ b/examples/cxx/hybrid/makefile @@ -5,15 +5,18 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make -examples := compositors +all_examples := compositors hello multiroot streaming library wildcard \ +filter minimal + +build_examples := compositors ifeq ($(xsde_iostream),y) ifeq ($(xsde_exceptions),y) -examples += hello multiroot streaming +build_examples += hello multiroot streaming ifeq ($(xsde_stl),y) -examples += library wildcard filter +build_examples += library wildcard filter endif endif @@ -21,16 +24,34 @@ endif ifeq ($(xsde_stl),n) ifeq ($(xsde_exceptions),n) -examples += minimal +build_examples += minimal endif endif -default := $(out_base)/ -clean := $(out_base)/.clean +default := $(out_base)/ +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean + +.PHONY: $(default) $(dist) $(dist-win) $(clean) + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(build_examples))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(build_examples))) -.PHONY: $(default) $(clean) +# Dist. +# +$(dist) $(dist-win): path := $(subst $(src_root)/,,$(src_base)) -$(default): $(addprefix $(out_base)/,$(addsuffix /,$(examples))) -$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(examples))) +$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(all_examples))) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) -$(foreach e,$(examples),$(call import,$(src_base)/$e/makefile)) +$(dist-win): $(addprefix $(out_base)/,$(addsuffix /.dist-win,$(all_examples))) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + +ifneq ($(filter $(MAKECMDGOALS),dist dist-win),) +$(foreach e,$(all_examples),$(call import,$(src_base)/$e/makefile)) +else +$(foreach e,$(build_examples),$(call import,$(src_base)/$e/makefile)) +endif diff --git a/examples/cxx/hybrid/minimal/makefile b/examples/cxx/hybrid/minimal/makefile index e61b29a..967ab6c 100644 --- a/examples/cxx/hybrid/minimal/makefile +++ b/examples/cxx/hybrid/minimal/makefile @@ -21,8 +21,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -51,6 +53,27 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/people.xsd,$(dist_prefix)/$(path)/people.xsd) + $(call install-data,$(src_base)/people.xml,$(dist_prefix)/$(path)/people.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -79,6 +102,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/multiroot/makefile b/examples/cxx/hybrid/multiroot/makefile index d4b8cac..e3e24c6 100644 --- a/examples/cxx/hybrid/multiroot/makefile +++ b/examples/cxx/hybrid/multiroot/makefile @@ -19,8 +19,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -47,6 +49,29 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/protocol.xsd,$(dist_prefix)/$(path)/protocol.xsd) + $(call install-data,$(src_base)/balance.xml,$(dist_prefix)/$(path)/balance.xml) + $(call install-data,$(src_base)/deposit.xml,$(dist_prefix)/$(path)/deposit.xml) + $(call install-data,$(src_base)/withdraw.xml,$(dist_prefix)/$(path)/withdraw.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -75,6 +100,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/streaming/makefile b/examples/cxx/hybrid/streaming/makefile index 86818b9..05d5510 100644 --- a/examples/cxx/hybrid/streaming/makefile +++ b/examples/cxx/hybrid/streaming/makefile @@ -21,8 +21,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -52,6 +54,31 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/object-pimpl.hxx,$(dist_prefix)/$(path)/object-pimpl.hxx) + $(call install-data,$(src_base)/object-pimpl.cxx,$(dist_prefix)/$(path)/object-pimpl.cxx) + $(call install-data,$(src_base)/object-simpl.hxx,$(dist_prefix)/$(path)/object-simpl.hxx) + $(call install-data,$(src_base)/object-simpl.cxx,$(dist_prefix)/$(path)/object-simpl.cxx) + $(call install-data,$(src_base)/position.xsd,$(dist_prefix)/$(path)/position.xsd) + $(call install-data,$(src_base)/position.xml,$(dist_prefix)/$(path)/position.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -80,6 +107,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) diff --git a/examples/cxx/hybrid/wildcard/makefile b/examples/cxx/hybrid/wildcard/makefile index 5628406..4268dbf 100644 --- a/examples/cxx/hybrid/wildcard/makefile +++ b/examples/cxx/hybrid/wildcard/makefile @@ -21,8 +21,10 @@ dep := $(obj:.o=.o.d) xsde.l := $(out_root)/libxsde/xsde/xsde.l xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options -driver := $(out_base)/driver -clean := $(out_base)/.clean +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean # Build. # @@ -53,6 +55,33 @@ $(call include-dep,$(dep)) $(out_base)/: $(driver) +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/body.hxx,$(dist_prefix)/$(path)/body.hxx) + $(call install-data,$(src_base)/body.cxx,$(dist_prefix)/$(path)/body.cxx) + $(call install-data,$(src_base)/envelope-pimpl.hxx,$(dist_prefix)/$(path)/envelope-pimpl.hxx) + $(call install-data,$(src_base)/envelope-pimpl.cxx,$(dist_prefix)/$(path)/envelope-pimpl.cxx) + $(call install-data,$(src_base)/envelope-simpl.hxx,$(dist_prefix)/$(path)/envelope-simpl.hxx) + $(call install-data,$(src_base)/envelope-simpl.cxx,$(dist_prefix)/$(path)/envelope-simpl.cxx) + $(call install-data,$(src_base)/email.xsd,$(dist_prefix)/$(path)/email.xsd) + $(call install-data,$(src_base)/email.xml,$(dist_prefix)/$(path)/email.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + # Clean. # .PHONY: $(clean) @@ -81,6 +110,7 @@ endif $(call include,$(bld_root)/cxx/o-e.make) $(call include,$(bld_root)/cxx/cxx-o.make) $(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) $(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) -- cgit v1.1