diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-04-24 16:08:46 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-04-24 17:37:46 +0200 |
commit | 7019a1c67473623cb81ca0c9e155b90a5ce6947a (patch) | |
tree | 8a1db39a43b28aa9673133a2e6bb2a7cd8a91e40 /soltools/mkdepend | |
parent | ced9e2abecbbdf70acb3ca46c5e6a6d4247015c0 (diff) |
gbuild: get rid of processdeps.awk
The only thing that processdeps.awk does that is actually useful is to
be able to set the target name freely, but that is only important for
the default resource file which was just renamed.
Instead hack makedepend to provide the required functionality directly:
- write dummy rules for included files so builds don't break on
rename/removal
- format deps one per line like concat-deps expects
- concat-deps expects standard POSIX line ends, so open in binary mode
(also disable that awful backup copying nonsense)
Though in retrospect it would perhaps be a better investment of time to
try to replace makedepend...
Change-Id: I54fafdcdcf1a52692e62b8f1f4b96fb9a93d4421
Diffstat (limited to 'soltools/mkdepend')
-rw-r--r-- | soltools/mkdepend/def.h | 1 | ||||
-rw-r--r-- | soltools/mkdepend/main.c | 12 | ||||
-rw-r--r-- | soltools/mkdepend/pr.c | 34 |
3 files changed, 43 insertions, 4 deletions
diff --git a/soltools/mkdepend/def.h b/soltools/mkdepend/def.h index 1ec838231d68..1c0e91a811c9 100644 --- a/soltools/mkdepend/def.h +++ b/soltools/mkdepend/def.h @@ -181,6 +181,7 @@ void add_include(struct filepointer *filep, struct inclist *file, int match(register char *str, register char **list); void recursive_pr_include(register struct inclist *head, register char *file, register char *base); +void recursive_pr_dummy(register struct inclist *head, register char *file); void inc_clean(); void fatalerr(char *, ...); diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c index 5beb8fdf981e..149bae1e62da 100644 --- a/soltools/mkdepend/main.c +++ b/soltools/mkdepend/main.c @@ -461,6 +461,9 @@ int main(argc, argv) freefile(filecontent); recursive_pr_include(ip, ip->i_file, base_name(*fp)); + if (printed) + fwrite("\n\n", 2, 1, stdout); + recursive_pr_dummy(ip, ip->i_file); inc_clean(); } if (printed) @@ -660,6 +663,14 @@ void redirect(line, makefile) char *line, *makefile; { + FILE *fdout; + fdout = freopen(makefile, "wb", stdout); // binary mode please + if (fdout == NULL) + fatalerr("cannot open \"%s\"\n", makefile); + (void) line; + + // don't need any of that nonsense +#if 0 struct stat st; FILE *fdin, *fdout; char backup[ BUFSIZ ], @@ -724,6 +735,7 @@ void redirect(line, makefile) fchmod(fileno(fdout), st.st_mode); #endif /* USGISH */ fclose(fdin); +#endif } void fatalerr(char *msg, ...) diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c index f472f28ebd75..e6200781b465 100644 --- a/soltools/mkdepend/pr.c +++ b/soltools/mkdepend/pr.c @@ -79,6 +79,29 @@ void add_include(struct filepointer *filep, struct inclist *file, struct inclist } } +void pr_dummy(ip) + register struct inclist *ip; +{ + fwrite(ip->i_file, strlen(ip->i_file), 1, stdout); + fwrite(" :\n\n", 4, 1, stdout); +} + +void recursive_pr_dummy(head, file) + register struct inclist *head; + register char *file; +{ + register int i; + + if (head->i_marked == 2) + return; + head->i_marked = 2; // it's a large boolean... + if (head->i_file != file) + pr_dummy(head, file); + for (i=0; i<head->i_listlen; i++) + recursive_pr_dummy(head->i_list[ i ], file); +} + + void recursive_pr_include(head, file, base) register struct inclist *head; register char *file, *base; @@ -105,16 +128,19 @@ size_t pr(ip, file, base) char buf[ BUFSIZ ]; printed = TRUE; - len = (int)strlen(ip->i_file)+1; - if (current_len + len > width || file != lastfile) { + len = (int)strlen(ip->i_file)+4; + if (file != lastfile) { lastfile = file; - sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix, + sprintf(buf, "\n%s%s%s: \\\n %s", objprefix, base, objsuffix, ip->i_file); len = current_len = (int)strlen(buf); } else { buf[0] = ' '; - strcpy(buf+1, ip->i_file); + buf[1] = '\\'; + buf[2] = '\n'; + buf[3] = ' '; + strcpy(buf+4, ip->i_file); current_len += len; } ret = fwrite(buf, len, 1, stdout); |