Makefile: add missing dependency of 'opencl.o' on 'oclobj.h'
Without the change parallel build occasionally fails as:
$ make --shuffle
...
gcc ... -c common/opencl.c -o common/opencl-8.o ...
common/opencl.c:116:10: fatal error: common/oclobj.h: No such file or directory
116 | #include "common/oclobj.h"
| ^~~~~~~~~~~~~~~~~
Best reproducible with make --shuffle
mode:
https://savannah.gnu.org/bugs/index.php?62100
This happens because "common/oclobj.h" is an autogenerated file, but Makefile does not specify dependency of common/opencl-8.o in direct or indirect form.
The change moves dependency on $(GENERATED) from final binaries to intermediate object binaries:
$(OBJS): $(GENERATED)
Except that the actual change adds $(GENERATED) for any buildable objects to be a bit more future proof.
Merge request reports
Activity
Hi. Not like I am against it but I don't understand why you say that this dependency is not specified? As far as I can see in
.depend
file there iscommon/oclobj.h
:common/opencl-8.o: common/opencl.c common/common.h common/base.h \ common/osdep.h config.h x264.h x264_config.h common/win32thread.h \ common/cpu.h common/tables.h common/cabac.h common/bitstream.h \ common/set.h common/predict.h common/pixel.h common/mc.h common/frame.h \ common/dct.h common/quant.h common/threadpool.h common/macroblock.h \ common/x86/util.h common/rectangle.h common/oclobj.h
Also if I remember and understand correctly it is used before
.depend
target because we want to generate possible decencies of generated files also (i.e. call.depend
target when all generated files already exist). So may be it would make more sense to add it as dependency for.depend
(if we need to change anything).Another, probably easier to debug, reproducer:
$ ./configure ... $ make common/opencl-8.o dependency file generation... ./common/opencl.c:116:10: fatal error: common/oclobj.h: No such file or directory 116 | #include "common/oclobj.h" | ^~~~~~~~~~~~~~~~~ compilation terminated. gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64 -Wall -I. -I. -std=gnu99 -D_GNU_SOURCE -mpreferred-stack-boundary=6 -fPIC -fomit-frame-pointer -fno-tree-vectorize -fvisibility=hidden -DX264_API_EXPORTS -c common/opencl.c -o common/opencl-8.o -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 common/opencl.c:116:10: fatal error: common/oclobj.h: No such file or directory 116 | #include "common/oclobj.h" | ^~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:284: common/opencl-8.o] Error 1 $ dev>echo $? 2
added 1 commit
- 3909b07e - Makefile: add missing dependency of '.depend' on 'oclobj.h'
- Resolved by Sergei Trofimovich
Turned generated depdendency to
.depend: $(GENERATED)
. While at it removed direct.depend $(GENERATED)
dependencies from final binaries.
added 1 commit
- e067ab0b - Makefile: Add missing dependency of '.depend' on 'oclobj.h'