Skip to content

Commit

Permalink
Add COBC_BUILD_INPLACE env var to build the C file in the local direc…
Browse files Browse the repository at this point in the history
…tory
  • Loading branch information
lefessan committed Oct 28, 2023
1 parent cff04ce commit 993e3a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ static char *cobc_include; /* -I... */
static char *cobc_ldflags; /* -Q / COB_LDFLAGS */
static char *cb_depend_target; /* -MT <target>... */

static int cb_build_inplace = 0;

static size_t cobc_cflags_size;
static size_t cobc_libs_size;
static size_t cobc_lib_paths_size;
Expand Down Expand Up @@ -4459,6 +4461,7 @@ process_filename (const char *filename)
fn->translate = cobc_main_strdup (output_name);
} else
if (save_all_src || save_temps || save_c_src
|| cb_build_inplace
|| cb_compile_level == CB_LEVEL_TRANSLATE) {
fn->translate = cobc_main_stradd_dup (fbasename, ".c");
} else {
Expand Down Expand Up @@ -8963,6 +8966,9 @@ finish_setup_compiler_env (void)
if (getenv ("COBC_GEN_DUMP_COMMENTS")) {
cb_wants_dump_comments = 1;
}
if (getenv("COBC_BUILD_INPLACE")){
cb_build_inplace = 1;
}
}


Expand Down
2 changes: 2 additions & 0 deletions tests/testsuite.src/used_binaries.at
Original file line number Diff line number Diff line change
Expand Up @@ -1035,4 +1035,6 @@ AT_DATA([prog2.cob], [

AT_CHECK([$COBC -m --include "$PWD/file.h" -fstatic-call prog2.cob], [0], [], [])

AT_CHECK([COBC_BUILD_INPLACE=1 $COBC -m --include "file.h" -fstatic-call prog2.cob], [0], [], [])

AT_CLEANUP

0 comments on commit 993e3a4

Please sign in to comment.