Open AlekseyCherepanov opened 5 years ago
IIRC I saw another solution for includes from .h files: make fake target (IIRC .m file) for every header file that depends onto the header and onto targets of included header files; .c files depend onto fake targets of header files; files are just touch
ed to build fake targets. I cannot find any standard description for such approach.
The gcc-generated list lacks a number of entries, such as os-autoconf.h
$ gcc -E -MMD john.c >/dev/null
$ cat john.d
john.o: john.c os.h params.h arch.h openssl_local_overrides.h misc.h \
jumbo.h path.h memory.h list.h tty.h options.h loader.h formats.h \
omp_autotune.h getopt.h common.h john_mpi.h signals.h idle.h dyna_salt.h \
logger.h status.h recovery.h config.h bench.h charset.h single.h \
wordlist.h prince.h inc.h mask.h mkv.h mkvlib.h subsets.h external.h \
compiler.h batch.h dynamic.h simd-intrinsics.h pseudo_intrinsics.h \
aligned.h simd-intrinsics-load-flags.h dynamic_compiler.h fake_salts.h \
listconf.h crc32.h regex.h unicode.h gpu_common.h opencl_common.h \
john_build_rule.h fmt_externs.h fmt_registers.h
$ ./plugin_deps.pl john.c | fold -s
john.o: john.c autoconfig.h os.h os-autoconf.h jumbo.h arch.h params.h
openssl_local_overrides.h misc.h path.h memory.h list.h tty.h options.h
loader.h formats.h omp_autotune.h getopt.h common.h john_mpi.h signals.h idle.h
dyna_salt.h logger.h status.h recovery.h config.h bench.h fuzz.h charset.h
single.h wordlist.h prince.h inc.h mask.h mkv.h mkvlib.h subsets.h external.h
compiler.h batch.h dynamic.h simd-intrinsics.h pseudo_intrinsics.h aligned.h
simd-intrinsics-load-flags.h dynamic_compiler.h fake_salts.h listconf.h crc32.h
regex.h unicode.h gpu_common.h gpu_sensors.h opencl_common.h
../run/opencl/opencl_device_info.h ztex_common.h john_build_rule.h
fmt_externs.h fmt_registers.h
This is because things like this will be parsed:
#if AC_BUILT
#include "os-autoconf.h"
#else
(...)
#endif
That's not how plugin_deps.pl
does it - it will ignore the #if ... #else
and include everything (both sides). The gcc way is better, in that for example a non-OpenCL (re)build will ignore changed OpenCL source files.
Modifying
Makefile.in
I found it hard to account nested dependencies when .h file includes more .h files.@rofl0r pointed out to me that it is possible to ask gcc to list dependencies of .c file onto .h files.
For example, my list of dependencies included all .h files included in .c file:
So dependencies in
Makefile.in
might be improved.