diff --git a/jam/jam.c b/jam/jam.c index 8958c2bbe8..6edf54609a 100644 --- a/jam/jam.c +++ b/jam/jam.c @@ -455,7 +455,7 @@ int main( int argc, char **argv, char **arg_environ ) /* close compilation database output file */ if ( globs.comp_db ) { - fprintf(globs.comp_db, "]\n"); + fprintf(globs.comp_db, "\n]\n"); fclose( globs.comp_db ); } diff --git a/jam/make1.c b/jam/make1.c index 906b41a393..7b8ed24fe1 100644 --- a/jam/make1.c +++ b/jam/make1.c @@ -735,6 +735,9 @@ static void out_json(char const* str, FILE* f) } +static int written_compile_database_objects = 0; + + void out_compile_database ( char const * const action, @@ -750,13 +753,17 @@ void out_compile_database && (strstr(action, "Cc") != NULL || strstr(action, "C++") != NULL)) { char buffer[PATH_MAX]; + if( written_compile_database_objects++ > 0 ) + { + fputs(",\n", globs.comp_db); + } fputs("{ \"directory\": \"", globs.comp_db); out_json(getcwd(buffer, sizeof(buffer)), globs.comp_db); fputs("\", \"command\": \"", globs.comp_db); out_json(command, globs.comp_db); fputs("\", \"file\": \"", globs.comp_db); out_json(source, globs.comp_db); - fputs("\" },\n", globs.comp_db); + fputs("\" }", globs.comp_db); } } diff --git a/jam/patchlevel.h b/jam/patchlevel.h index 14e64538c6..1ffed6bc5c 100644 --- a/jam/patchlevel.h +++ b/jam/patchlevel.h @@ -1,5 +1,5 @@ /* Keep JAMVERSYM in sync with VERSION. */ /* It can be accessed as $(JAMVERSION) in the Jamfile. */ -#define VERSION "2.5-haiku-20211020" -#define JAMVERSYM "JAMVERSION=2.5-haiku-20211020" +#define VERSION "2.5-haiku-20211029" +#define JAMVERSYM "JAMVERSION=2.5-haiku-20211029"