aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/frame/makefile41
-rw-r--r--tests/frame/save-restore.make49
-rw-r--r--tests/import/makefile43
-rw-r--r--tests/include/included6
-rw-r--r--tests/include/makefile25
5 files changed, 164 insertions, 0 deletions
diff --git a/tests/frame/makefile b/tests/frame/makefile
new file mode 100644
index 0000000..a36321f
--- /dev/null
+++ b/tests/frame/makefile
@@ -0,0 +1,41 @@
+# file : build/frame/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
+
+out_dir := foo
+
+%foo% := baz
+
+$(warning $(out_dir))
+
+# $(warning $(call frame-vars))
+
+$(call frame-enter)
+
+out_dir := foz
+src_dir := baz
+
+new := new var
+
+$(call frame-enter)
+
+out_dir := faz
+
+$(warning $(out_dir))
+$(warning $(new))
+
+$(call frame-leave)
+
+$(warning $(out_dir))
+$(warning $(new))
+
+$(call frame-leave)
+
+$(warning $(out_dir))
+$(warning $(new))
+
+.PHONY: all
+all:;@:
diff --git a/tests/frame/save-restore.make b/tests/frame/save-restore.make
new file mode 100644
index 0000000..b81a087
--- /dev/null
+++ b/tests/frame/save-restore.make
@@ -0,0 +1,49 @@
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../build/frame.make
+
+define set-recursive
+$1 = $2
+endef
+
+define set-simple
+$1 := $2
+endef
+
+define save
+$(eval $(if $(filter simple,$(flavor $1))\
+,$(call set-simple,_$1,$(value $1))\
+,$(call set-recursive,_$1,$(value $1))))
+endef
+
+define restore
+$(eval $(if $(filter simple,$(flavor _$1))\
+,$(call set-simple,$1,$(value _$1))\
+,$(call set-recursive,$1,$(value _$1))))
+endef
+
+save = $(call frame-save,$1)
+restore = $(call frame-restore,$1)
+
+r = $(r2)
+
+s := simple
+
+$(call save,r)
+$(call save,s)
+
+#$(warning _r: $(value _r))
+#$(warning _s: $(value _s))
+
+r := foo
+s = bar
+
+$(call restore,r)
+$(call restore,s)
+
+r2 := recursive
+
+$(warning r: $r)
+$(warning s: $s)
+
+.PHONY: all
+all:;@:
diff --git a/tests/import/makefile b/tests/import/makefile
new file mode 100644
index 0000000..4a9a8f5
--- /dev/null
+++ b/tests/import/makefile
@@ -0,0 +1,43 @@
+# file : build/import/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
+
+foo := foz
+
+$(call frame-push,foo bar)
+
+bar := bar
+
+foo := foo
+
+$(call frame-pop)
+
+# a := $(call frame-vars)
+
+#$(warning $(filter-out $b,$a))
+
+$(warning foo = $(foo))
+$(warning bar = $(bar))
+
+exclude := $(call exported-names,default: libhello,clean: libhello_clean)
+
+$(call import-names,default: libhello,clean: libhello_clean)
+
+$(warning $(default:))
+$(warning $(clean:))
+$(warning $(exclude))
+
+$(call frame-push)
+
+$(default:) := fofofof
+
+$(warning $(libhello))
+
+$(call frame-pop)
+
+
+.PHONY: h
+h:;@:
diff --git a/tests/include/included b/tests/include/included
new file mode 100644
index 0000000..8bca82f
--- /dev/null
+++ b/tests/include/included
@@ -0,0 +1,6 @@
+# file : build/include/included
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(warning included for $(foo))
diff --git a/tests/include/makefile b/tests/include/makefile
new file mode 100644
index 0000000..0250228
--- /dev/null
+++ b/tests/include/makefile
@@ -0,0 +1,25 @@
+# file : build/include/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
+
+foo := one
+
+$(call include-once,included,$(foo))
+$(call include-once,included,$(foo))
+
+foo := two
+
+$(call include-once,included,$(foo))
+$(call include-once,included,$(foo))
+
+foo := one
+
+$(call include-once,included,$(foo))
+
+$(warning $(value %include_once_$(realpath included)%))
+
+.PHONY: h
+h:;@: