alexfru / SmallerC

Simple C compiler
BSD 2-Clause "Simplified" License
1.35k stars 155 forks source link

makefile is not multithreaded make compatible #47

Closed severach closed 3 months ago

severach commented 3 months ago

When I use make -j4 I get a variety of errors indicating that v0100/srclib/c0.asm is used before it is built or is partially built. This is usually because of a missing dependency but I can't figure out where c0 is in the Makefile.

make -j12 shows even more outlandish errors. make -j1 always works.

alexfru commented 3 months ago

If you want to (re)compile the library, most of it happens far outside of the makefiles. The source code files of the library are listed in the various srclib/lc.txt files. Each of those lc.txt files files essentially contains a very long list of arguments for smlrcc. See Recompiling.

alexfru commented 3 months ago

Um... That's how I usually (re)compile it. I've forgotten about the makefile also doing it but in a somewhat different way and I never tried it multithreaded.

alexfru commented 3 months ago

I think, I know what's going on. The same source files are compiled concurrently into intermediate files of non-unique names. That is, c0.c is being preprocessed into c0.i that is being compiled into c0.asm that is being assembled into c0.o. All of these files are written into the same srclib directory. Gotta figure out how to fix this, somehow give unique paths/names to those intermediate files.