elvm
elvm copied to clipboard
Building with make takes an absurd amount of time and space
After running make for about 60 hours, 108 GB of disk space was taken up, and the tests were not finished. I have some suggestions to make building and testing better:
- Make a
configurescript to set the languages to build (via the presence of tools on the system and command-line flags like--enable-cand--disable-tm), which will generate a Makefile from a template (viaautomake). - Refactor the Makefile to be more modular:
- Separate building and testing into different targets (
buildandtest). - Create targets for building and testing individual languages (e.g.
build-cppandtest-js). - Create a
test-fulltarget that runs expensive tests (e.g. 3-stage bootstrap tests), which are not included in the regulartesttarget. - Properly clean up test files after each test to reduce filesystem impact.
- Separate building and testing into different targets (
As you said, running make is not realistic. However, I doubt splitting the build to configure and make helps. For most cases, you are developing a single target (say xxx) so you'll just enable the single target by something like ./configure --disable-all --enable-xxx. This can be already done by simply running make xxx. It'll check xxx backend is equivalent to EIR representation. Also, make elc-xxx should be able to test target/xxx.c can run on ELVM. IIRC running these two tests almost always makes sure the xxx backend can self-host.
That said, I agree current make is quite confusing. How about
makewithout any target fails with some help messages which suggest usingmake xxxinstead.- Split
make xxxintomake build-xxxandmake test-xxxas you suggested. - I think
make elc-xxxis confusing. Probably this should be renamed tomake test-full-xxx. - Files in out/ are very useful for debugging. Doesn't just running
rm -fr outwhen necessary work?
How about something like https://github.com/shinh/elvm/pull/49 ?
It's a start, but it would be nice if the Makefile was set up in a more traditional fashion:
makebuilds everything that is enabled by theconfigurescript (or, lacking aconfigurescript, the default options)make testtests everything that is enabled (building if not already built)make build-xbuilds thexbackendmake test-xtests thexbackend (building if not already built)make test-x-fulltests thexbackend, including self-hostingmake build-allbuilds everything (even things not built by default)make test-alltests everythingmake test-all-fulltests everything, including self-hosting (the current default target formake)
By cleaning up test files, I mean removing them after successful tests. Naturally, you'd want to keep them after failed tests so you can see what went wrong, but they're unnecessary after successful tests, and it would help save a lot of space if they were cleaned up after each successful test.
I changed the behavior of the default make so it now builds tools like out/8cc and out/elc. No tests are built/run by the default make. I also renamed test-full-xxx to test-xxx-full. I've merged my PR as it seemed to be better than the current behavior anyway.
I'm still not sure configure will be useful. Note out/elc have all backends anyway. build-xxx and test-xxx are just about building/running tests.
I tend to prefer keeping intermediate files even after successful tests.
These two points are just my preference. I don't want to do these changes by myself, but I won't oppose them either. If you don't like the current behavior, please feel free to fix it and send PRs. I'll just merge them.