aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/common.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-04-18 09:23:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-04-18 09:23:24 +0200
commit8aeae026d112ff9811a424e31621c05682f4a72e (patch)
tree9dc5c736fb07fb6cafe3a08a7e999b9c084edc18 /libbuild2/cc/common.hxx
parenta1a01cbce316c5da7aa94e6b6a71eae98bffed1c (diff)
Add support for Assembler with C Preprocessor (.S) compilation
Specifically, the c module now provides the c.as-cpp submodules which can be loaded in order to register the S{} target type and enable Assembler with C Preprocessor compilation in the c compile rule. For details, refer to "Assembler with C Preprocessor Compilation" in the manual.
Diffstat (limited to 'libbuild2/cc/common.hxx')
-rw-r--r--libbuild2/cc/common.hxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/libbuild2/cc/common.hxx b/libbuild2/cc/common.hxx
index 9090c9c..eefcc0d 100644
--- a/libbuild2/cc/common.hxx
+++ b/libbuild2/cc/common.hxx
@@ -217,11 +217,14 @@ namespace build2
size_t sys_hdr_dirs_extra;
// Note that x_obj is patched in by the x.objx module. So it stays NULL
- // if Objective-X compilation is not enabled.
+ // if Objective-X compilation is not enabled. Similarly for x_asp except
+ // here we don't have duality and it's purely to signal (by the c.as-cpp
+ // module) that it's enabled.
//
const target_type& x_src; // Source target type (c{}, cxx{}).
const target_type* x_mod; // Module target type (mxx{}), if any.
const target_type* x_obj; // Objective-X target type (m{}, mm{}).
+ const target_type* x_asp; // Assembler with CPP target type (S{}).
// Check if an object (target, prerequisite, etc) is an Objective-X
// source.
@@ -233,6 +236,16 @@ namespace build2
return x_obj != nullptr && t.is_a (*x_obj);
}
+ // Check if an object (target, prerequisite, etc) is an Assembler with
+ // C preprocessor source.
+ //
+ template <typename T>
+ bool
+ x_assembler_cpp (const T& t) const
+ {
+ return x_asp != nullptr && t.is_a (*x_asp);
+ }
+
// Array of target types that are considered the X-language headers
// (excluding h{} except for C). Keep them in the most likely to appear
// order with the "real header" first and terminated with NULL.
@@ -305,7 +318,7 @@ namespace build2
sys_lib_dirs_mode (slm), sys_hdr_dirs_mode (shm),
sys_mod_dirs_mode (smm),
sys_lib_dirs_extra (sle), sys_hdr_dirs_extra (she),
- x_src (src), x_mod (mod), x_obj (nullptr),
+ x_src (src), x_mod (mod), x_obj (nullptr), x_asp (nullptr),
x_hdr (hdr), x_inc (inc) {}
};