Quick fix for incremental building#39
Merged
differrari merged 1 commit intodifferrari:mainfrom Aug 19, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a quick fix that took me a little bit to sort out. It is by no means an elegant solution, and might want a refactor in the future.
The problem that I noticed was that object files were being outputted to a build folder but the kernel binary depended on the OBJ variable, which contained all the object files being located in the same folder as the Makefile. So the OBJ variable adds on the path to the build folder, where the objects built, so the Makefile knows where they are when linking the kernel binary. The same goes for the shared Makefile and the user programs Makefile.
There is also variables that wrap around commands like gcc, g++, as and ld. They printed the object file they were outputting but because of my changes to the OBJ variable it printed weirdly like this
[CC] build/./kernel.o. So I adjusted those variables to output the source file that was being compiled like this[CC] kernel.c. However, if you want to keep printing the object file instead of the source file I can revert that change.I also changed how the build folder works slightly. Instead of stripping the directories off of an object file I mimic the folder structure of the source in the build folder. For example, when compiling
kernel/console/kio.c, it will be built tokernel/build/console.o. So I added a comment saying that you might want to delete those directories from the build folder when cleaning. I added that to the kernel, shared and user Makefiles. If you would like I can add that to the pr. Clean still does delete all the object files but just leaves those directories behindI have attatched a screenshot of what the build directory looks like now if my explanation is weird.