I am currently working a little bit on on makefile stuff and got a bit confused. Looking at the documentation it seems like `subdirs` is one of the possible `classes` that we have.
But then I looked at payloads/libpayload/Makefile.mk file at this location: https://elixir.bootlin.com/coreboot/latest/source/payloads/libpayload/Makefi... and it seems to add classes where I would have expected it to use subdirs-y instead.
Can someone explain to me when to use classes-y and when to use subdirs-y?
libpayload uses both.
For example, line 52 defines a class "libcbfs", line 64 adds the subdir "libcbfs".And https://elixir.bootlin.com/coreboot/latest/source/payloads/libpayload/libcbf... adds its sources to the libcbfs class.
Roughly speaking: subdirs-y just makes the build system scan the Makefile in those subdirs. classes-y creates a new type of build artifact (e.g. bootblock/romstage/ramstage in coreboot, or the various libraries in libpayload), and then $classname-y collects the sources related to that artifact.
Hope this helps, Patrick