[lester@localhost gendep-0.1]$ gcc --version gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [lester@localhost gendep-0.1]$ cat /etc/issue Fedora Core release 6 (Zod) Kernel \r on an \m [lester@localhost gendep-0.1]$ uname -a Linux localhost.localdomain 2.6.20-1.2933.fc6 #1 SMP Mon Mar 19 11:38:26 EDT 2007 i686 i686 i386 GNU/Linux
If all that is very confusing, download the source code, build the library with "make" and then type "make test" to run an example which will compile an example program "simple-cat.c" and output dependency information twice. Here is the test target of the makefile:
test: GENDEP_TARGET='simple-cat' \ GENDEP_BINARY=cc1\ GENDEP_cc1='+\.h$$ -^/usr' \ LD_PRELOAD=$(shell pwd)/libgendep.so\ gcc -o simple-cat simple-cat.c GENDEP_TARGET='badexp' \ GENDEP_BINARY=cc1\ GENDEP_cc1='\)foo'\ LD_PRELOAD=$(shell pwd)/libgendep.so\ gcc -o simple-cat simple-cat.c @echo ==================== @echo == simple-cat.dep == cat simple-cat.dep @echo ================ @echo == badexp.dep == cat badexp.dep @echo ================You should see output similar to the following:
==================== == simple-cat.dep == cat simple-cat.dep simple-cat: gendep.h ================ == badexp.dep == cat badexp.dep badexp: simple-cat.c/usr/include/stdio.h/usr/include/features.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-64.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h\ /usr/include/bits/types.h/usr/include/bits/wordsize.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h\ /usr/include/bits/typesizes.h/usr/include/libio.h\ /usr/include/_G_config.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h\ /usr/include/wchar.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h\ /usr/include/bits/wchar.h/usr/include/gconv.h/usr/include/wchar.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h\ /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h\ /usr/include/bits/stdio_lim.h/usr/include/bits/sys_errlist.h\ gendep.h ================in which you can see that the good regexp in the first example caused only relevant dependencies to be printed, whereas the second example ("badexp") showed how a bad regexp could lead to an excessive number of dependencies being recorded.