commit 71a81dc0027c360070f33bf80828ac94df93e776
Author:     Quentin Rameau <[email protected]>
AuthorDate: Wed Feb 15 18:35:23 2017 +0100
Commit:     Quentin Rameau <[email protected]>
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
@@ -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) {
@@ -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;

Reply via email to