Sysinternals / ProcDump-for-Linux

A Linux version of the ProcDump Sysinternals tool
MIT License
2.94k stars 303 forks source link

Makefile: add order-only build dependencies on directories #133

Closed trofi closed 2 years ago

trofi commented 2 years ago

Noticed missing build dependencies when attempted to enable parallelism on NixOS procdump package. There build failed as:

$ make -j16 -l16
rm -rf obj
gcc -c -g -o obj/CoreDumpWriter.o src/CoreDumpWriter.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/Events.o src/Events.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/Handle.o src/Handle.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/Logging.o src/Logging.c -Wall -I ./include -pthread -std=gnu99
rm -rf bin
gcc -c -g -o obj/ProcDumpConfiguration.o src/ProcDumpConfiguration.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/Procdump.o src/Procdump.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/Process.o src/Process.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/TriggerThreadProcs.o src/TriggerThreadProcs.c -Wall -I ./include -pthread -std=gnu99
gcc -c -g -o obj/ProcDumpTestApplication.o tests/integration/ProcDumpTestApplication.c -Wall -I ./include -pthread -std=gnu99
rm -rf /build/source/pkgbuild
gcc -o bin/ProcDumpTestApplication obj/ProcDumpTestApplication.o -Wall -I ./include -pthread -std=gnu99
ld: cannot open output file bin/ProcDumpTestApplication: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:60: bin/ProcDumpTestApplication] Error 1
make: *** Waiting for unfinished jobs....

Note how bin/ProcDumpTestApplication is attempted to be created before 'bin' directory. The change adds order-only directory dependencies to all targets that need it.

While at it: