News for hackers. Stuff that matters.
Re:A Modern C Development Environment by torstenvl on Friday August 11, 2023 @12:00AM (#37084974)
My solution: git submodules + every project stores its main sources in src/ + Makefile that recursively searches for "src/*.c" files and compiles them to a big ol object collection.

It's obviously not infinitely scaleable because you could end up with name conflicts for object files, or some modules might require custom build settings. But it works well enough to nest my own projects 3-4 layers deep without issue.

Re:A Modern C Development Environment by duped on Friday August 11, 2023 @12:41AM (#37085178)
git submodules have ruined my life on multiple teams enough to never want them. They're good enough for a dev team of 2-3 but don't scale very well. git subtree can be a bit better. But ultimately you probably want a working package manager.
Re:A Modern C Development Environment by eonwe on Friday August 11, 2023 @04:22AM (#37086338)
I've heard this often.

Why don't they scale? I used them for some years for a team of ten or so people who all first had to learn to understand how they worked so might that be the problem?

Re:A Modern C Development Environment by rtpg on Friday August 11, 2023 @06:37AM (#37087130)
It’s just annoying? Especially if you have access to everything, at one point just having a monorepo makes git “actually work”.
Re:A Modern C Development Environment by duped on Friday August 11, 2023 @10:26AM (#37089050)
The configuration of ssh vs https can break a lot of workflows, the inability to (reliably) track a branch from a submodule can make maintenance a pain, I've never really figured out how to reasonably do a rebase in the presence of gitmodules changes on both branches, github actions had broken support for submodules for quite awhile... just to name a few.

There's not one giant issue with submodules. There are dozens of small annoyances and footguns. I have yet to see a problem that is better solved by git submodules that can't be solved another way.

Re:A Modern C Development Environment by torstenvl on Friday August 11, 2023 @12:33PM (#37090618)
Using git subtree for dependencies is completely unworkable for two interrelated reasons:

(1) There's no recursive option; each dependency has to be pulled/pushed/etc. manually.

(2) Each manual pull/push/etc. of a subtree has to be explicitly path-specified and remote-specified.

There's just no way to `git subtree pull --prefix=specificdependencysubdir https://github.com/whatever/gadgets main --squash` for each of your dependencies, and each of their dependencies, etc. It's a tedious manual process for everything.

Best case scenario, you make a .PHONY target of `updatesubtrees` and manually keep it up to date with the directory structure and remote URLs of each dependency.