/*******************************************************************
* output_sources
*/
-static struct strarray output_sources( const struct makefile *make, struct strarray *testlist_files )
+static struct strarray output_sources( const struct makefile *make )
{
struct incl_file *source;
unsigned int i, j;
strarray_add( &phony_targets, "check" );
strarray_add( &phony_targets, "test" );
strarray_add( &phony_targets, "testclean" );
- *testlist_files = strarray_replace_extension( &ok_files, ".ok", "" );
}
for (i = 0; i < make->programs.count; i++)
/*******************************************************************
* output_testlist
*/
-static void output_testlist( const char *dest, struct strarray files )
+static void output_testlist( const struct makefile *make )
{
- int i;
+ const char *dest = base_dir_path( make, "testlist.c" );
+ struct strarray files = empty_strarray;
+ struct incl_file *source;
+ unsigned int i;
+
+ LIST_FOR_EACH_ENTRY( source, &make->sources, struct incl_file, entry )
+ {
+ if (source->file->flags & FLAG_GENERATED) continue;
+ if (!strendswith( source->name, ".c" )) continue;
+ strarray_add( &files, replace_extension( source->name, ".c", "" ));
+ }
output_file = create_temp_file( dest );
static void output_dependencies( const struct makefile *make )
{
static const char separator[] = "### Dependencies";
- struct strarray targets, testlist_files = empty_strarray, ignore_files = empty_strarray;
+ struct strarray targets, ignore_files = empty_strarray;
char buffer[1024];
FILE *src_file;
int found = 0;
input_file_name = NULL;
if (!found) output( "\n%s (everything below this line is auto-generated; DO NOT EDIT!!)\n", separator );
- targets = output_sources( make, &testlist_files );
+ targets = output_sources( make );
fclose( output_file );
output_file = NULL;
strarray_add( &ignore_files, ".gitignore" );
strarray_add( &ignore_files, "Makefile" );
- if (testlist_files.count) strarray_add( &ignore_files, "testlist.c" );
+ if (make->testdll)
+ {
+ output_testlist( make );
+ strarray_add( &ignore_files, "testlist.c" );
+ }
strarray_addall( &ignore_files, targets );
-
- if (testlist_files.count)
- output_testlist( base_dir_path( make, "testlist.c" ), testlist_files );
if (!make->src_dir && make->base_dir)
output_gitignore( base_dir_path( make, ".gitignore" ), ignore_files );