Makefile: deeper folder nesting support; fail build when SCANINC fails #1951
+8
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Code can now be placed in more deeply-nested directories.
The
scaninc
build step is modified so that ifscaninc
fails, the entire build fails on the spot with a detailed error message.Description
The makefile is altered so that if
scaninc
fails, we re-run it on the file it failed on and thenecho
an error message. The error message explicitly states thatscaninc
is what failed, that it failed because it encountered a fatal error, and that one of the previously printed messages wasscaninc
's error message. The error message also identifies the file thatscaninc
was invoked on during the failed run.Re-running
scaninc
after a failure and before weecho
may not actually be necessary. It was at one point during my random tinkering, in order to getscaninc
's own output to reliably display, but I'm not sure it is now, and I lack the expertise (and desire to engage) with makefiles needed to know for sure. Better too many messages than too few, I suppose.Anyway, the
scaninc
-related makefile changes should resolve the following problems:scaninc
error messages are not clearly identified as coming fromscaninc
.scaninc
error messages are not clearly identified as error messages at all, let alone fatal errors implying that some important process has halted.scaninc
failure doesn't always prevent the build from completing, if the user has previously built the repo properly. They may see unusual behavior (think "having to manually delete *.o files after making certain changes") but things will only blow up once they do a clean build later on, and at that point they'll blow up in spectacular fashion.scaninc
failure doesn't always prevent the build from completing, the messages it produces may be mistaken for warnings rather than fatal errors.scaninc
can choke on things that are valid C code, which only adds to the likelihood that a spurious failure may be mistaken for a warning if the build manages to complete. (Failures I've recently seen include: include directives whose paths contain redundant path separators like "folder//folder"; include directives that point to an empty i.e. zero-length header file; include directives that point to any file whose extension is unknown toscaninc
, e.g. *.txt or *.inl for code fragments used in preprocessor shenanigans.)The way I tested these changes was by creating a file containing only a semicolon, with file extension
inl
, and then#include
ing it from a source file. The include directive caused ascaninc
failure and the build halted with the new error message as intended. Removing the directive allowed the build to proceed again.Discord contact info
@davidjcobb