diff --git a/releasenotes.md b/releasenotes.md
index 36405d6f2..0afefc650 100644
--- a/releasenotes.md
+++ b/releasenotes.md
@@ -18,6 +18,7 @@
- Add printf format to `$assert` and `$error` #2183.
- Make accepting arguments for `main` a bit more liberal, accepting `main(int argc, ZString* argv)`
- Make `$echo` and `@sprintf` correctly stringify compile time initializers and slices.
+- Add `--sources` build option to add additional files to compile. #2097
### Fixes
- `-2147483648`, MIN literals work correctly.
diff --git a/src/build/build_internal.h b/src/build/build_internal.h
index e17cf3261..55f9fdab8 100644
--- a/src/build/build_internal.h
+++ b/src/build/build_internal.h
@@ -151,5 +151,10 @@ int get_valid_enum_from_string(const char *str, const char *target, const char *
void check_json_keys(const char *valid_keys[][2], size_t key_count, const char *deprecated_keys[], size_t deprecated_key_count, JSONObject *json, const char *target_name, const char *option);
long get_valid_integer(BuildParseContext context, JSONObject *table, const char *key, bool mandatory);
+INLINE void append_strings_to_strings(const char*** list_of_strings_ptr, const char **strings_to_append)
+{
+ FOREACH(const char *, string, strings_to_append) vec_add(*list_of_strings_ptr, string);
+}
+
#define APPEND_STRING_LIST(list__, string__) \
get_list_append_strings(context, json, list__, string__, string__ "-override")
diff --git a/src/build/build_options.c b/src/build/build_options.c
index 65c80fd37..bed916798 100644
--- a/src/build/build_options.c
+++ b/src/build/build_options.c
@@ -43,6 +43,7 @@ const char *arch_os_target[ARCH_OS_TARGET_LAST + 1];
#define EOUTPUT(string, ...) fprintf(stderr, string "\n", ##__VA_ARGS__) // NOLINT
#define PRINTF(string, ...) fprintf(stdout, string "\n", ##__VA_ARGS__) // NOLINT
#define FAIL_WITH_ERR(string, ...) do { fprintf(stderr, "Error: " string "\n\n", ##__VA_ARGS__); usage(false); exit_compiler(EXIT_FAILURE); } while (0) /* NOLINT */
+#define FAIL_WITH_ERR_LONG(string, ...) do { fprintf(stderr, "Error: " string "\n\n", ##__VA_ARGS__); usage(true); exit_compiler(EXIT_FAILURE); } while (0) /* NOLINT */
#define PROJECT_FAIL_WITH_ERR(string, ...) do { fprintf(stderr, "Error: " string "\n\n", ##__VA_ARGS__); project_usage(); exit_compiler(EXIT_FAILURE); } while (0) /* NOLINT */
static void usage(bool full)
@@ -96,6 +97,7 @@ static void usage(bool full)
print_opt("--run-dir
", "Set the directory from where to run the binary (only for run and compile-run).");
print_opt("--libdir ", "Add this directory to the c3l library search paths.");
print_opt("--lib ", "Add this c3l library to the compilation.");
+ print_opt("--sources [ ...]", "Add these additional sources to the compilation.");
if (full)
{
print_opt("--validation=