Commit Graph

27 Commits

Author SHA1 Message Date
Kirill Smelkov
0c928da96d tcc: Draft suppoprt for -MD/-MF options
In build systems, this is used to automatically collect target
dependencies, e.g.

    ---- 8< (hello.c) ----
    #include "hello.h"
    #include <stdio.h>

    int main()
    {
        printf("Hello World!\n");
        return 0;
    }

$ tcc -MD -c hello.c    # -> hello.o, hello.d
$ cat hello.d
hello.o : \
        hello.c \
        hello.h \
        /usr/include/stdio.h \
        /usr/include/features.h \
        /usr/include/bits/predefs.h \
        /usr/include/sys/cdefs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs-32.h \
        /home/kirr/local/tcc/lib/tcc/include/stddef.h \
        /usr/include/bits/types.h \
        /usr/include/bits/wordsize.h \
        /usr/include/bits/typesizes.h \
        /usr/include/libio.h \
        /usr/include/_G_config.h \
        /usr/include/wchar.h \
        /home/kirr/local/tcc/lib/tcc/include/stdarg.h \
        /usr/include/bits/stdio_lim.h \
        /usr/include/bits/sys_errlist.h \

NOTE: gcc supports -MD only for .c -> .o, but in tcc, we generate
dependencies for whatever action is being taken. E.g. for .c -> exe, the
result will be:

$ tcc -MD -o hello hello.c  # -> hello, hello.d
hello: \
        /usr/lib/crt1.o \
        /usr/lib/crti.o \
        hello.c \
        hello.h \
        /usr/include/stdio.h \
        /usr/include/features.h \
        /usr/include/bits/predefs.h \
        /usr/include/sys/cdefs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs-32.h \
        /home/kirr/local/tcc/lib/tcc/include/stddef.h \
        /usr/include/bits/types.h \
        /usr/include/bits/wordsize.h \
        /usr/include/bits/typesizes.h \
        /usr/include/libio.h \
        /usr/include/_G_config.h \
        /usr/include/wchar.h \
        /home/kirr/local/tcc/lib/tcc/include/stdarg.h \
        /usr/include/bits/stdio_lim.h \
        /usr/include/bits/sys_errlist.h \
        /usr/lib/libc.so \
        /lib/libc.so.6 \
        /usr/lib/ld-linux.so.2 \
        /lib/ld-linux.so.2 \
        /usr/lib/libc_nonshared.a \
        /lib/libc.so.6 \
        /usr/lib/libc_nonshared.a \
        /home/kirr/local/tcc/lib/tcc/libtcc1.a \
        /usr/lib/crtn.o \

So tcc dependency generator is a bit more clever than one used in gcc :)

Also, I've updated TODO and Changelog (in not-yet-released section).

v2:

(Taking inputs from grischka and me myself)

- put code to generate deps file into a function.
- used tcc_fileextension() instead of open-coding
- generate deps only when compilation/preprocessing was successful

v3:

- use pstrcpy instead of snprintf(buf, sizeof(buf), "%s", ...)
2010-06-21 20:49:02 +04:00
grischka
265dddbecf Udated and cleaned up TODO. 2008-01-16 22:33:56 +00:00
grischka
3667408a57 Just warn about unknown directives, define __STDC_VERSION__=199901L 2008-01-16 20:16:35 +00:00
bellard
1c1919072b update 2004-11-07 15:51:57 +00:00
bellard
2a6c104722 update 2004-10-23 23:11:05 +00:00
bellard
b7f12dfbdf update 2003-10-04 21:29:04 +00:00
bellard
4e6edcdcdd update 2003-05-24 16:12:58 +00:00
bellard
0d6f8021ee update 2003-04-14 22:23:55 +00:00
bellard
dd56ab8c77 added configure support 2003-04-13 19:50:35 +00:00
bellard
75e743d23e update 2003-01-06 20:19:20 +00:00
bellard
dc685c6b7d update 2002-12-08 14:34:02 +00:00
bellard
122198a8c2 update 2002-11-24 15:58:28 +00:00
bellard
6cd2d5d2c8 update 2002-11-03 00:44:38 +00:00
bellard
10f5d44f43 update 2002-09-08 22:13:54 +00:00
bellard
bc427f5bec update 2002-08-31 12:44:16 +00:00
bellard
5370be48e2 updated 2002-08-18 14:44:08 +00:00
bellard
524be938fd updated 2002-08-18 14:34:02 +00:00
bellard
840d197e87 update 2002-07-24 22:13:02 +00:00
bellard
e5de65fcec update 2002-02-10 16:15:08 +00:00
bellard
ebe9e87ccf update 2002-01-05 19:50:17 +00:00
bellard
b0b2d5d2e9 update 2001-12-17 21:57:01 +00:00
bellard
a88b855866 update 2001-12-02 21:44:40 +00:00
bellard
34a14a08a3 update 2001-11-18 16:33:35 +00:00
bellard
4dceee3677 update 2001-11-11 22:51:50 +00:00
bellard
eb0e3e70dc update 2001-11-11 18:01:29 +00:00
bellard
58f3296a6e updated 2001-10-28 15:29:01 +00:00
bellard
27f6e16bae Initial revision 2001-10-27 23:48:39 +00:00