Skip to content

Quick fix for incremental building#39

Merged
differrari merged 1 commit intodifferrari:mainfrom
BlurrySquire:fix-build
Aug 19, 2025
Merged

Quick fix for incremental building#39
differrari merged 1 commit intodifferrari:mainfrom
BlurrySquire:fix-build

Conversation

@BlurrySquire
Copy link
Copy Markdown
Contributor

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 to kernel/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 behind

I have attatched a screenshot of what the build directory looks like now if my explanation is weird.

If it doesn't load ask me on discord to send it

@differrari differrari merged commit c9c963c into differrari:main Aug 19, 2025
1 check passed
@BlurrySquire BlurrySquire deleted the fix-build branch August 19, 2025 13:56
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

Successfully merging this pull request may close these issues.

2 participants