Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build/Makefile.global
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ prof-use:
if test ! -z "$(PHP)"; then \
echo Parse $< to generate $@;\
$(PHP) $(top_srcdir)/build/gen_stub.php $<; \
touch $@; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the touch() rather be included in gen_stub.php to make it self-contained?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it. My reasoning is that updating the timestamp is strictly makefile business, because that's how makefile works. If you think about the gen_stub.php script, when you invoke it manually, has no business updating the timestamp in case of a no-op, it doesn't care nor it shouldn't. Hence, I figured it belongs to the makefile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. When I run gen_stub.php, I expect it to generate the resulting artifacts. The hash check is an optimization / implementation detail to me, except it's currently a leaky optimization, since it is observable. Moving the touch() into gen_stub.php would be the right thing.

Also: What would happen if gen_stub.php fails for some reason? Would the touch still be executed? Is the shell running with -e?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: What would happen if gen_stub.php fails for some reason? Would the touch still be executed? Is the shell running with -e?

Good point, I assumed it does and the execution would stop in case of failure, but now that you point it out... I'll test it anyway and then update the PR with the touch inside the script.

elif test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
echo Parse $< to generate $@;\
$(PHP_EXECUTABLE) $(top_srcdir)/build/gen_stub.php $<; \
touch $@; \
fi; \
fi;

Expand Down
Loading