openwall / openwall/john

gcc -MMD allows to find dependencies for Makefile.in

Open
#3,842 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

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:

showformats.o:	showformats.c showformats.h loader.h options.h config.h dynamic.h
$ gcc -E -MMD showformats.c > /dev/null
$ cat showformats.d
showformats.o: showformats.c loader.h params.h arch.h list.h formats.h \
 misc.h jumbo.h omp_autotune.h options.h getopt.h common.h memory.h \
 john_mpi.h config.h dynamic.h simd-intrinsics.h pseudo_intrinsics.h \
 aligned.h simd-intrinsics-load-flags.h

So dependencies in Makefile.in might be improved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Makefile.in and the dependency rule for showformats.c, then reproduce the gcc -E -MMD example from the issue. Check how the generated .d file is incorporated and ensure nested header dependencies are included in the Makefile dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.