I am aware of the question below about how to refer, in file1, to labels from file2.
latexmk with external references
However, I must also refer, in file2, to labels from file1.
I am able to do it by using xr and \externaldocument in both files and running latex in the command line of my computer.
I want to run it on overleaf, and imagine that latexmk is the answer, but don't know how.
make
is to create a dummy "master" document which calls up the cross references in all the real documents (and it doesn't need to do anything else apart from that). Then, when you compile the master document, the dependencies mean that all the real documents get compiled first. If any of the references in them have changed, that means the master document needs to be compiled again, which will force another recompile of all the real documents … and repeat, till everything converges.