aboutsummaryrefslogtreecommitdiff
path: root/build/c/cpp-options.make
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-02-05 18:01:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-02-05 18:01:45 +0200
commitd7b7e218bfe92516f525568a6c1c9e1a9eb241fe (patch)
tree6cbc3155d7188f65e4b806c6edeecdd53393da69 /build/c/cpp-options.make
Start tracking build with git
Diffstat (limited to 'build/c/cpp-options.make')
-rw-r--r--build/c/cpp-options.make36
1 files changed, 36 insertions, 0 deletions
diff --git a/build/c/cpp-options.make b/build/c/cpp-options.make
new file mode 100644
index 0000000..8956d41
--- /dev/null
+++ b/build/c/cpp-options.make
@@ -0,0 +1,36 @@
+# file : build/c/cpp-options.make
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+$(out_base)/%.cpp-options: c-cpp-options-expand-impl = $(if $1,cat $1 >>$2)
+$(out_base)/%.cpp-options: c-cpp-options-expand = \
+$(call c-cpp-options-expand-impl,$(filter %.cpp-options,$1),$2)
+
+
+#@@ Asymmetry: I hide creation commands but show removals.
+#
+$(out_base)/%.cpp-options: c-cpp-options-force-impl = \
+$(if $(subst $1,,$2)$(subst $2,,$1),FORCE)
+
+$(out_base)/%.cpp-options: c-cpp-options-force = \
+$(call c-cpp-options-force-impl,$(shell if test -f $1; then exec head -n 1 $1; fi),include: $2)
+
+
+# @@ Need to incroporate prefix: into force-check. Then it will probably
+# have to be non-optional.
+#
+
+ifeq ($(src_base),$(out_base))
+$(out_base)/%.cpp-options: $$(call c-cpp-options-force,$$@,$$(value))
+else
+$(out_base)/%.cpp-options: $$(call c-cpp-options-force,$$@,$$(value)) | $$(dir $$@).
+endif
+ @echo "include: $(value)" >$@
+ $(if $(strip $(prefix)),@echo "prefix: $(prefix)" >>$@)
+ @$(call c-cpp-options-expand,$^,$@)
+
+# Clean.
+#
+$(out_base)/%.cpp-options.clean:
+ $(call message,rm $(basename $@),rm -f $(basename $@))