Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
a13257dd
Commit
a13257dd
authored
Aug 05, 2008
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make depends build the _info files (easier for Dinesh's work)
parent
f6387bc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
Makefile
Makefile
+0
-3
tools/ccan_depends.c
tools/ccan_depends.c
+2
-1
tools/depends.c
tools/depends.c
+26
-2
No files found.
Makefile
View file @
a13257dd
...
...
@@ -14,11 +14,8 @@ libccan.a: $(ALL_LIBS)
check
:
$(ALL_DIRS:%=test-%)
distclean
:
clean
rm
-f
*
/_info
rm
-f
$(ALL_DEPENDS)
$(ALL_DEPENDS)
:
$(ALL_DIRS:=/_info)
$(ALL_DEPENDS)
:
%/.depends: tools/ccan_depends
tools/ccan_depends
$*
>
$@
||
(
rm
-f
$@
;
exit
1
)
...
...
tools/ccan_depends.c
View file @
a13257dd
...
...
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "string/string.h"
#include "talloc/talloc.h"
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -13,7 +14,7 @@ int main(int argc, char *argv[])
errx
(
1
,
"Usage: ccan_depends <dir>
\n
"
"Spits out all the ccan dependencies (recursively)"
);
deps
=
get_deps
(
NULL
,
argv
[
1
]);
deps
=
get_deps
(
talloc_autofree_context
()
,
argv
[
1
]);
for
(
i
=
0
;
deps
[
i
];
i
++
)
if
(
strstarts
(
deps
[
i
],
"ccan/"
))
printf
(
"%s
\n
"
,
deps
[
i
]);
...
...
tools/depends.c
View file @
a13257dd
...
...
@@ -3,6 +3,7 @@
#include "tools.h"
#include <err.h>
#include <stdbool.h>
#include <unistd.h>
static
char
**
__attribute__
((
format
(
printf
,
3
,
4
)))
lines_from_cmd
(
const
void
*
ctx
,
unsigned
int
*
num
,
char
*
format
,
...)
...
...
@@ -27,11 +28,34 @@ lines_from_cmd(const void *ctx, unsigned int *num, char *format, ...)
return
strsplit
(
ctx
,
buffer
,
"
\n
"
,
num
);
}
static
int
unlink_info
(
char
*
infofile
)
{
unlink
(
infofile
);
return
0
;
}
/* Be careful about trying to compile over running programs (parallel make) */
static
char
*
compile_info
(
const
void
*
ctx
,
const
char
*
dir
)
{
char
*
infofile
=
talloc_asprintf
(
ctx
,
"%s/_info.%u"
,
dir
,
getpid
());
char
*
cmd
=
talloc_asprintf
(
ctx
,
"cc "
CFLAGS
" -o %s %s/_info.c"
,
infofile
,
dir
);
talloc_set_destructor
(
infofile
,
unlink_info
);
if
(
system
(
cmd
)
!=
0
)
return
NULL
;
return
infofile
;
}
static
char
**
get_one_deps
(
const
void
*
ctx
,
const
char
*
dir
,
unsigned
int
*
num
)
{
char
**
deps
,
*
cmd
;
char
**
deps
,
*
cmd
,
*
infofile
;
infofile
=
compile_info
(
ctx
,
dir
);
if
(
!
infofile
)
errx
(
1
,
"Could not compile _info for '%s'"
,
dir
);
cmd
=
talloc_asprintf
(
ctx
,
"%s
/_info depends"
,
dir
);
cmd
=
talloc_asprintf
(
ctx
,
"%s
depends"
,
infofile
);
deps
=
lines_from_cmd
(
cmd
,
num
,
"%s"
,
cmd
);
if
(
!
deps
)
err
(
1
,
"Could not run '%s'"
,
cmd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment