main: separate CFLAGS and LIBS collection and printing steps into two phases.
parent
d94ab7555d
commit
a4a572f608
53
main.c
53
main.c
|
@ -93,15 +93,21 @@ print_fragment(pkg_fragment_t *frag)
|
|||
}
|
||||
|
||||
static void
|
||||
print_cflags(pkg_t *pkg, void *unused)
|
||||
{
|
||||
(void) unused;
|
||||
|
||||
if (pkg->cflags != NULL)
|
||||
collect_cflags(pkg_t *pkg, void *data)
|
||||
{
|
||||
pkg_fragment_t **list = data;
|
||||
pkg_fragment_t *frag;
|
||||
|
||||
foreach_list_entry(pkg->cflags, frag)
|
||||
*list = pkg_fragment_copy(*list, frag);
|
||||
}
|
||||
|
||||
static void
|
||||
print_cflags(pkg_fragment_t *list)
|
||||
{
|
||||
pkg_fragment_t *frag;
|
||||
|
||||
foreach_list_entry(list, frag)
|
||||
{
|
||||
if (want_cflags == WANT_CFLAGS_ONLY_I && frag->type != 'I')
|
||||
continue;
|
||||
|
@ -111,35 +117,29 @@ print_cflags(pkg_t *pkg, void *unused)
|
|||
print_fragment(frag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_libs(pkg_t *pkg, void *unused)
|
||||
{
|
||||
(void) unused;
|
||||
|
||||
if (pkg->libs != NULL)
|
||||
collect_libs(pkg_t *pkg, void *data)
|
||||
{
|
||||
pkg_fragment_t **list = data;
|
||||
pkg_fragment_t *frag;
|
||||
|
||||
foreach_list_entry(pkg->libs, frag)
|
||||
*list = pkg_fragment_copy(*list, frag);
|
||||
|
||||
if (want_static)
|
||||
{
|
||||
if (want_libs == WANT_LIBS_ONLY_LDPATH && frag->type != 'L')
|
||||
continue;
|
||||
else if (want_libs == WANT_LIBS_ONLY_LIBNAME && frag->type != 'l')
|
||||
continue;
|
||||
else if (want_libs == WANT_LIBS_ONLY_OTHER && (frag->type == 'l' || frag->type == 'L'))
|
||||
continue;
|
||||
|
||||
print_fragment(frag);
|
||||
foreach_list_entry(pkg->libs_private, frag)
|
||||
*list = pkg_fragment_copy(*list, frag);
|
||||
}
|
||||
}
|
||||
|
||||
if (want_static && pkg->libs_private != NULL)
|
||||
static void
|
||||
print_libs(pkg_fragment_t *list)
|
||||
{
|
||||
pkg_fragment_t *frag;
|
||||
|
||||
foreach_list_entry(pkg->libs_private, frag)
|
||||
foreach_list_entry(list, frag)
|
||||
{
|
||||
if (want_libs == WANT_LIBS_ONLY_LDPATH && frag->type != 'L')
|
||||
continue;
|
||||
|
@ -151,7 +151,6 @@ print_libs(pkg_t *pkg, void *unused)
|
|||
print_fragment(frag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_modversion(pkg_t *pkg, void *unused)
|
||||
|
@ -345,14 +344,20 @@ pkg_queue_walk(pkg_queue_t *head)
|
|||
|
||||
if (want_cflags)
|
||||
{
|
||||
pkg_fragment_t *list = NULL;
|
||||
|
||||
wanted_something++;
|
||||
pkg_traverse(&world, print_cflags, NULL, maximum_traverse_depth, global_traverse_flags | PKGF_SEARCH_PRIVATE);
|
||||
pkg_traverse(&world, collect_cflags, &list, maximum_traverse_depth, global_traverse_flags | PKGF_SEARCH_PRIVATE);
|
||||
print_cflags(list);
|
||||
}
|
||||
|
||||
if (want_libs)
|
||||
{
|
||||
pkg_fragment_t *list = NULL;
|
||||
|
||||
wanted_something++;
|
||||
pkg_traverse(&world, print_libs, NULL, maximum_traverse_depth, global_traverse_flags);
|
||||
pkg_traverse(&world, collect_libs, &list, maximum_traverse_depth, global_traverse_flags);
|
||||
print_libs(list);
|
||||
}
|
||||
|
||||
if (want_variable)
|
||||
|
|
Loading…
Reference in New Issue