cartesi / machine-emulator

The off-chain implementation of the Cartesi Machine
GNU Lesser General Public License v3.0
58 stars 32 forks source link

Refactor uarch generated files for easy cross compilation #180

Closed edubart closed 5 months ago

edubart commented 5 months ago

This PR refactors how uarch related files are generated to make it able to cross compiling for WASM and Windows again.

Now when you type make uarch-with-linux-env it will build the following files:

This will be built inside the uarch Docker. Then when you do make -C src only the files uarch/uarch-pristine-hash.c and uarch/uarch-pristine-ram.c will be used from the uarch directory. For the ones wanting to compile without Docker, downloading those two files should be enough.

Notice that if any source code in the emulator interpreter is changed, to make sure uarch-pristine-ram.c is correct, you have to explicit build it again by removing it or invoking make uarch-with-linux-env, because make timestamp dependency tree is not propagated from src to uarch directory, this is intentional to allow cross compiling.

Extra

This PR also refactor a little the make install, this target was split in multiple targets, to make easy to package more personalized packages, it is used in the wiki page https://github.com/cartesi/machine-emulator/wiki/Compiling-and-running-in-WASM