|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000472||mercury||Bug||public||2018-11-09 23:24||2018-11-17 22:40|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Target Version||Fixed in Version|
|Summary||0000472: Touching a .m file does not rebuild other modules that may depend on C foreign code that is opt-exported from that module|
|Description||Within Plasma https://github.com/PlasmaLang/plasma I have a C header runtime/pz_format.h, I have some Makefile rules to touch src/pz.m and src/pz.bytecode.m if it is updated, so that any foreign code is rebuilt. However if I change an enum in runtime/pz_format.h causing these .m files to be touched and rebuilt the tests "make test" can fail.|
I think what might be happening is that because the Mercury code didn't actually change, mmc does not update the pz.mh file and therefore other .c files generated from output are not rebuilt to object code.
I can work-around this by touching the .mh files as well, I still need to touch the .m file so that mmc checks the .mh file.
|Additional Information||Mercury 14.01.1|
|Tags||No tags attached.|
Here's the workaround in Plasma's Makefile:
This is working as designed. Mmc does not generate .mh files directly;
it generated .mh.tmp files, and then invokes mercury_update_interface
to copy that across to the .mh file IF AND ONLY IF the new contents
are different from the old contents. This saves a huge number of
unnecessary recompilations. We do NOT want to undo this optimization
just because your Makefile does not express all the dependencies.
I think you need to change your Makefile to express the dependency
of all the modules that need pz_format.h on pz_format.h directly,
not through pz.m.
|I'll double check but I think I've only put this dependency all the .m files that that have a C FFI #include for pz_format.h. If I could also tell Mercury (easily?) that pz.write.o depends on pz_format.h because it reads pz.mh then that seems like the best option. I'll double check.|
|2018-11-09 23:24||pbone||New Issue|
|2018-11-09 23:38||pbone||Note Added: 0001016|
|2018-11-09 23:41||zs||Assigned To||=> zs|
|2018-11-09 23:41||zs||Status||new => resolved|
|2018-11-09 23:41||zs||Resolution||open => fixed|
|2018-11-09 23:41||zs||Note Added: 0001017|
|2018-11-17 22:40||pbone||Note Added: 0001018|