From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Michal Marek <mmarek@suse.com>, linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@ZenIV.linux.org.uk>,
Rusty Russell <rusty@rustcorp.com.au>
Subject: [PATCH v3 3/7] fixdep: accept extra dependencies on stdin
Date: Thu, 18 Feb 2016 15:06:59 -0500 [thread overview]
Message-ID: <1455826023-2134-4-git-send-email-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <1455826023-2134-1-git-send-email-nicolas.pitre@linaro.org>
... and merge them in the list of parsed dependencies.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
scripts/basic/fixdep.c | 60 +++++++++++++++++++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 15 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 5b327c67a8..d984deb120 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -120,13 +120,15 @@
#define INT_NFIG ntohl(0x4e464947)
#define INT_FIG_ ntohl(0x4649475f)
+int insert_extra_deps;
char *target;
char *depfile;
char *cmdline;
static void usage(void)
{
- fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
+ fprintf(stderr, "Usage: fixdep [-e] <depfile> <target> <cmdline>\n");
+ fprintf(stderr, " -e insert extra dependencies given on stdin\n");
exit(1);
}
@@ -138,6 +140,40 @@ static void print_cmdline(void)
printf("cmd_%s := %s\n\n", target, cmdline);
}
+/*
+ * Print out a dependency path from a symbol name
+ */
+static void print_config(const char *m, int slen)
+{
+ int c, i;
+
+ printf(" $(wildcard include/config/");
+ for (i = 0; i < slen; i++) {
+ c = m[i];
+ if (c == '_')
+ c = '/';
+ else
+ c = tolower(c);
+ putchar(c);
+ }
+ printf(".h) \\\n");
+}
+
+static void do_extra_deps(void)
+{
+ if (insert_extra_deps) {
+ char buf[80];
+ while(fgets(buf, sizeof(buf), stdin)) {
+ int len = strlen(buf);
+ if (len < 2 || buf[len-1] != '\n') {
+ fprintf(stderr, "fixdep: bad data on stdin\n");
+ exit(1);
+ }
+ print_config(buf, len-1);
+ }
+ }
+}
+
struct item {
struct item *next;
unsigned int len;
@@ -197,23 +233,12 @@ static void define_config(const char *name, int len, unsigned int hash)
static void use_config(const char *m, int slen)
{
unsigned int hash = strhash(m, slen);
- int c, i;
if (is_defined_config(m, slen, hash))
return;
define_config(m, slen, hash);
-
- printf(" $(wildcard include/config/");
- for (i = 0; i < slen; i++) {
- c = m[i];
- if (c == '_')
- c = '/';
- else
- c = tolower(c);
- putchar(c);
- }
- printf(".h) \\\n");
+ print_config(m, slen);
}
static void parse_config_file(const char *map, size_t len)
@@ -250,7 +275,7 @@ static void parse_config_file(const char *map, size_t len)
}
}
-/* test is s ends in sub */
+/* test if s ends in sub */
static int strrcmp(const char *s, const char *sub)
{
int slen = strlen(s);
@@ -374,6 +399,8 @@ static void parse_dep_file(void *map, size_t len)
exit(1);
}
+ do_extra_deps();
+
printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
}
@@ -430,7 +457,10 @@ int main(int argc, char *argv[])
{
traps();
- if (argc != 4)
+ if (argc == 5 && !strcmp(argv[1], "-e")) {
+ insert_extra_deps = 1;
+ argv++;
+ } else if (argc != 4)
usage();
depfile = argv[1];
--
2.5.0
next prev parent reply other threads:[~2016-02-18 20:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 20:06 [PATCH v3 0/7] Trim unused exported kernel symbols Nicolas Pitre
2016-02-18 20:06 ` [PATCH v3 1/7] kbuild: record needed exported symbols for modules Nicolas Pitre
2016-02-18 20:06 ` [PATCH v3 2/7] allow for per-symbol configurable EXPORT_SYMBOL() Nicolas Pitre
2016-02-18 20:06 ` Nicolas Pitre [this message]
2016-02-18 20:07 ` [PATCH v3 4/7] kbuild: de-duplicate fixdep usage Nicolas Pitre
2016-02-18 20:07 ` [PATCH v3 5/7] kbuild: add fine grained build dependencies for exported symbols Nicolas Pitre
2016-02-18 20:07 ` [PATCH v3 6/7] create/adjust generated/autoksyms.h Nicolas Pitre
2016-02-28 12:11 ` Zev Weiss
2016-02-28 19:31 ` Nicolas Pitre
2016-02-18 20:07 ` [PATCH v3 7/7] kconfig option for TRIM_UNUSED_KSYMS Nicolas Pitre
2016-02-24 15:19 ` [PATCH v3 0/7] Trim unused exported kernel symbols Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455826023-2134-4-git-send-email-nicolas.pitre@linaro.org \
--to=nicolas.pitre@linaro.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.com \
--cc=rusty@rustcorp.com.au \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).