Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.232
 
1.233
 
MAIN:ragge:20120806075651
 
cc.c
_>224224 char *defproflibs[] = DEFPROFLIBS;
 225225 char *defcxxlibs[] = DEFCXXLIBS;
 226226 
<>227 -char    *outfile;
  227+char    *outfile, *MFfile;
228228 static char **lav;
 229229 static int lac;
 230230 static char *find_file(const char *file, struct strlist *path, int mode);
     
 !
275275 int     kflag;  /* generate PIC/pic code */
 276276 #define F_PIC   1
 277277 #define F_pic   2
<>278 -int     Mflag, needM;   /* dependencies only */
  278+int     Mflag, needM, MDflag;   /* dependencies only */
279279 int     pgflag;
 280280 int     Xflag;
 281281 int     Wallflag;
     
 !
739739                         break;
 740740 
 741741                 case 'M':
<>742 -                        switch (argp[2]) {
 743 -                        case '\0':
  742+                        needM = 1;
  743+                        if (match(argp, "-M")) {
744744                                 Mflag++;
 745745                                 strlist_append(&depflags, argp);
<>746 -                                break;
 747 -                        case 'P':
 748 -                                needM = 1;
  746+                        } else if (match(argp, "-MP")) {
749747                                 strlist_append(&depflags, "-xMP");
<>750 -                                break;
 751 -                        case 'F':
 752 -                                needM = 1;
 753 -                                outfile = nxtopt("-MF");
 754 -                                break;
 755 -                        case 'T':
 756 -                        case 'Q':
 757 -                                needM = 1;
  748+                        } else if (match(argp, "-MF")) {
  749+                                MFfile = nxtopt("-MF");
  750+                        } else if (match(argp, "-MT") || match(argp, "-MQ")) {
758751                                 t = cat("-xMT,", nxtopt("-MT"));
 759752                                 t[3] = argp[2];
 760753                                 strlist_append(&depflags, t);
<>761 -                                break;
 762 -                        default:
  754+                        } else if (match(argp, "-MD")) {
  755+                                MDflag++;
  756+                                needM = 0;
  757+                                strlist_append(&depflags, "-M");
  758+                        } else
763759                                 oerror(argp);
<>764 -                        }
765760                         break;
 766761 
 767762                 case 'd':
     
 !
820815                 errorx(8, "output file will be clobbered");
 821816 #endif
 822817 
<>823 -        if (needM && !Mflag)
  818+        if (needM && !Mflag && !MDflag)
824819                 errorx(8, "to make dependencies needs -M");
 825820 
 826821 
     
 !
865860                 if (match(suffix, "c") || match(suffix, "S") ||
 866861                     cxxsuf(s->value)) {
 867862                         /* find out next output file */
<>868 -                        if (Eflag || Mflag) {
  863+                        if (Mflag || MDflag) {
  864+                                char *Mofile;
  865+
  866+                                if (MFfile)
  867+                                        Mofile = MFfile;
  868+                                else if (outfile)
  869+                                        Mofile = setsuf(outfile, 'd');
  870+                                else
  871+                                        Mofile = setsuf(ifile, 'd');
  872+                                if (preprocess_input(ifile, Mofile, 1))
  873+                                        exandrm(Mofile);
  874+                        }
  875+                        if (Mflag)
  876+                                continue;
  877+                        if (Eflag) {
869878                                 /* last pass */
 870879                                 ofile = outfile;
 871880                         } else {
 872881                                 /* to temp file */
 873882                                 strlist_append(&temp_outputs, ofile = gettmp());
 874883                         }
<>875 -                        if (Mflag /* || MDflag */)
 876 -                                if (preprocess_input(ifile, ofile, 1))
 877 -                                        exandrm(ofile);
 878 -                        if (Mflag)
 879 -                                continue;
880884                         if (preprocess_input(ifile, ofile, 0))
 881885                                 exandrm(ofile);
 882886                         if (Eflag)
     
 !
11781182 }
 11791183 
 11801184 /*
<>1181 - * Get basename of string s and change its suffix to ch.
  1185+ * Get basename of string s, copy it and change its suffix to ch.
11821186  */
 11831187 char *
 11841188 setsuf(char *s, char ch)
 11851189 {
<>1186 -        char *p;
 1187 -        int l;
  1190+        char *p, *rp;
11881191 
<>1189 -        if ((p = strrchr(s, '.'))) {
 1190 -                p[1] = ch;
 1191 -                p[2] = '\0';
 1192 -                return(s);
 1193 -        }
 1194 -        l = strlen(s)+3;
 1195 -        p = xmalloc(l);
 1196 -        snprintf(p, l, "%s.%c", s, ch);
 1197 -        return(p);
  1192+        if ((p = strrchr(s, '/')))
  1193+                s = ++p;
  1194+
  1195+        rp = p = xmalloc(strlen(s)+3);
  1196+        for (; (*p = *s) && *p != '.'; p++, s++)
  1197+                ;
  1198+        *p++ = '.';
  1199+        *p++ = ch;
  1200+        *p = 0;
  1201+        return rp;
<_11981202 }
 11991203 
 12001204 #ifdef os_win32
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-08-31 10:17 +0200