Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing make dependencies for .xpm files #114

Open
0cjs opened this issue Apr 7, 2020 · 2 comments
Open

Missing make dependencies for .xpm files #114

0cjs opened this issue Apr 7, 2020 · 2 comments

Comments

@0cjs
Copy link
Contributor

0cjs commented Apr 7, 2020

Some (but not all) of the res/*.xpm files are generated but have a broken dependency graph. For example, make clean build/asset.o will fail because it has #include "../res/splash.xpm" but no dependency arc to ensure that gets built first. This kind of thing causes mysterious random failures in parallel builds (make -j8).

As well as fixing this, it would also be nice to keep the source .xpm files and the object .xpm files in separate directories, to make it easier to distinguish the two when debugging problems like this. perhaps move the generated .xpm files to build/?

@ThorstenBr
Copy link
Contributor

The dependencies are actually there: they are automatically created. For each source file the proper list of dependencies is automatically created (and updated). So when a resource changes, this triggers an update of the generated header files, before compiling any source including the generated header.

The issue is that the dependencies are only created as a side-effect of the rule to compile a source. So the automatically generated dependencies are not available for the very first build (or after a 'make clean').

Manually maintaining the dependencies for individual files is ugly. There's at least three ways to fix this:

a) Botch in an exceptional make rule for the initial build, when dependencies are still missing (e.g. the "build" directory does not yet exist / no dependency ".d" files exist yet), so all resources are processed first in this case.

b) Separate the dependency generation from the build, so dependencies are fully generated first - and then already considered for the initial compile step of the sources.

c) Use a "makefile generator" like autotools or cmake, rather than manually coding the makefile. These build tools will already take care of such issues and generate proper makefiles.

Obviously (a) is the easiest fix. (b) would be cleaner but takes more effort. (c) is a larger and more fundamental change, which might trigger a basic discussion about the preferred build toolkit to use (usually an "autotools" vs "cmake" discussion these days). Moving on to a build tool would also help with other issues though, like #73.

@rhaleblian
Copy link
Contributor

rhaleblian commented May 26, 2020

I'm not getting any build order issues. Note that I'm using a revised Makefile from #119.

  1. moreover, now that the image targets are ephemeral, there's less chance of timestamp-related fails for Make.
  2. building images is still based on "glob-like" rules, being less verbose to maintain;
  3. those rules are called out by the rules requiring them;
  4. since (2) and (3), seems like we don't have to go so far as to invoke autotools, Make-makers, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants