aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/parser/makefile
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-03-02 12:14:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-03-02 12:14:54 +0200
commit6c63b913179127e09ed7d9da8920493ccceec6ce (patch)
tree95684b51b4ab60e6468a592a53e33c2cf00027ab /examples/cxx/parser/makefile
parent3fd3cfc36784be43f545f2f0973e3dc58f475996 (diff)
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).
Diffstat (limited to 'examples/cxx/parser/makefile')
-rw-r--r--examples/cxx/parser/makefile46
1 files changed, 33 insertions, 13 deletions
diff --git a/examples/cxx/parser/makefile b/examples/cxx/parser/makefile
index 5a81a72..92e00ce 100644
--- a/examples/cxx/parser/makefile
+++ b/examples/cxx/parser/makefile
@@ -5,29 +5,32 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
-examples :=
+all_examples := generated hello library multiroot polymorphism polyroot \
+mixed wildcard minimal
+
+build_examples :=
ifneq ($(xsde_reuse_style),none)
-examples += generated
+build_examples += generated
endif
ifeq ($(xsde_stl),y)
ifeq ($(xsde_iostream),y)
ifeq ($(xsde_exceptions),y)
-examples += hello
+build_examples += hello
ifneq ($(xsde_reuse_style),none)
-examples += library multiroot
+build_examples += library multiroot
ifeq ($(xsde_polymorphic),y)
-examples += polymorphism polyroot
+build_examples += polymorphism polyroot
endif
endif
ifeq ($(xsde_reuse_style),tiein)
-examples += mixed wildcard
+build_examples += mixed wildcard
endif
endif
@@ -37,17 +40,34 @@ endif
ifeq ($(xsde_stl),n)
ifeq ($(xsde_exceptions),n)
ifneq ($(xsde_reuse_style),none)
-examples += minimal
+build_examples += minimal
endif
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