[hackers] [scc] [cc1] Do it like gcc. Fix -M output. || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 17 Feb 2017 23:06:58 +0100 (CET)

commit 71a81dc0027c360070f33bf80828ac94df93e776
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Wed Feb 15 18:35:23 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri Feb 17 22:51:32 2017 +0100

    [cc1] Do it like gcc. Fix -M output.
    
    Change the format from:
    filename.ext: dependencies
    to:
    filename.o: filename.ext dependencies

diff --git a/cc1/lex.c b/cc1/lex.c
index 7e9e459..a582fcb 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -90,7 +90,9 @@ int
 addinput(char *fname, Symbol *hide, char *buffer)
 {
         FILE *fp;
+ char *extp;
         unsigned flags;
+ size_t infileln;
         Input *newip, *curip = input;
 
         if (hide) {
_AT_@ -105,8 +107,13 @@ addinput(char *fname, Symbol *hide, char *buffer)
                 if ((fp = fopen(fname, "r")) == NULL)
                         return 0;
                 flags = IFILE;
- if (curip && onlyheader)
- printf("%s: %s\n", infile, fname);
+ if (curip && onlyheader) {
+ infileln = strlen(infile);
+ if (extp = strrchr(infile, '.'))
+ infileln -= strlen(extp);
+ printf("%.*s.o: %s %s\n",
+ infileln, infile, infile, fname);
+ }
         } else {
                 /* reading from stdin */
                 fp = stdin;
Received on Fri Feb 17 2017 - 23:06:58 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 17 2017 - 23:12:27 CET